+ Reply to Thread
Results 1 to 7 of 7

Thread: seta does not work inside another set

  1. #1
    *applev
    Guest

    Scripting: seta does not work inside another set

    Consider:

    Code:
    set _test "vstr _test1"
    set _test1 "echo A; set _test vstr _test2"
    set _test2 "echo B; set _test vstr _test1"
    Now vstr _test yields A, B, A, B,

    But:

    Code:
    set _test "vstr _test1"
    set _test1 "echo A; seta _test vstr _test2"
    set _test2 "echo B; seta _test vstr _test1"
    prints "Usage: seta <variable> <value>".

    Up until now I thought seta is the same as set except it also sets the archive flag. How to fix/work around this bug? I want to make a switch that retains state across matches.
    Last edited by applev; 02-02-2013 at 05:14 AM. Reason: Clarified title

  2. #2
    Senior Member Dr_Mr_Ed will become famous soon enough Dr_Mr_Ed's Avatar
    Join Date
    Oct 2010
    Location
    York, PA
    Posts
    954
    Isn't the purpose of "seta" to make a setting stay permanently (ie, the archive flag you point out)?

    In that case, use inside a vstr redefined like this isn't necessary. There's no reason to make the _test definition last longer, since you're about to overwrite it anyway.

  3. #3
    *applev
    Guest
    Hmm, overwrite with what?

    What I'm trying to get is:
    • exec "vstr _test", it prints A
    • quit game
    • start a new match
    • exec "vstr _test", it prints B

    This would be achieved by saving the new definition of _test (which is set inside _test1) to the config, so that the config contains

    Code:
    seta _test "vstr _test2"
    My understanding is that in order to get the new definition saved, seta has to be used.

  4. #4
    Senior Member Dr_Mr_Ed will become famous soon enough Dr_Mr_Ed's Avatar
    Join Date
    Oct 2010
    Location
    York, PA
    Posts
    954
    Ah, so you're trying to preserve an in-between state of a what I'd call a cyclical vstr between games. So 'seta' would be the thing to use there in theory. However, I don't believe the vstr itself is stored anywhere between games, and has to be defined when the config is loaded again.

    What problem are you trying to solve? Maybe there's a better way. But I don't know of a way to keep user-defined information like a vstr around after quitting and before execing the config again.

  5. #5
    *applev
    Guest
    Actually, I just checked it, and _test is saved to repconfig.cfg with its current value even if set (not seta) is used. So the first version of the code works as intended (of course, the first line has to be commented out).

    Thanks for help

  6. #6
    Senior Member Dr_Mr_Ed will become famous soon enough Dr_Mr_Ed's Avatar
    Join Date
    Oct 2010
    Location
    York, PA
    Posts
    954
    Ah, so it's actually stored - but your config is then overwriting it each time. Interesting.

  7. #7
    Senior Member Lorfa is a jewel in the rough Lorfa is a jewel in the rough Lorfa is a jewel in the rough Lorfa's Avatar
    Join Date
    Aug 2010
    Location
    Kepler-22b
    Posts
    8,763
    It definitely won't work if you are using an autoexec as it clears everything out when you exit the game. Even activeAction isn't saved.

    One of the only cvars that I know of that saves (when autoexec is present) is handicap, but there's no way to test for it. The hud can test for it, so you could do cvartest handicap 99 or 100, but the hud cannot influence the config in any way, so dead end there.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts