Local, Player and Global Flags and Variables

Discussion in 'Modding and Scripting Support' started by dgale, Jan 2, 2002.

Remove all ads!
Support Terra-Arcanum:

GOG.com

PayPal - The safer, easier way to pay online!
  1. dgale

    dgale New Member

    Messages:
    21
    Likes Received:
    0
    Joined:
    Dec 24, 2001
    Is it just me . . . or do scripts only support setting and reading of Global and Local Flags?

    I can't see how to check or set Global, Local, or Player variables or Player flags inside of a script. Inside of a dialog, yes. But not in a script.

    The WorldEd Manual says that you can check any of them from within a script, but I can't seem to get it to work. For example, the manual says this will be used to set and check a global variable:

    0. Global Variable 1 = Global Variable 1 + 5
    1. If Global Variable 1<=5
    THEN goto line 6
    ELSE do nothing

    Which generates an error inside ScriptEd . . . and you can't even get those statements inside of Sock Monkey.


    This is way it seems to work:

    S = Check and set in script
    D = Check and set in dialog

    Code:
    +---------+--------+--------+-------+
    |         | GLOBAL | PLAYER | LOCAL |
    |---------|--------|--------|-------|
    | FLAG    |   S D  |    S   |  S D  | 
    |---------|--------|--------|-------|
    | VARIBLE |    S   |    S   |   S   |
    +---------+--------+--------+-------+
    

    <font size=-1>[ This Message was edited by: dgale on 2002-01-02 12:05 ]</font>
     
  2. Dj_Unique

    Dj_Unique Member

    Messages:
    79
    Likes Received:
    5
    Joined:
    Nov 14, 2001
    I tested that statement ín ScriptEd and it works JUST FINE. :smile:

    Your problem is just that you seem to have
    mistyped the statement.
    if you type it like this:

    0. IF Global Variable 1 <= 1
    THEN goto line 1

    then it compiles, but if you type like you did:


    0. IF Global Variable 1<=1
    THEN goto line 5

    it doesn't, because that causes the parser to look for this opcode: '(num)<=(num)' but since it doesn't exist, it generates an error.

    I hope this helps at least a little bit :smile:
     
  3. DarkUnderlord

    DarkUnderlord Administrator Staff Member

    Messages:
    4,315
    Likes Received:
    5
    Joined:
    Nov 10, 2001
    Yep, Dj's right...

    The action/condition you want is 'if (num) = (num)' (or any of the others). Then you change the first (num) to something like 'Player Flag' and then the 2nd num would be '1' for on (is set).

    With player flags and variables, you do have to mention of which triggerer. Ie, which players' flag are you checking. It's usually 'Flag NUMBER of triggerer' or something like that.

    DarkUnderlord
    ------------------
    Moo... Moo... I'm a Troika cow.
     
  4. dgale

    dgale New Member

    Messages:
    21
    Likes Received:
    0
    Joined:
    Dec 24, 2001
    Thanks!

    Thank you both for getting me back on track!
     
Our Host!