Jump to content
  • 0
Sign in to follow this  
AnyThing

setd no longer works with pc_readglobalreg

Question

On pc.h

 

 

#define pc_readglobalreg(sd,reg)         (pc->readregistry((sd),(reg)))#define pc_setglobalreg(sd,reg,val)      (pc->setregistry((sd),(reg),(val)))#define pc_readglobalreg_str(sd,reg)     (pc->readregistry_str((sd),(reg)))#define pc_setglobalreg_str(sd,reg,val)  (pc->setregistry_str((sd),(reg),(val)))#define pc_readaccountreg(sd,reg)        (pc->readregistry((sd),(reg)))#define pc_setaccountreg(sd,reg,val)     (pc->setregistry((sd),(reg),(val)))#define pc_readaccountregstr(sd,reg)     (pc->readregistry_str((sd),(reg)))#define pc_setaccountregstr(sd,reg,val)  (pc->setregistry_str((sd),(reg),(val)))#define pc_readaccountreg2(sd,reg)       (pc->readregistry((sd),(reg)))#define pc_setaccountreg2(sd,reg,val)    (pc->setregistry((sd),(reg),(val)))#define pc_readaccountreg2str(sd,reg)    (pc->readregistry_str((sd),(reg)))#define pc_setaccountreg2str(sd,reg,val) (pc->setregistry_str((sd),(reg),(val))) 

 

 

 

On old system, I can do pc_readglobalreg(sd, "variablename") and the data will be read from global_reg_value sql table.

 

But, ever since Hercules 1st mega update, setd command in npc script is now stored in char_reg_num_db sql table. The problem is now I can't read it anymore in a source by using pc_readglobalreg(sd, "variablename"). It will just return 0.

 

May I know what's the right source command now that can be used to retrieve the data in the source?

 

Ref:

http://herc.ws/board/topic/3886-hercules-1st-2014-megapatch/

http://herc.ws/wiki/PC_Readglobalreg

 

 

/** * Serves the following variable types: * - 'type' (permanent nuneric char reg) * - '#type' (permanent numeric account reg) * - '##type' (permanent numeric account reg2) **/int pc_readregistry(struct map_session_data *sd, int64 reg) {	struct script_reg_num *p = NULL;		if (!sd->vars_ok) {		ShowError("pc_readregistry: Trying to read reg %s before it's been loaded!n", script->get_str(script_getvarid(reg)));		//This really shouldn't happen, so it's possible the data was lost somewhere, we should request it again.		//intif->request_registry(sd,type==3?4:type);		set_eof(sd->fd);		return 0;	}		p = i64db_get(sd->regs.vars, reg);	return p ? p->value : 0;} 

 

Edited by AnyThing

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

My bad, it's now changed to pc_readglobalreg(sd, script->add_str("variable")); instead of pc_readglobalreg(sd, "variable");

 

Case closed.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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