StrParam

From ZDoom Wiki
Jump to: navigation, search

int StrParam(item(s));

Usage

StrParam will create a new string formatted based upon the same method for print or log. This string will only exist for 1 tic, so a delay will nullify it.

Return Value

The return value is the string table index of the new string.

Example

str mapname = "hangar";

script 3 enter
{
// you can also assign it to a variable,
// but its contents are only valid until this tick ends.
    int keyObject = strparam(s:mapname, s:"key"); // would create "hangarkey"
    if (CheckInventory(keyObject))
    {
        TakeInventory(keyObject, 1);
    }
    else
    {
        print(s:"You require ", s:keyObject);
        terminate; // after ending the script, you cannot expect the value in keyObject to point to a valid string anymore
    }
    ACS_Execute(120,0,10);
    // ACS_Execute will not execute code during this tick.
    // keyObject will not exist anymore when it starts running script 120.

    delay(1); // now a tick will pass. any dynamic strings generated before this delay will be invalid once execution resumes.
    /*
        no keyObject here
    */
}
Personal tools
Namespaces

Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox