From ZDoom Wiki
Jump to: navigation, search

ScriptCall (str classname, str funcname, args)


Executes a script-defined function. If the first argument of the function to execute is of type Actor, the activator of the script is passed and is stored in that argument. This allows the activator to be accessed by said function.


  • classname: the name of the actor class in which the function is defined.
  • funcname: the name of the function to execute. Only static functions are executable.
  • args: the arguments, if any, to pass to the specified function. The types of arguments the function could have are int, bool, double, string, name, color and sound. double is passed as a fixed-point value, color as a hexadecimal value (Verification needed), and name and sound as strings.

Return value

The value the executed function returns. The value's type is the same as the passed arguments' types, in addition to void.


This script gives the player a unique TID. This is achieved by executing FindUniqueTid, which is defined in Actor.

script "SetPlayerTID" ENTER
    // Only if the player does not already have a TID.
    if(ActivatorTID() == 0)
        int ptid = ScriptCall("Actor", "FindUniqueTid", 0, 0);
        Thing_ChangeTID(0, ptid);
        Log(s:"TID changed to ", d:ptid); // Print a message.

Note that ACS already has a function which can get a unique TID. The above example is for educational purposes.

If executed, this GivePresent function gives the activator of the script an item and logs a message. The item is specified by the present argument.

// In ZScript:
class ExampleActor : Actor
    static void GivePresent (Actor activator, string present)
        // Only players get the item.
        if(activator && activator.player)
            activator.A_Log("You received a wonderful present!", true);

// In ACS:
script "GetGift" (void)
    ScriptCall("ExampleActor", "GivePresent", "Soulsphere");