nwn

The ExecuteScript() NWScript command interrupts the execution of the current script in order to run another one. After the second script finishes, the original script resumes execution. This is an alternative to include files for sharing code among several scripts. An advantage to executing a script instead of calling a function in an included script is that the common code can be changed and compiled once, instead of compiled into each script that uses the common code. (This is the principle that makes spellhooking possible, for example.)

This command allows an easy transfer of execution to another object if so desired (rather than going through AssignCommand()). In fact, this is the only way to transfer execution to another object in the middle of a script. (Something assigned via AssignCommand() is not executed until the current script finishes.)

Definition

void ExecuteScript (string sScript, object oTarget)

string sScript
The name of a compiled script to run.
object oTarget
The object that will run the script (will be OBJECT_SELF within the script).

If either parameter is invalid, nothing happens.