Macros & Variable Handling

  • Really sorry, for not realising, its international:

    So i add the english part ontop ;)

    Hello everyone,

    I know, I'm a kind of early about that, but it really interrests me.

    I have checked out the MA3 ONPC and recocnized: The way to handle with variables in macros changed a bit. I found the keyword setuservar in the manual. But I couldnt find a way to work with this var afterwords, like calculating, comparison, and so on.

    Has anybody already encountered some informations about that? Is the known "addvar" function there, or does it work different?

    How does the case handling / comparison work? The old way like [$var == 10] seems not to work properly

    unfortenatly, I couldnt find something in the Help or elsewhere in the net on that topic now. This featueres are important for my way of working with a startshow, cause I'm used to have a big macro preprogramming a bunch of executors.

    Thanks for any informations on this topic.

    Kind regards, Kolja Klein

    original :

    Hallo miteinander,

    ich weiss, ich bin sehr früh damit, aber das brennt mir einfach =)

    Ich habe heute ein wenig im MA3 ONPC herumgeklickt, und dabei ist mir aufgefallen, dass das Variabelhandling anscheinend etwas umgestellt wurde. So habe ich im Manual unter den keywords "SetUserVar" gefunden. Wie ich aber mit den Variablen anschliessend arbeite, also rechne, vergleiche, etc, habe ich nicht finden können.

    Hat zu diesem Tema schon jemand mehr herausgefunden? Gibt es das "addvar" noch ? Funktioniert das jetzt evtl anders?

    Wie funktioniert das case Handling? (früher [$variable == 10] ). Kann man mittlerweile vielleicht auch addieren? Wie kann ich die Variable in Befehlen nutzen?

    Leider habe ich dazu in der Hilfe, als auch sonst noch nichts finden können. Das ist jedoch für meine Startshow (welche mir eine menge Executor und Playbacks programmieren soll) unerlässlich.

    Beste Grüsse, und Danke für Infos,


    Edited once, last by Keule (December 13, 2019 at 1:50 AM).

  • SetUserVar / SetGlobalVar <variable name> <value>

    • SetUserVar my_name "Ryan Kanarek"
    • SetGlobalVar the_answer 42

    GetUserVar / GetGlobalVar <variable name>

    • Approximately the same as MA2's "ListVar"
    • GetUserVar my_name
      • Command Line History shows: my_name text "Ryan Kanarek"
    • GetGlobalVar the_answer
      • Command Line History shows: the_answer int 42
    • GetUserVar *
      • Lists all UserVars, their types, and their values

    DelUserVar / DelGlobalVar <variable name>

    • I think you can guess what this one does

    To call a variable, use $<variable name> like you would in MA2.

    Not implemented as of v1.0.0.3:

    • Doing math on variables
    • Conditional expressions / comparisons

    Edited once, last by Ryan Kanarek (December 19, 2019 at 5:33 PM).

  • Ok, I tried the $var, and that works fine, as in ma2.

    so, I'm looking forward for the implemantation of (hopefulle at least) simple math and comparisons.

    Without that, variables are not that powerfull as they could be, and it is necesary for my type of Startshow. But there is still some time, cause my actual startshow has been updatet just last week, so I will for shure stay on MA2 for a few more month =)

  • Some further questions about variables:

    Is it possible yet to make presets and group elements a variable?

    DeleteUserVar / DeleteGlobalVar <variable name> doesn't seem to actually delete any variables. keeps coming up with illegal object.

  • Is there a way (if yet implemented) so set an integer var with questioning? f.e. setu test () allways returns a text value. I would like this to be an integer (number)

  • Hello, my question would be when will system variables and conditional expressions / comparisons be available.

    These are essential to switch from MA2 mode to MA3 mode.

  • system variables and conditional expressions can be reached via the Lua keyword, and inside plugins

    e.g. gma2 commandline syntax with system variable and conditional expression

    [$SELECTEDFIXTURESCOUNT > 8] MAtricksWings 2 

    e.g. gma3 commandline syntax with system variable and conditional expression

    Lua "if SelectionCount() > 8 then CmdIndirect('Matricks xwings 2') end"

    e.g. gma3 plugin

    return function()
      if SelectionCount() > 8 then 
         CmdIndirect('Matricks xwings 2') 

    While the gma2 syntax is slightly more compact, the gma3 Lua approach is far more flexible and offers extended functionality like: and, or, if..else etc.

  • Here is couple things to start with.

    This is the official LUA documentetiaon, in this you can find every function:

    This is a brief video tutorial series for LUA programming:

    External Content
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    I'm a rookie...

    Sorry for the dumb questions :D:D:D Please be patient ;) I'm still learning.

  • I think they are looking more for the GMA 3 API's

    I have posted ones that I have found here, but I have not found everything and this is 100% un-official. For example I know of the existence of CmdIndirect but I don't know what it does as of yet.

  • to my understanding:

    You can see the difference between Cmd() and CmdIndirect() in the system monitor

    Cmd('Fixture Thru')

    -> LUA [timestamp] OK: Fixture Thru

    CmdIndirect('Fixture Thru')

    -> MainTask [timestamp] OK: Fixture Thru

    When/why does is matter in which thread the commandline syntax is executed?


    -> LUA [timestamp] Attempt to call a UI function from a non-UI thread (LUA)

    -> LUA [timestamp] Failed: Login


    -> Login dialog is displayed

    -> MainTask [timestamp] OK: Login

    So if there is any chance that your commandline syntax will try to initiate a UI -dialog (e.g a store-popup), you should execute the syntax indirectly via the MainTask queue, instead of directly within the Lua thread.

  • So if there is any chance that your commandline syntax will try to initiate a UI -dialog (e.g a store-popup), you should execute the syntax indirectly via the MainTask queue, instead of directly within the Lua thread.

    I don't remember the thread but I seem to recall having an issue calling a plugin from a lua script, you solved it then but I wonder if CmdIndirect() would have solved it too.

    I have to search for it to remember what the issue was to start with, I'm getting old.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!