Obj.in.room
The obj.in.room command returns TRUE if the specified inventory item's room number is equal to the value of a given variable.
Syntax
obj.in.room(itm iA, var vROOM) obj.in.room("item", var vROOM)
Remarks
Test commands are only valid in an if
statement.
This test returns TRUE if inventory item iA is in the room specified by variable vROOM.
If you want to check if an item's room number is 255 (i.e. the item has been 'picked up' by the player), you can use the has command instead.
This test command can be combined with the NOT
operator to test if an inventory item is NOT in a specified room.
Possible Errors
If inventory item iA is not valid (the number exceeds the total number of inventory items in the OBJECT file), AGI will raise trappable error #23.
Example
<syntaxhighlight lang="agi"> v99 = 25; if(obj.in.room(i12, v99))
{ print("item 12 is in room 25"); }
</syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in all AGI versions. |
Byte-Code Value: | 10 (0x0A hex) |