1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Variable Limits

Discussion in 'BG2: Throne of Bhaal (Classic)' started by 8people, Jun 24, 2008.

  1. 8people

    8people 8 is just another way of looking at infinite ★ SPS Account Holder Adored Veteran

    Joined:
    Apr 20, 2002
    Messages:
    7,141
    Media:
    74
    Likes Received:
    133
    Gender:
    Female
    [​IMG] Probably something I should know, but only really just thought about...

    What are the numerical limits that a variable can have as its value? :hmm:
     
  2. Ziad

    Ziad I speak in rebuses Veteran

    Joined:
    Aug 3, 2004
    Messages:
    4,088
    Media:
    57
    Likes Received:
    47
    I'm assuming 255 (well, 256 is you can nil as one of the values), but depending on how it's programmed it could be any power of 255.
     
  3. 8people

    8people 8 is just another way of looking at infinite ★ SPS Account Holder Adored Veteran

    Joined:
    Apr 20, 2002
    Messages:
    7,141
    Media:
    74
    Likes Received:
    133
    Gender:
    Female
    [​IMG] I had presumed 255 then wondered, if it was smaller. If the devs never needed that many values they could easily have limited to four bits instead of eight, or simply set a cap altogether.

    Will have to have a play I guess! :D

    Negative increments in globals could be interesting if they go negative too :lol:
     
  4. Ziad

    Ziad I speak in rebuses Veteran

    Joined:
    Aug 3, 2004
    Messages:
    4,088
    Media:
    57
    Likes Received:
    47
    Actually... don't some of the variables in PST go negative? I seem to remember the variables for Lawful/Chaotic and Good/Evil were at 0 for neutral and could go either way. In the case of such variables the numerical limit at either end would be half of the "normal" variable (so for an 8-bit variable the range could be either 0 to 255 or -127 to +127). I am going by the assumption that they use 8-bit variables but you're right, they don't have to. The variables for gold and experience definitely use more bits, the others could use less.
     
  5. Blackthorne TA

    Blackthorne TA Master in his Own Mind Staff Member ★ SPS Account Holder Adored Veteran Pillars of Eternity SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) New Server Contributor [2012] (for helping Sorcerer's Place lease a new, more powerful server!) Torment: Tides of Numenera SP Immortalizer (for helping immortalize Sorcerer's Place in the game!)

    Joined:
    Oct 19, 2000
    Messages:
    10,416
    Media:
    40
    Likes Received:
    232
    Gender:
    Male
    -128 actually... There are still 256 numbers represented by 8 bits when interpreting them as 2s complement.
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.