Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 18, 2012, 08:12 PM   #1
pruzzy
macrumors newbie
 
Join Date: Dec 2012
Location: Canada
Applescript game help?

Hi! This is my first post here.
I have been using applescript for some time now (trying out fake viruses, that stuff) and I have recently been trying to make a game. I have a basic question game that is pretty long but it kinda goes like this:
Code:
set question to display dialog "Quick! Cats or dogs!" buttons {"Dogs!", "Cats!"} default button 2
set answer to button returned of question

if answer is equal to "Dogs!" then
	display dialog "That wasn't fast enough, but nice choice." buttons {"Thanks...", "Your a little random"} default button 2
end if

if answer is equal to "Cats!" then
	display dialog "Answer quicker next time." buttons {"I tried my best...", "Your mean"} default button 2
end if

set question to display dialog "Quick! Snow or sun?!" buttons {"Snow!", "Sun!"} default button 2
set answer to button returned of question

if answer is equal to "Snow!" then
	display dialog "I said FAST! And I would have picked the same..." buttons {"Hmmph!", "*sob*"} default button 2
end if

if answer is equal to "Sun" then
	display dialog "FASTER! Suns nice isn't it?" buttons {"Yeah...?", "Yes-sir-ee-bob!"} default button 2
end if
 Those are just 2 of the about 8 questions I have then a conclusion. I wanted to know 2 things.
1. How do I make it quit? I tried looking around for how I can make it quit but I couldn't find anything so the question about halfway through that asks you if you want to quit, if you press that you want to quit, then it says you can't quit until it's done! How can  I make it so that if you press that you want to quit, it quits, but if you press the other option, it continues?
2. I want to make a more advanced game that does like:
"You are sitting home alone eating your pie with ice cream on top. You hear a rustling outside. What do you do?" then there are 2 buttons one says "Go out with a baseball bat" the other "Run upstairs and cry" then if you press the second, "You run upstairs but the door unlocks. You hear footsteps going up the stairs." "Grab a pillow and hide" or "Run out there screaming" and so forth. I don't want it just "random question" "options" "question" "options" and so on.
Thanks and sorry if this is long.:(

Last edited by stridemat; Dec 19, 2012 at 01:16 AM. Reason: Added code tags
pruzzy is offline   0 Reply With Quote
Old Dec 21, 2012, 07:40 AM   #2
Supermacguy
macrumors regular
 
Join Date: Jan 2008
If you save the script as an application, there is usually an option checkbox for "stay open". Uncheck that, and it will quit when it gets to the end.
Or, make a dialog that has 3 option buttons on it. The syntax is exactly the same as you have used before. But you can only make a "normal" dialog box with 3 buttons, no more.

For a choose-your-adventure game, you will need to be a lot more verbose. I am not sure the best option. It will probably involve a lot of sub-functions that return a value, and then the main function that repeats, would take that value and fire off another function based on the previous choice.
Supermacguy is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
AppleScript: How do I save multiple Excel sheets to one pdf using Applescript sbtaylor1 Mac Programming 0 Oct 28, 2013 11:38 PM
AppleScript: How do I save multiple Excel sheets to one pdf using Applescript sbtaylor1 Mac Applications and Mac App Store 0 Oct 28, 2013 11:32 PM
[FREE GAME] Catch The Kid - Top10 Drag&Drop Game vklymenko iPhone and iPod touch Apps 2 Feb 15, 2013 11:17 AM
New iPad game: iLogic-Hero -a fun to play Logic-game for all ages CCM2000Games iPad Apps 0 Oct 29, 2012 04:36 PM
Suden game performance issues, Any game drops to low fps after 10-15min LaDirection Mac and PC Games 8 Oct 5, 2012 12:55 AM

Forum Jump

All times are GMT -5. The time now is 09:24 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC