User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14

Thread: Script Counters Roll Over to Max Int When Going Below Zero

  1. #11
    Administrator DarkDragon's Avatar
    Join Date
    Oct 2001
    Posts
    6,228
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    11,024
    Level
    31
    vBActivity - Bars
    Lv. Percent
    8.05%
    There are two issues here we should disentagle:
    - preventing scripts from decrementing a counter, if doing so would cause it to wrap around to a positive value;
    - supporting negative values for counters that are currently unsigned.

    Both issues have some merit, but the former is much easier and self-contained than the latter (check in the appropriate ZASM interpreter code before applying a change, vs. go through all places where the game engine uses a counter and make sure nothing breaks badly when the counter is negative.)

    Are any old scripts relying on the counter-wrapping behavior? It seems unlikely, but I might as well ask.

  2. #12
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    37
    Posts
    4,436
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,559
    Level
    30
    vBActivity - Bars
    Lv. Percent
    51.59%
    Quote Originally Posted by DarkDragon View Post
    Are any old scripts relying on the counter-wrapping behavior? It seems unlikely, but I might as well ask.
    Unlikely, but possible. I have used Counters as global variables is the past because, well they are there and I didn't need them for anything else. I have at least once used a counter as a timer of sorts that incremented every frame and expected it to wrap and keep going. We are talking about fixing a non-issue and creating potential issues for any scripts in the last ~10 years that expect a variable to act like a variable.

    I'll ask this plainly this time. Why is the way it is now an issue?

  3. #13
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,759
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.52%
    You know what... i was adding ffrules[] to ZScript. I can just make the behaviour a script-set rule, given that it only affects counters modified by script, and whatever guards we set can be set per counter, or globally.

    Is that sufficient to prevent concerns?

    The same could potentially work for allowing negative counters, and even long counters. We can make counters longs, and artificially roll them at the old values, unless a quest rule 'large counters' is set, and allow negative by quest or script rule. This would emulate the old behaviour for existing quests.

  4. #14
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,759
    Level
    21
    vBActivity - Bars
    Lv. Percent
    68.52%
    I'll try to punch this one out tomorrow. It might only go into 2.55.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social