Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Expected the end of line, but found else if! (ApplescriptEditor)

display dialog "Whats your name?" default answer "My name is..."

set theName to (text returned of result)

display dialog "Hello " & theName & ", I need you to follow the instructions on the next page… For the fate of my life is in your hands!"

display dialog "Well, My name is Ryan Connor, and i work at the C.I.A, recently i have been kidnapped by a North Korean group of Terrorists. I am located at the coordiantes X=47.6/ Y=59.9/ and Z=24.5."

display dialog "Pick a way to travel to save me!" buttons {"By car", "By Boat"}

if the button returned of the result is "By car" then

display dialog "Not the smartest idea for traveling, but i respect your opinion and lets get on the road!"

else

display dialog "Ok boat was a clever idea, so props to you. Lets quit talking and get sailing!" buttons {"OK!"}

display dialog "You have traveled 50 miles so far and have come across a gang who say they are gonna beat you up…" buttons {"Oh No!"}

end if

display dialog "Ok so this gang situation is kinda a big deal… So do you wanna run away or fight?" buttons {"Fight", "Run"}

else if the button returned of the result is "Fight" then

display dialog "SORRY YOU DIED!"




so im trying to make this story keep going on! But is there any way i can lengthen this stuff??? Because apparently i already used my if/else/and end if! Please help me, im new to script editor... As well as if u could edit this for me it would be greatly appreciated! 😀


-Ryan

Mac OS X (10.7.5)

Posted on Mar 22, 2013 9:54 PM

Reply
Question marked as Best reply

Posted on Mar 22, 2013 10:01 PM

Here:


display dialog "Whats your name?" default answer "My name is..."

set theName to (text returned of result)

display dialog "Hello " & theName & ", I need you to follow the instructions on the next page… For the fate of my life is in your hands!"

display dialog "Well, My name is Ryan Connor, and I work at the C.I.A. I've recently been kidnapped by a North Korean group of terrorists. I am located at the coordiantes X=47.6/ Y=59.9/ and Z=24.5."

display dialog "Pick a way to travel to save me!" buttons {"By car", "By boat"}

if the button returned of the result is "By car" then

display dialog "Not the smartest idea for traveling, but I respect your opinion and lets get on the road!"

else

display dialog "Ok boat was a clever idea, so props to you. Let's quit talking and get sailing!" buttons {"OK!"}

display dialog "You have traveled 50 miles so far and have come across a gang who say they are gonna beat you up…" buttons {"Oh no!"}

end if

display dialog "Ok so this gang situation is kinda a big deal… So do you wanna run away or fight?" buttons {"Fight", "Run"}

if the button returned of the result is "Fight" then

display dialog "SORRY YOU DIED!"

end if


(79260)

9 replies
Question marked as Best reply

Mar 22, 2013 10:01 PM in response to RyanfromVirginia

Here:


display dialog "Whats your name?" default answer "My name is..."

set theName to (text returned of result)

display dialog "Hello " & theName & ", I need you to follow the instructions on the next page… For the fate of my life is in your hands!"

display dialog "Well, My name is Ryan Connor, and I work at the C.I.A. I've recently been kidnapped by a North Korean group of terrorists. I am located at the coordiantes X=47.6/ Y=59.9/ and Z=24.5."

display dialog "Pick a way to travel to save me!" buttons {"By car", "By boat"}

if the button returned of the result is "By car" then

display dialog "Not the smartest idea for traveling, but I respect your opinion and lets get on the road!"

else

display dialog "Ok boat was a clever idea, so props to you. Let's quit talking and get sailing!" buttons {"OK!"}

display dialog "You have traveled 50 miles so far and have come across a gang who say they are gonna beat you up…" buttons {"Oh no!"}

end if

display dialog "Ok so this gang situation is kinda a big deal… So do you wanna run away or fight?" buttons {"Fight", "Run"}

if the button returned of the result is "Fight" then

display dialog "SORRY YOU DIED!"

end if


(79260)

Mar 22, 2013 10:19 PM in response to Niel

ugh Niel i know that your gving me the correct answer, but im screwing it up... Does this look right? Still says end of if ]




display dialog "Whats your name?" default answer "My name is..."

set theName to (text returned of result)

display dialog "Hello " & theName & ", I need you to follow the instructions on the next page… For the fate of my life is in your hands!"

display dialog "Well, My name is Ryan Connor, and I work at the C.I.A. I've recently been kidnapped by a North Korean group of terrorists. I am located at the coordiantes X=47.6/ Y=59.9/ and Z=24.5."

display dialog "Pick a way to travel to save me!" buttons {"By car", "By boat"}

if the button returned of the result is "By car" then

display dialog "Not the smartest idea for traveling, but I respect your opinion and lets get on the road!"

else

display dialog "Ok boat was a clever idea, so props to you. Let's quit talking and get sailing!" buttons {"OK!"}

display dialog "You have traveled 50 miles so far and have come across a gang who say they are gonna beat you up…" buttons {"Oh no!"}

end if

display dialog "Ok so this gang situation is kinda a big deal… So do you wanna run away or fight?" buttons {"Fight", "Run"}

if the button returned of the result is "Fight" then

display dialog "SORRY YOU DIED!"

end if

return

if the button returned of the result is "Run" then

display dialog "You made it!"

Mar 22, 2013 10:27 PM in response to Niel

display dialog "Whats your name?" default answer "My name is..."

set theName to (text returned of result)

display dialog "Hello " & theName & ", I need you to follow the instructions on the next page… For the fate of my life is in your hands!"

display dialog "Well, My name is Ryan Connor, and I work at the C.I.A. I've recently been kidnapped by a North Korean group of terrorists. I am located at the coordiantes X=47.6/ Y=59.9/ and Z=24.5."

display dialog "Pick a way to travel to save me!" buttons {"By car", "By boat"}

if the button returned of the result is "By car" then

display dialog "Not the smartest idea for traveling, but I respect your opinion and lets get on the road!"

else

display dialog "Ok boat was a clever idea, so props to you. Let's quit talking and get sailing!" buttons {"OK!"}

display dialog "You have traveled 50 miles so far and have come across a gang who say they are gonna beat you up…" buttons {"Oh no!"}

end if

display dialog "Ok so this gang situation is kinda a big deal… So do you wanna run away or fight?" buttons {"Fight", "Run"}

if the button returned of the result is "Fight" then

display dialog "SORRY YOU DIED!"

end if

if the button returned of the result is "Run" then

display dialog "You made it!"

end if



Added it and it gave me the error the variable result is not defined... Im really sorry about bugging u man, im just a noob at this :/

Expected the end of line, but found else if! (ApplescriptEditor)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.