Did I get this right? You have a global Construct variable called ShotCount. You have a js function called Compare (Sic!) that takes a string argument, evals it and returns the result. Then you call js function "Compare" from Construct with the action "Call js function" and pass the parameter which is basically "shotCount % 3 == 0".
If I got this right, you get a fair response "shotCount is not defined". Because there's no such variable in global scope of your js-script. Construct variables are not real. They don't exist in your js-script. Construct variables are virtual and only make sense to the engine itself and to the js-plugin ACEs. So if you want your js script to operate with construct variables (which is totally upside-down), you should either pass them as arguments to js functions, or create js variables in your script, set their values to Construct variables values (use aliases) and then operate with those js variables.
If you're just playing around with the plugin, it's alright. But if you're really trying to achieve something here, this something is not clear to me. Maybe if you tell me what you're trying to do, we'll find a suitable solution for that.
Also can you send me a project file please?
Amazing plugin! I ran into a little problem I was hoping you could help me with:
I'm trying to use this script to eval a string. This string could contain any number of global variables and even call functions
A test string, called var1 is this: "shotCount % 3 == 0"
The event is JS Call Function "Compare" with parameter 0 being var1
The .js file has this:
function Compare(a) {
return eval(a);
}[/code:2t75r8km]
But it doesn't work, it says "shotCount is not defined" in the log. If I change var1 to something like "2+2" it evals correctly.
I don't want to pass the global variable because I need this to be flexible and allow multiples and any variable. Do I need to somehow put the variables into the scope of the JS plugin?