ShowOff:OnAdd

From GECK
Jump to: navigation, search

An event handler added by the ShowOff NVSE Plugin version 1.60.

Description

This event runs when an item is added to any reference's inventory. It runs for AddItem-style functions, transferring items from inventories, and picking up items in the game world.

This event runs slightly after the OnAdd event/blocktype, but not even by a frame. It runs before the item being added is fully transferred.

Dispatched Args

The calling reference will either be the in-game reference that was picked up, or 0 if it's added from an inventory or an AddItem-style function.

The args dispatched to handlers are:

  1. BaseForm: the added item's baseForm.
  2. Reference: the new owning container reference.

Syntax

Use SetEventHandler / SetEventHandlerAlt with the event name "ShowOff:OnAdd".

Handler Script

A skeleton handler script for this event:

scn TestOnAdd

begin Function { ref rBaseItem, ref rNewOwner }

    print "TestOnAdd >> RAN!"

    printvar rBaseItem
    printvar rNewOwner

    ref rWorldItem = GetSelfAlt ; May be null if a world item wasn't picked up
    printvar rWorldItem

    ref rItemRef = GetAddedItemRefShowOff  ; Contains either a world item ref, or an InventoryRef
    ; To tell if it's an inventory ref or not, either use IsInventoryRef, or check if rWorldItem is null.
    printvar rItemRef 
    int iCount = rItemRef.GetRefCount
    printvar iCount
    
end

Example

SetEventHandlerAlt "ShowOff:OnAdd" TestOnAdd

See Also