Difference between revisions of "RemoveMe"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Fella
imported>Dev akm
(section; stability similar to RemoveItem; frame counter delay)
 
(3 intermediate revisions by 3 users not shown)
Line 8: Line 8:




'''Notes:'''
==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 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).  
Line 14: Line 14:
*This function does not display the "xxx has been removed." message.
*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.
*Like [[RemoveItem]], using RemoveMe immediately after the object has been added may cause 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 frame, 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.  
*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.  
Line 20: Line 20:
*This function preserves script variables, health, and charges associated with the item.
*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.
*If there are multiple items of the same type in the same container, the one that actually gets removed may be first one in the container instead of the one that actually called this function. 
 
*Calling this function within blocks like [[onEquip]] and [[onUnequip]] can cause those blocks to loop repeatedly. However, the loop can be circumvented by ensuring that onEquip or onUnequip exits normally on the second pass. See [[Generic Unequip]].


==See Also==  
==See Also==  
Line 30: Line 32:
[[Category: Inventory Functions]]
[[Category: Inventory Functions]]
[[Category: Inventory Functions (CS 1.0)]]
[[Category: Inventory Functions (CS 1.0)]]
<!-- Begin Search Terms
Remove
Me
End Search Terms -->

Latest revision as of 10:26, 29 October 2008

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[edit | edit source]

  • 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.
  • Like RemoveItem, using RemoveMe immediately after the object has been added may cause 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 frame, 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.
  • If there are multiple items of the same type in the same container, the one that actually gets removed may be first one in the container instead of the one that actually called this function.
  • Calling this function within blocks like onEquip and onUnequip can cause those blocks to loop repeatedly. However, the loop can be circumvented by ensuring that onEquip or onUnequip exits normally on the second pass. See Generic Unequip.

See Also[edit | edit source]