Yuka Posted March 26, 2014 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
sandbox Posted March 27, 2014 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
Yuka Posted March 27, 2014 Author 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
sandbox Posted March 27, 2014 Posted March 27, 2014 I'm not sure, but I think anything below 256.. Quote
Euphy Posted March 27, 2014 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
nanakiwurtz Posted March 27, 2014 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
Yuka Posted March 27, 2014 Author 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
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?
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.