Using Delegates
From QuestWiki
It is easy to create a script attribute to run at a particular point in the game, but what if you want to create a script attribute that returns a value, or accepts particular parameters? It would look a lot like a function. The answer is to use delegates.
First you need to define the delegate, using a delegate XML tag. This accepts the same attributes as the function tag, so you can specify parameters and/or a return value type.
Now you can simply use the delegate name as an attribute type name.
- To run a delegate which does not return a value, use the rundelegate script command.
- To get a return value from a delegate, use the RunDelegateFunction function.
- To see if an object implements a delegate, use the HasDelegateImplementation function.