This simple lucktest doesn’t work and I can’t see why?
What should happen is, a random number of 1 to 12 is generated and compared to Luck. Luck has been defined in startup
Instead what happens is that the same score is generated over and over
here is the startup txt:
*create luck 8
*create lucky false
*create lucktext “lucky”
And now the gosub:
*label lucktestgosub
*temp lucktest 0
*rand lucktest 1 12
*if (luck > lucktest)
*set lucktext "lucky"
*set luck -1
*set lucky true
*return
*else
*set lucktext "unlucky"
*set luck -1
*set lucky false
*return
here is the code that shows the score
*choice
#Test your luck
*gosub lucktestgosub
You have been ${lucktext} with a score of ${luck}
This text always shows 7, I have tried changing {luck} to {lucktest} but that doesn’t show anything
Apologies, I can’t see what is wrong?