%scriptAttach()

Aliases%scriptAttach( )
Parametersentity @target, string @targetLabel, mixed @sourceType, mixed @sourceEntity, string @sourceLabel

    Attaches a script defined for the @sourceEntity having @sourceLabel to the
@target entity with label @targetLabel.

Example:

%scriptAttach( @item, "illusion_dispelHandler", "item", 90054, "catchDispel" )

In the above example we attach the script defined for item 90054 and having
the label "catchDispel" to the target @item and assign it the label
"illusion_dispelHandler". If @sourceEntity is a pointer instead of an ID
then the @sourceType parameter can be set to null.

This example is based on the actual use case for the illusion spell which
attaches the catchDispel trigger so that it can catch dispel attempts and
appropriately remove the illusion.

Attached scripts can be removed using a combination of %scriptGetAttached()
and %purge() on the returned value.