Game Maker's Garage Forum
Game Creation => SilverCreator => Topic started by: Xiphos on December 12, 2009, 09:35:00 PM
-
How to make it so random(3) doesn't have the option of 0.
random(2)+1 doesn't work.
-
LET X = RANDOM(2)
LET X = X + 1
-
thanks
-
(this is sc help right?) wha?! random(3) doesnt have the option of 0
-
SilverCreator would have no problem doing RANDOM(2)+1, so I'm going to assume that this is a GM question and move it to the GM board.
-
Hmm. I thought it was for SilverCreator. GameMaker will give you a random number from 1 to the number you put in the command.
x = RANDOM 3
will give a result from 1 to 3
If you put multiple parameters after RANDOM then it will give you a random number of any of the numbers listed.
x = RANDOM 5 10 15 20
will give a result as either 5, 10, 15, or 20.
-
I think you're right. GM doesn't use LET or parenthesis. Push it back to the SC board.
-
Actually GM can use LET. It's optional. I added that a while back to make code more compatible between SC and GM. I think code even runs slightly faster if you use LET instead of using nothing.
I'll push it back to the SC board anyway because I think he was using SC.