Jump to content
  • 0

Global Variables Maximum? Tipps?


Yuka

Question


  • Group:  Members
  • Topic Count:  100
  • Topics Per Day:  0.03
  • Content Count:  333
  • Reputation:   7
  • Joined:  03/01/14
  • Last Seen:  

Hello,

 

I plan on writing my own achievements script, thus I think I should be careful with the player variables.

Is there a maximum for variables a character can hold?

 

And are there some tipps how I can save variables? I probably can sum some up with bitshifts, right?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

src/common/mmo.h

#define GLOBAL_REG_NUM 256 ///Max permanent character variables per char
#define ACCOUNT_REG_NUM 64 ///Max permanent local account variables per account
#define ACCOUNT_REG2_NUM 16 ///Max permanent global account variables per account
#define MAX_REG_NUM 256 ///Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  100
  • Topics Per Day:  0.03
  • Content Count:  333
  • Reputation:   7
  • Joined:  03/01/14
  • Last Seen:  

 

src/common/mmo.h

#define GLOBAL_REG_NUM 256 ///Max permanent character variables per char
#define ACCOUNT_REG_NUM 64 ///Max permanent local account variables per account
#define ACCOUNT_REG2_NUM 16 ///Max permanent global account variables per account
#define MAX_REG_NUM 256 ///Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)

How high can I increase those without danger? :P

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

I'm not sure, but I think anything below 256..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

See: http://www.eathena.ws/board/index.php?s=&showtopic=181741&view=findpost&p=1478950

In short, if you need a lot of variables, it's far safer to create a new SQL table for the data instead.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Sum up bitshift is easy, but then do you have a plan in mind on how to parse them back to their original value? :P

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  100
  • Topics Per Day:  0.03
  • Content Count:  333
  • Reputation:   7
  • Joined:  03/01/14
  • Last Seen:  

Sum up bitshift is easy, but then do you have a plan in mind on how to parse them back to their original value? :P

 

Well, I have a string like "ooooooooooooooooo" where each position stands for an achievement, when the player achieved that one it will replaced with a "x".

And I have a number like "00 00 00 00" indicating how many rewards of kind 1, 2, 3 and 4 the user got. To get the last two digits I do x%100, for the second two last I do (x%10000)/100 and so on.

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...