Put

From AGI Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The put command sets the room number value for an inventory item.

Syntax

put(itm iA, var vROOMNUM);
put("item", var vROOMNUM);

Remarks

The room number for inventory item iA is changed to B, where B = vROOMNUM. If the new room number value is 255, it signifies the item being in the player's 'inventory'; you could use the get command instead.

Changing an inventory item's room number does not actually 'move' the item.

Possible Errors

If the inventory item is not valid (the number exceeds the total number of inventory items in the OBJECT file), AGI will raise trappable error #23.

Example

Code:
v100 = 30;
put("dagger", v100); [ the dagger's room number is now 30
v100 = 255;
put("dagger", v100); [ now the dagger is in player's 'inventory'
get("dagger"); [ simpler way to set room number to 255

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 95 (0x5F hex)

See Also

Inventory Item Commands
put.v
get