Code: Select all
on mouseUp
put the text of fld "fld_guess" into theGuess
set the randomSeed to the long seconds
put random(100) into theAnswer
//Will repeat using the same number until the correct number is guessed
repeat until theGuess is theAnswer
if theGuess is theAnswer then
answer "Correct"
exit repeat
put empty into fld "fld_guess"
//If the number is more than 5 numbers too low
else if theGuess < (theAnswer - 5) then
answer "Too low! Try a higher number!"
put empty into fld "fld_guess"
//If the number is more than 5 numbers too high
else if theGuess > (theAnswer + 5) then
answer "Too high! Try a lower number!"
put empty into fld "fld_guess"
//If the number is 5 or less numbers too low
else if theGuess < theAnswer && (theGuess >= theAnswer - 5) then
answer "Close! Just a little higher."
put empty into fld "fld_guess"
//If the number is 5 or less numbers too high
else if theGuess > theAnswer && (theGuess <=theAnswer + 5) then
answer "Close! Just a little lower!"
put empty into fld "fld_guess"
end if
end repeat
end mouseUp