Named script

From ZDoom Wiki
Jump to: navigation, search

ZDoom can now support using script names instead of numbers in ACS. So, instead of using

Script 1 (void)
{
   <some instructions>
}

It is possible to use:

Script "My named script" (void)
{
   <some instructions>
}

The main advantage is to prevent script collision. For example, you can use script names containing the name of your mod to make them truly unique. Internally, the script name is converted to a unique negative number.

This requires ACC v1.51 or later for compilation.

Work on named scripts began with r3358, and the bulk of the work ended with r3374, with minor additions and fixes up to r3405.

Console

Just as puke is used to execute numbered scripts, pukename can be used to execute named scripts from the console. If your script name includes spaces, you have to enclose it within quotes, for example:

pukename "healing script"

If you have to enclose the pukename instruction itself within quote (for creating an alias or binding, for example), use escaped quotes:

alias help "pukename \"healing script\""
bind h "pukename \"healing script\""

Action specials

Currently, named script functions are supported for ACS and DECORATE only; they do not exist as action specials. However, with the ZDoom namespace of the Universal Doom Map Format, an alternative is available with the arg0str property.

For UDMF, keep using the old specials (use ACS_Execute instead of ACS_NamedExecute, for example). Go to the Custom tab, and add a new "arg0str" property to the thing or linedef. Type the name of the script there. The script number will be ignored.

Doom Builder 2 note: Do not include quotation marks around the property field arg0str or the name of the script in the value field, as this will cause DB2 to crash.

Forum threads

See also

Script functions
ACS_Execute ACS_NamedExecute
ACS_ExecuteWait ACS_NamedExecuteWait
ACS_ExecuteAlways ACS_NamedExecuteAlways
ACS_ExecuteWithResult ACS_NamedExecuteWithResult
ACS_LockedExecute ACS_NamedLockedExecute
ACS_LockedExecuteDoor ACS_NamedLockedExecuteDoor
ACS_Suspend ACS_NamedSuspend
ACS_Terminate ACS_NamedTerminate
ScriptWait NamedScriptWait
FS_Execute UsePuzzleItem