cmd_get.rb
snippets · 407 B · 2010-03-30
cmd_get.rb: a get command for a Ruby MUD.
Download « Back to the snippets list
module Cmd
# gets a specific object from the room you are in.
def cmd_get(args)
found_object = false
get_object(location).objects.each do |obj|
if (obj.name.is_match?(args) || args.is_prefix?(obj.name))
found_object = true
add_event(id,obj.id,:get)
break
end
end
if !found_object
sendto "You cannot find that object."
end
end
end