Thread: Applescript help
09-20-2011, 10:33 PM #1
- Member Since
- Sep 20, 2011
I'm trying to get into programming and I figured what a better place to start than applescript? So I started with some basics and then decided that I would try my hand at a text based exploration game as a learning experience.
I've been using this format for coding the game:
set answer1 to text returned of (display dialog "" default answer "")
if answer1 contains "" then set answer2 to text returned of (display dialog "" default answer "")
the problem I have is that in order for a player to control where they go in the game, they use compass directions. This becomes an issue when going more than one step away from the origin because I have to start doing this:
if answer1 contains "" and answer2 contains "" then set answer3 to text returned of (display dialog "" default answer "")
in order to make the world fully explorable I have to code for every single direction they can take and at three moves away from the origin I gave up counting the possibilities I would have to code because they were over 150. This left me with two pages of code for only three moves away.
If I'm going to expand the game any further I need a way to get rid of all the if answerX contains and answerY contains and answerZ contains...
Is there anyway to consolidate all that into something simple? I really can't come up with new variables for answers everytime the player moves?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By EdMarx in forum OS X - Apps and GamesReplies: 0Last Post: 02-10-2012, 04:06 AM
By SgtDave in forum OS X - Development and DarwinReplies: 6Last Post: 01-19-2011, 03:50 PM
By thtguyjosh in forum OS X - Apps and GamesReplies: 8Last Post: 08-22-2010, 07:22 PM
By nixonbw in forum OS X - Operating SystemReplies: 0Last Post: 07-17-2008, 07:00 PM
By TehHero in forum OS X - Apps and GamesReplies: 0Last Post: 01-26-2008, 09:46 PM