Welcome, Guest. Please login or register.
Kingdoms of Ahln
Pages: [1]
  Print  
Author Topic: Checking for the presence of an item class in a player's room.  (Read 429 times)
Saffire
Citizen
***
Posts: 136


View Profile
« on: February 08, 2009, 05:14:45 pm »

How would I go about checking for the presence of an item that belongs to a specific class in the room of the player that is inputting the command? So far I have this:

Code:
shrine = room.inventory.find("class", :Shrine)

But it's not working.
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #1 on: February 08, 2009, 06:51:24 pm »

You will have to use find_all with those arguments, which will return an array of the matching items.

If you only need to know if the room has an item of that type, you can use has_any?.
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #2 on: February 08, 2009, 07:41:01 pm »

Hey it worked.

Who's awesome? You're awesome!  Wink
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2009, Simple Machines
Terra97 design by Bloc