Variable Size

PunkBuster

New member
Messages
216
Points
0
I made a custom NPC which displays how much zeny players have spent healing, mvping, and questing. I rapidly ran into problems because the shown number didn't change: the variable I had used to store the number has a maximum allowable number.

In scripting, is it possible to create a variable with a larger memory value? Similar to double variables in C?

 
Not AFAIK, but you can do some tricks provided you know what is the max value of your scripting vars (I don't know myself).

// Let's say you keep your spent zeny in the myspentzeny var#MAX_NUM_VALUE = your maximum number value;OnZenySpent:if (myspentzeny + @recently_spent >= #MAX_NUM_VALUE) { myspentzeny2++; myspentzeny = myspentzeny % #MAX_NUM_VALUE;}dispbottom "You've spent a total of " + myspentzeny2 + myspentzeny + " Zeny.";

Perhaps you'll need to saturate #MAX_NUM_VALUE to a value that is all nines so that when you add one you'll make it overflow to 0 but make the carry sum on myspentzeny2.

Edit: you can even use an array that handles it so that you'll save all up on the same variable.

 
Last edited by a moderator:
Back
Top