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?