for practicing I am trying to code a simple guess-the-number-game. I tried it with one button and the mouseUp event but didn't get anywhere. I tried now by adding another button and another mouse event and am trying to pass a variable from one to another but I think it's not working. This is the code:
button 1 (start):
Code: Select all
on mouseUp
put random(100) into field f3
put 0 into x
end mouseUp
Code: Select all
on mouseUp
put "Too high!" into toohigh
put "Too low!" into toolow
put "Perfect guess!" into bingo
if field f3 is not empty then
repeat while x is 0
if field f1 > field f3 then
put toohigh into field f2
else if field f1 < field f3 then
put toolow into field f2
else
put bingo into field f2
put 1 into x
end if
end repeat
end if
end mouseUp