Put

From AGI Wiki
Revision as of 22:01, 18 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''put''' command sets the room number value for an inventory item. == Syntax == put(itm iA, var vROOMNUM);<br /> put("item", v...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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:

<syntaxhighlight lang="agi"> 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 </syntaxhighlight>

Technical Information

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

See Also

Inventory Item Commands
put.v
get