michaelsoftman Posted February 6, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 410 Reputation: 29 Joined: 04/04/12 Last Seen: November 28, 2024 Share Posted February 6, 2013 Here's the simplest example I can think of. You do a quest, at the end the NPC sets a variable to 1 instead of 0. In the source code, is there a way to actually check this variable for use in a function? Quote Link to comment Share on other sites More sharing options...
Brian Posted February 6, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted February 6, 2013 Here's how you can read char and account integer variables: pc_readreg(sd, "char_var") pc_readaccountreg(sd, "#account_var") In trunk/src/map/pc.h you can see all the pc_read***** function names int pc_readparam(struct map_session_data*,int); int pc_setparam(struct map_session_data*,int,int); int pc_readreg(struct map_session_data*,int); int pc_setreg(struct map_session_data*,int,int); char *pc_readregstr(struct map_session_data *sd,int reg); int pc_setregstr(struct map_session_data *sd,int reg,const char *str); #define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg,3) #define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val,3) #define pc_readglobalreg_str(sd,reg) pc_readregistry_str(sd,reg,3) #define pc_setglobalreg_str(sd,reg,val) pc_setregistry_str(sd,reg,val,3) #define pc_readaccountreg(sd,reg) pc_readregistry(sd,reg,2) #define pc_setaccountreg(sd,reg,val) pc_setregistry(sd,reg,val,2) #define pc_readaccountregstr(sd,reg) pc_readregistry_str(sd,reg,2) #define pc_setaccountregstr(sd,reg,val) pc_setregistry_str(sd,reg,val,2) #define pc_readaccountreg2(sd,reg) pc_readregistry(sd,reg,1) #define pc_setaccountreg2(sd,reg,val) pc_setregistry(sd,reg,val,1) #define pc_readaccountreg2str(sd,reg) pc_readregistry_str(sd,reg,1) #define pc_setaccountreg2str(sd,reg,val) pc_setregistry_str(sd,reg,val,1) int pc_readregistry(struct map_session_data*,const char*,int); int pc_setregistry(struct map_session_data*,const char*,int,int); char *pc_readregistry_str(struct map_session_data*,const char*,int); int pc_setregistry_str(struct map_session_data*,const char*,const char*,int); Quote Link to comment Share on other sites More sharing options...
michaelsoftman Posted February 6, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 410 Reputation: 29 Joined: 04/04/12 Last Seen: November 28, 2024 Author Share Posted February 6, 2013 Here's how you can read char and account integer variables: pc_readreg(sd, "char_var") I'm a bit unsure on how to use this, because it takes an int value for the 2nd parameter where "char_var" is, so I can't use my actual variable name. If I try using a variable name without the quotes, it says it's unidentified. Quote Link to comment Share on other sites More sharing options...
Brian Posted February 10, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted February 10, 2013 Permanent Char Variables (integer): pc_readreg(sd, add_str("char_var")) Permanent Char Variables (string): pc_readregstr(sd, add_str("char_var$")) Quote Link to comment Share on other sites More sharing options...
Emistry Posted February 10, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: 22 hours ago Share Posted February 10, 2013 try this ? to set... pc_setglobalreg(sd,"char_var", <value>); to read.... pc_readglobalreg(sd, "char_var") Quote Link to comment Share on other sites More sharing options...
Question
michaelsoftman
Here's the simplest example I can think of.
You do a quest, at the end the NPC sets a variable to 1 instead of 0.
In the source code, is there a way to actually check this variable for use in a function?
Link to comment
Share on other sites
4 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.