Jump to content
  • 0
Sign in to follow this  
PunkBuster

Variable Size

Question

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?

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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.

Edited by jaBote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.