I was just curious if we can make a global variable via the script call event command.
I have tried this
but everytime I activate the event it shows "new" which means $test is null before it runs
but if I put this line in a plugin
and edit the script call from
into
everything works fine, it showed the "new" message only once.
I also tried putting the var $test = null; in a different event (of course removing the line from the plugin), and it also didnt work. I activated that event first before the main one but it resulted to also showing "new" everytime I activate the main event.
So it made me think that we cannot define a new global variable via the script call command. Is that the case?
I have tried this
Code:
if ($test == null) {
console.log("new");
var $test = new TextCache();
}
but everytime I activate the event it shows "new" which means $test is null before it runs
but if I put this line in a plugin
Code:
var $test = null;
and edit the script call from
Code:
var $test = new TextCache();
Code:
$test = new TextCache();
I also tried putting the var $test = null; in a different event (of course removing the line from the plugin), and it also didnt work. I activated that event first before the main one but it resulted to also showing "new" everytime I activate the main event.
So it made me think that we cannot define a new global variable via the script call command. Is that the case?