8people
Tue, 24th Jun '08, 6:44pm
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:
Ziad
Tue, 24th Jun '08, 9:19pm
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.
8people
Tue, 24th Jun '08, 9:32pm
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:
Ziad
Tue, 24th Jun '08, 9:41pm
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.
Blackthorne TA
Tue, 24th Jun '08, 10:18pm
-128 actually... There are still 256 numbers represented by 8 bits when interpreting them as 2s complement.