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
    68 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    10,832
    Level
    30
    vBActivity - Bars
    Lv. Percent
    84.98%
    Daily Activity
    0%
    Weekly Activity
    2.81%
    Monthly Activity
    1.45%
    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
    32
    Posts
    4,435
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,366
    Level
    30
    vBActivity - Bars
    Lv. Percent
    28%
    Daily Activity
    0%
    Weekly Activity
    2.81%
    Monthly Activity
    1.45%
    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
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,266
    Mentioned
    107 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,252
    Level
    20
    vBActivity - Bars
    Lv. Percent
    65.05%
    Daily Activity
    0%
    Weekly Activity
    62.98%
    Monthly Activity
    67.12%
    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.


    Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
    ZScript & ZC-Related Pastebin | Quests and ZScript Repository | ZC Dev & Betas | Latest ZC 2.55 Alpha | YouTube Channel
    All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable..

  4. #14
    The Timelord
    QDB Manager
    ZC Developer
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,266
    Mentioned
    107 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,252
    Level
    20
    vBActivity - Bars
    Lv. Percent
    65.05%
    Daily Activity
    0%
    Weekly Activity
    62.98%
    Monthly Activity
    67.12%
    I'll try to punch this one out tomorrow. It might only go into 2.55.


    Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
    ZScript & ZC-Related Pastebin | Quests and ZScript Repository | ZC Dev & Betas | Latest ZC 2.55 Alpha | YouTube Channel
    All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable..

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