I am trying to make a "Riddle quiz, just for fun, and I keep running into the same problem; I get an error saying that the variable "result" is not defined. The word that is highlighted after I click ok is in red.
The goal of the script will eventually be to have the person using it to have to answer each riddle correctly before moving on, and if a hint is needed it will be given.
If possible, I would like to know whether or not its possible to "grade" the quiz with a dialog box at the end if i made it five questions long.
Here's the script:
The goal of the script will eventually be to have the person using it to have to answer each riddle correctly before moving on, and if a hint is needed it will be given.
If possible, I would like to know whether or not its possible to "grade" the quiz with a dialog box at the end if i made it five questions long.
Here's the script:
Code:
display dialog "Take -The Amazing Riddle Quiz-?" buttons {"Yes, please!", "No, thank you."} default button 2
if button returned of result is "Yes, please!" then
display dialog "To answer each riddle, type your ONE WORD answer into the text field with no caps. Check your spelling before submitting!" buttons {"Okey doke, lets go!", "Nevermind, I don't want to."} default button 2
if button returned of result is "Okey doke, lets go!" then
set result to false
repeat until [COLOR="Red"]result[/COLOR] = {textreturned:"stapler", buttonreturned: "Submit answer"
display dialog "With pointed fangs I sit in wait,
With piercing force I dole out fate,
Over bloodless victims proclaiming my might,
Eternally joining in a single bite.
I am a(n)..." default answer "" buttons {"Submit answer", "Hint"} default button 1
if button returned of result is "Hint" then say "I live in your office" using "Alex"
end repeat
end if
end if
end
Last edited: