Accumulate Score on a random number.
LA-Laker
06 Apr 2018, 03:51Hello.
I need help. How can I get the score to accumulate on a random number?
Here is the code below:
[[start]]:
@set p1_score = 0
getRndInteger = function(min,max){
return Math.floor(Math.random()*max)+min;
};
Hello.
var rndInt = getRndInteger(0,2);
set("int",rndInt);
Your random integer is: {int}.
Player 1's Score: {p1_score}
{RESULT}
[[RESULT]]:
{if int=0: {RES00} }
{if int=1: {RES01} }
[[RES00]]:
You missed the shot.
[[RES01]]:
@inc p1_score 2
You made a two pointer.
![](https://i.imgur.com/mBf7TBeb.png)
K.V.
06 Apr 2018, 05:03Something like this?
[[start]]:
getRndInteger = function(min,max){
return Math.floor(Math.random()*max)+min;
};
@set p1_score=0
Hello.
[get a random integer]
Player 1's Score: {p1_score}
[get a random integer]:
var rndInt = getRndInteger(0,2);
set("int",rndInt);
Your random integer is: {int}.
{if int=0: {RES00} }
{if int=1: {RES01} }
[[RES00]]:
You missed the shot.
[[RES01]]:
{@p1_score+=2}
You made a two pointer.
Player 1's Score: {p1_score}
LA-Laker
10 Apr 2018, 04:29This will work out just fine. Thanks!!
![](https://i.imgur.com/mBf7TBeb.png)
K.V.
10 Apr 2018, 04:29I made a two pointer!