Hello Guest it is March 29, 2024, 05:19:40 AM

Author Topic: Mach4 screen action/script precedence  (Read 451 times)

0 Members and 1 Guest are viewing this topic.

Offline Rimmel

*
  •  207 207
    • View Profile
Mach4 screen action/script precedence
« on: August 03, 2022, 08:18:53 AM »
On a button there are actions and scripts that can be attached to the button (see picture).

It seems both can be used together e.g. I have an action assigned and also a script and they both execute, but what is the order they execute?

Action then script?

thanks
Re: Mach4 screen action/script precedence
« Reply #1 on: August 03, 2022, 05:22:06 PM »
Hi,

Quote
Action then script?

No idea. An action is internally programmed in Machs core whereas the script is part of the runtime ScreenScript. They do not run simultaneously
but rather consecutively as co-routines. The toggle button is a screen element and therefore the screen script must be running for the button event to be detected
and I would guess therefore that the script would run, given that the ScreenScript is the active chunk and THEN be released to Machs core whereon the Action would run.

This is just a guess.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 screen action/script precedence
« Reply #2 on: August 04, 2022, 09:57:01 AM »
You could set up a test that pops up a message. 
Set the action to something that runs as a function from the screen load script... ie the cycle stop function and add a mc.mcCntlSetLastError(inst, "Test Action") to the function and then have your script do the same thing:
local inst = mc.mcGetInstance()
mc.mcCntlSetLastError(inst, "Test Script")

I tried this on my end.  I couldn't get a button to do any actions.  Weird.  I never use the actions, I always add scripts to buttons. 
Maybe try this on your end and see what you can do.
Chad Byrd