RemoveMe
Revision as of 11:51, 23 January 2008 by imported>Fella
Syntax:
RemoveMe TargetContainerID (optional)
Example:
RemoveMe RemoveMe player
Removes the calling object from the inventory of the container that it is in (if applicable). If TargetContainerID is specified, the object is moved to the target container.
Notes:
- This function acts as a "return" when called -- the lines of script following it will NOT be executed (since it has just destroyed itself in the process of removing itself from inventory).
- This function does not display the "xxx has been removed." message.
- When using RemoveMe right after the object has been added, you might get random crashes. To prevent this wait more than one frame before you remove the item. A counter to 10 that delays the RemoveMe command, increasing one step on every MenuMode or GameMode, should do the trick.
- When RemoveMe can be called inside the barter-menu (e.g. within an OnAdd Block) then the game will crash when the item with the script is stackable, you sell more than one of them and then switch from "sell" to "buy". To prevent this, either wait until the barter-screen closes (Menumode=1009) before removing the item or don't use such a script on stackable non-unique items.
- This function preserves script variables, health, and charges associated with the item.
- Calling this function within blocks like onEquip and onUnequip can cause those blocks to loop repeatedly and is not recommended.