From: Nirav Bhatu Date: 2012-12-28T22:03:32+09:00 Subject: Re: How to run a ruby script Peter Hickman wrote in post #1090473: > Well I took you code and pasted it into a file and went > > $ ruby dungeonapp.rb > > It works for me and should work for you. > > However the is a bug. The class is called Dungeonapp but you then do > this > > my_dungeon = Dungeon.new("Fred Bloggs") > > Use only one name or the other. > > Also I updated the end bit to > > my_dungeon.start(:largecave) > while true > print "go where? " > go_to = STDIN.gets.chomp > my_dungeon.go(go_to) > end > > and had to change this > > def find_room_in_direction(direction) > find_room_in_dungeon(@player.location).connections[direction.to_sym] > end > > Note the to_sym on the end. You cannot type a symbol in interactively so > you need to convert it. > > A good start, keep it up. Thank you for that. but we do ruby dungeonapp.rb to execute the file but how to execute the code out of the file? if you can online i want to chat with you.Thank You -- Posted via http://www.ruby-forum.com/.