Yuka Posted March 26, 2014 Group: Members Topic Count: 100 Topics Per Day: 0.02 Content Count: 333 Reputation: 7 Joined: 03/01/14 Last Seen: May 6, 2020 Share Posted March 26, 2014 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? Quote Link to comment Share on other sites More sharing options...
sandbox Posted March 27, 2014 Group: Members Topic Count: 38 Topics Per Day: 0.01 Content Count: 949 Reputation: 174 Joined: 06/12/12 Last Seen: Friday at 12:25 PM Share Posted March 27, 2014 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) Quote Link to comment Share on other sites More sharing options...
Yuka Posted March 27, 2014 Group: Members Topic Count: 100 Topics Per Day: 0.02 Content Count: 333 Reputation: 7 Joined: 03/01/14 Last Seen: May 6, 2020 Author Share Posted March 27, 2014 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? Quote Link to comment Share on other sites More sharing options...
sandbox Posted March 27, 2014 Group: Members Topic Count: 38 Topics Per Day: 0.01 Content Count: 949 Reputation: 174 Joined: 06/12/12 Last Seen: Friday at 12:25 PM Share Posted March 27, 2014 I'm not sure, but I think anything below 256.. Quote Link to comment Share on other sites More sharing options...
Euphy Posted March 27, 2014 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted March 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
nanakiwurtz Posted March 27, 2014 Group: Members Topic Count: 81 Topics Per Day: 0.02 Content Count: 1654 Reputation: 583 Joined: 08/09/12 Last Seen: January 14, 2020 Share Posted March 27, 2014 Sum up bitshift is easy, but then do you have a plan in mind on how to parse them back to their original value? Quote Link to comment Share on other sites More sharing options...
Yuka Posted March 27, 2014 Group: Members Topic Count: 100 Topics Per Day: 0.02 Content Count: 333 Reputation: 7 Joined: 03/01/14 Last Seen: May 6, 2020 Author Share Posted March 27, 2014 Sum up bitshift is easy, but then do you have a plan in mind on how to parse them back to their original value? 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. Quote Link to comment Share on other sites More sharing options...
Question
Yuka
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.