if function in a jstrigger

Jun 30, 2014

In a jstrigger I have written the following program. But the condition does not work. Is someone have an idea about how to write it ? Thanks in advance

var player=GetPlayer();
var ranr = player.GetVar("V1");

if (V1>10){
return player.SetVar("TextEntry","Good");
}
else{ return player.SetVar("TextEntry","Try again");
}

2 Replies
Michael Hinze

I'm not sure why you would need a javascript to do this simple comparison (could easily be done with Storyline triggers), but here is a corrected script that works for me:

var player=GetPlayer();
var ranr = player.GetVar("V1");

if (ranr>10){
return player.SetVar("TextEntry","Good");
}
else{ return player.SetVar("TextEntry","Try again");
}

This discussion is closed. You can start a new discussion or contact Articulate Support.