-
talofa, I'm making this game where you have to click on this button which randomly chooses a number between 1 and 20. That works fine but I want to make it so that when a number is chosen once it won't be chosen again. So in theory you would only have to click on the button 20 times to get all 20 numbers. Randomly.
cheers
Peter
-
Angkor-What?
After the button is clicked store the random number into a variable for instance var click1 = 17, var click2 = 9 and so on. So after the button is clicked check if the random number is the same as click1 or click2 and if so go thru the loop again...
Gekke_Hollander
On (Release)
Set Variable: "varnumber" = Random (19)+1
Set Variable: "howmanyclicks" = howmanyclicks+1
Comment: or is it how many licks?
Set Variable: "x" = "1"
Loop While (x <= howmanyclicks)
If (varnumber = "click"&howmanyclicks)
Set Variable: "varnumber" = Random (19)+1
Set Variable: "x" = "0"
Else
Set Variable: "click"&howmanyclicks = varnumber
End If
Set Variable: "x" = x + 1
End Loop
End On
DO NOT BET YOUR LIFE ON THIS CODE AS I HAVE NOT TESTED IT!!!
but let me know if it worked...
Gekke
-
thanks Gekke,
I'll give it a spin and let you know how it went
cheers
Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|