I am trying to replicate the snakes and ladders game I have seen within this site somewhere. This is as far as I have got. I am stuck on the random number variable. I can't get it to work. I have uploaded it to a web server and still it doesn't work. I am attaching it. Any help gratefully received. Thanks
the snakes and ladders game was my creation. In my original forum post I have uploaded a PDF detailing how I created the game, I believe the script is in there
Here is the script I used for the dice. The script will produce a number from 0-6, if a 0 is generated I have added a trigger to +1 to the value so the player rolls a 1 instead.
var number=Math.floor(Math.random()*7); GetPlayer().SetVar("varp1dice",number);
13 Replies
Are you testing locally? If yes, then the JavaScript may be blocked by your browser's security settings. I uploaded your file to a webserver and it works as expected, see here: http://dev.keypointlearn.com/xcl71_SL/RandomJS/V1/story.html
Hi There
I am trying to replicate the snakes and ladders game I have seen within this site somewhere. This is as far as I have got. I am stuck on the random number variable. I can't get it to work. I have uploaded it to a web server and still it doesn't work. I am attaching it. Any help gratefully received. Thanks
Can you share the .story file here, so that we can take a closer look?
Sorry I thought I had attached it!
Sorry I added the Powerpoint! Here it is
Hi Elizabeth
See attached a working Javascript for your number generator, just use the file below as resource and copy the code over!
Hi Elizabeth,
the snakes and ladders game was my creation. In my original forum post I have uploaded a PDF detailing how I created the game, I believe the script is in there
Here is the script I used for the dice. The script will produce a number from 0-6, if a 0 is generated I have added a trigger to +1 to the value so the player rolls a 1 instead.
var number=Math.floor(Math.random()*7);
GetPlayer().SetVar("varp1dice",number);
Thank you very much for going to all that trouble. I really appreciate it.
Kind regards
Liz
Sent from my iPad
Thank you very much indeed. I think you are all amazingly helpful and I am very grateful to you all
Sent from my iPad
Thank you Darren. Your snakes and ladders game is fab and can be adapted for all sorts of things.
Sent from my iPad
You're welcome Elizabeth
If you run into any more hurdles along the way just shout and I'll see what I can do to help
Glad you got the help you needed here Elizabeth - and best of luck with your other projects!
This discussion is closed. You can start a new discussion or contact Articulate Support.