Graphics

 View Only
  • 1.  Global variables in the Scripting Engine

    Posted 08-27-2013 21:36
    Hello,

    I was told today by another developer today that the Scripting engine now supports global variables.

    However, I wanted to test this but I couldn't get it to work. Can somebody confirm me if this is true?

    Thank you,

    Kenneth


  • 2.  RE: Global variables in the Scripting Engine

    Ross Staff
    Posted 08-28-2013 05:33
    Hello Kenneth,

    Globals have worked in the past for me. The syntax is...

    Storing to Global Variable: _Global.Value("nameofvariable") = "Text Value Goes Here"

    Recalling from Global Variable: TextObject.Text = _Global.Value("nameofvariable")

    Naturally, you can plug in string, integers, or anything else. However, there's no way to explicitly determine what the type of variable is. So you have to be very explicit when you compare against globals. I basically treat them as strings, even though they may not be.

    Hope that helps,

    Chris

    #XPression


  • 3.  RE: Global variables in the Scripting Engine

    Posted 03-07-2024 17:47

    I can confirm this works. There was an older post suggesting to use the format ".GetValue" and ".SetValue" which DOES NOT work (maybe it did then).



    ------------------------------
    Ben Stahl
    ------------------------------



  • 4.  RE: Global variables in the Scripting Engine

    Posted 03-12-2024 20:08

    Update: while this method does work, at least sometimes, in the Designer machine using it made the machine very crashy. Studio would hang pretty often when setting/getting the global variable, although not consistently. I tried all the usual things like restarting the app, rebooting, etc. When not using these methods, it regained normal stability. I'm not sure what's going on, maybe a race condition somewhere, but we have no visibility into the process. So be careful, especially for a live situation.



    ------------------------------
    - Ben
    ------------------------------