Pulling variables into Javascript
Mar 12, 2018
Assistance please. I know zero about javascript, other than being able to achieve things by copying a piece of code. I want to create a random integer and I have this code:
var randomnumber = Math.floor((Math.random()*10)+1);
var player = GetPlayer();
player.SetVar("randnum",randomnumber);
In this case, it creates a random number between 1 and 10. However, the maximum number is a variable previously set (called "Product").
Can anyone advise how to change the code so that it recognises my Product variable?
Thanks.
1 Reply
Thanks Matthew.
I t works (at least for the 20+ occasions I tried it).
Go to the top of the class!
This discussion is closed. You can start a new discussion or contact Articulate Support.