The Dink Network

variables

July 29th 2003, 12:48 PM
duck.gif
I've always wondered, if you make a variable like &story, how much can the value of it max be?
is it 9 or... much higher?
July 29th 2003, 01:18 PM
peasantmb.gif
I dunno, but I think the limit is 1000.
July 29th 2003, 02:27 PM
duck.gif
Cool,
Thanks
July 29th 2003, 03:09 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Variables can be set to any integer between -2,147,483,647 and 2,147,483,648. So unless you're doing something really bizarre, you won't have to worry about a variable having a value that is too high (or too low).
July 29th 2003, 04:23 PM
custom_odd.gif
woah, did you pull that number out of your ass, or is that real?
July 30th 2003, 03:10 AM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
That's real.
July 30th 2003, 06:14 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I pulled it out of the DinkC Reference v3.1.

Anyway, its quite easy to verify. The save game format sets aside 4 bytes for the value of each variable. Each byte can hold up to 16 values. So 4^16 is 4,294,967,296, the total number of unique values each variable can hold. However, when you think of negative numbers and 0 (by dividing 4,294,967,296 by two for positive/negative, and subtracting one of the halves by 1 for the zero) then you get the numbers that I posted earlier.
July 30th 2003, 06:28 AM
custom_fish.png
SabreTrout
Noble He/Him United Kingdom
Tigertigertiger. 
How come my brain just withered up and...CLUNK
July 30th 2003, 08:25 PM
custom_odd.gif
That is really cool.

I always assumed that it was 9 didgets(and had it verified in my mind by the supervar you did) I guess I could probably use that somehow to make a.. super duper var?

Probably not, and probably won't be necesary with the engine being tweaked to use supervars at all
August 11th 2003, 07:39 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
And now for a really newbie-ish question: "What is a supervar". I read things about it in different posts, but I still don't know what they are. I'm probably already using it without knowing that they're called that way, but still... WHAT are supervariables.
August 11th 2003, 10:24 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Check out the SuperVar Source, and Dink's Trunk which has a much better implementation. Basically, it is treating a single variable like this:

&inventory = 1246784;

As multiple variables like this:

&bombs = 2;
&heals = 4;
&manas = 6;
&swords = 7;
&axes = 8;
&boomerangs = 4;

Thanks to Division and Multiplication.
August 13th 2003, 05:16 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Ah, thank you! I used this system already in some QBasic programs I wrote, but it's cool that it's possible in Dink.