How do you define and initialize a global variable?

Discuss Lemur and share techniques.
Post Reply
rgames
Newbie
Posts: 20
Joined: 22 Dec 2015 22:43

How do you define and initialize a global variable?

Post by rgames »

I assumed that global variables are defined immediately under the "Project" heading at the top of the project hierarchy. Also, I assumed that the blue numbers next to them are the initial values. If so, then in the attached image, all the names with green dots next to them are global variables, correct?

And the blue numbers are the initial values, correct?

I have a bug where the global variable "sendLibrariesCC" is not being read correctly by a script (if it is, in fact, a global variable...). I set the value in one script, then another script executes with an "if" statement dependent upon the value of that variable. However, the script is not executing properly given the state of the variable. So I'm just trying to confirm that I do, in fact, have a global variable. If the variable is not global then that could explain the behavior.

I can't find this info in the manual.

Thanks,

rgames
Attachments
GlobalVars.jpg
GlobalVars.jpg (20.96 KiB) Viewed 1341 times
MrCorba
Regular
Posts: 142
Joined: 02 Sep 2013 20:17
Location: Netherlands

Re: How do you define and initialize a global variable?

Post by MrCorba »

Those are indeed global variables. Those variables can be read/changed from anywhere.The blue numbers represent the initial values given to them. If you change the value with a script those blue numbers won't change(unfortunately).. So I guess there is an error in your execution script.

Cheers!
"Having no silence in music is like having no black or white in a painting" - Brian Eno
https://soundcloud.com/mrcorba
rgames
Newbie
Posts: 20
Joined: 22 Dec 2015 22:43

Re: How do you define and initialize a global variable?

Post by rgames »

Great- thanks!

Off to look elsewhere for the problem...
microtonal
Newbie
Posts: 24
Joined: 21 Nov 2015 23:51

Re: How do you define and initialize a global variable?

Post by microtonal »

MrCorba's response is correct. Elaborating a bit, if you want to use a variable across multiple scripts, it must be defined as a global variable at the project level. Some projects will define the variable as zero and automatically regenerate the needed values in the scripts. Global arrays are also defined this way, but values are always defined in the scripts.
Post Reply