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
#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
Code:
/** * 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;}
Last edited by a moderator: