New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Ľ Advice and insight from world-class Apple enthusiasts Ľ Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Apps and Games Discussion of applications and games available for Mac OS X.

Applescript help

Post Reply New Thread Subscribe

Thread Tools

Member Since: Sep 20, 2011
Posts: 1
lucidknight is on a distinguished road

lucidknight is offline
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?
QUOTE Thanks

Post Reply New Thread Subscribe

« Firefox/Flash latest version issues | College Student with new Macbook Pro. Help me out? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
Restarting Application using Applescript from Java? iwebdevelop OS X - Development and Darwin 7 08-10-2011 07:53 AM
Applescript help with serial port access ljimber OS X - Development and Darwin 0 06-24-2011 11:46 AM
help needed to link up buttons on HUD Window to Applescript nick_harambee OS X - Development and Darwin 0 09-30-2010 08:26 AM
Logic Express and Applescript via GUI Scripting albertaurus Music, Audio, and Podcasting 0 04-09-2009 01:13 PM
[ANN] New comprehensive AppleScript book hanaan OS X - Development and Darwin 0 11-06-2004 07:28 PM

All times are GMT -4. The time now is 04:20 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?