I can't retrieved a Global Variable in an EA. First I am setting a Global Variable with a
script. Then I am attempting to read the Global Variable in an EA. Here is the code and errors.
What is wrong?
GlobalVariableSet(testVar, 12345); // set the global variable
int xyz = GlobalVariableGet(testVar); // get the global variable just as a test
Print("Script: ",xyz); // prints: "Script: 12345"
int abc = GlobalVariableGet(testVar); // get variable
Print("Error: ",GetLastError()); // prints, "Error: 4058". global variable not found
Print("Result: ",abc); // prints, "Result: 0"
Most probably is like that.
After setting up a Global Variable with a script, open GV inside terminal and see if the GV is set or not.
You track and do troubleshooting first.
This is the first time I've looked at a global variable in
the terminal. I found it by pressing F3. Yes -- the value of "12345"
And guess what I found out. The EA has to be loaded and
running for this to work! Somewhere in the process the EA got unloaded. Thanks
for the education everyone.
To add comments, please log in or register