From: Martin DeMello Date: 2008-08-05T23:46:45+09:00 Subject: Re: Catching (or saving) errors. On Tue, Aug 5, 2008 at 7:28 AM, Tim Mcd wrote: > > > Didn't know a nice if like that would just take care of it! Also, did > you test that code? Or the concept? I'm pretty sure you can't do > exits[avar[. I did some testing with that earlier... Yep, I tested it before pasting it in. What I'm doing is this: 1. defining exits as a hash 2. writing a case statement to convert move from "N" or "n" or "north" or "NORTH" to :north 3. using the converted move as a key to look up the exits hash In the context of a larger game, you'd have a $rooms hash, with unique identifiers like "front of building" as location keys. So you'd say if dir if exits[dir] player.move_to(exits[dir]) end end where player.move_to(location) would be defined something like def move_to(location) loc = $rooms[location] if loc self.current_location = loc end end martin