Eross Posted October 8, 2021 Group: Members Topic Count: 155 Topics Per Day: 0.11 Content Count: 349 Reputation: 12 Joined: 04/05/20 Last Seen: April 19, 2023 Share Posted October 8, 2021 Hi ! can anyone help me to revise this to become latest RA compatible ? BUILDIN_FUNC(gethotkeys) { TBL_PC *sd; TBL_PC *tsd; int i; if( !script_rid2sd(sd) ) return SCRIPT_CMD_FAILURE; if (!script_charid2sd(2,tsd)) return SCRIPT_CMD_FAILURE; for(i=0;i<MAX_HOTKEYS;i++){ pc_setreg(sd,reference_uid(add_str("@hotkey_type"), i),tsd->status.hotkeys[i].type); pc_setreg(sd,reference_uid(add_str("@hotkey_id"), i),tsd->status.hotkeys[i].id); pc_setreg(sd,reference_uid(add_str("@hotkey_lv"), i),tsd->status.hotkeys[i].lv); pc_setreg(sd,reference_uid(add_str("@hotkey_pos"), i),i); } pc_setreg(sd,add_str("@hotkey_count"),i); return SCRIPT_CMD_SUCCESS; } BUILDIN_FUNC(updatehotkey) { TBL_PC *sd; int type,id,lv,pos,j, flag = 0; short i; struct script_data *data; if (!script_charid2sd(7,sd)) return SCRIPT_CMD_FAILURE; type = script_getnum(st,2); if(type < 0 || type > 1){ clif_displaymessage(sd->fd, "Update Hotkey failed. Invalid type."); return SCRIPT_CMD_FAILURE; } data = script_getdata(st, 3); get_val(st, data); // Convert into value in case of a variable id = ( data_isstring(data) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) ); lv = script_getnum(st,4); pos = script_getnum(st,5); if(pos < 0 || pos >= MAX_HOTKEYS){ clif_displaymessage(sd->fd, "Update Hotkey failed. Invalid hotkey position."); return SCRIPT_CMD_FAILURE; } if( script_hasdata(st,6) ) flag = script_getnum(st,6); if(type == 0 && id > 0){ // item ARR_FIND(0, MAX_INVENTORY, i, sd->inventory.u.items_inventory[i].nameid == id); if(i<MAX_INVENTORY){ if(sd->inventory.u.items_inventory[i].amount != lv) lv = sd->inventory.u.items_inventory[i].amount; } else lv = 0; } else if(type == 1 && id > 0){ // skill j = pc_checkskill(sd,id); if(j < lv) lv = j; } if(flag == 1){ // Delete duplicate on same row i = 0; if(pos >= 0 && pos <= 8){ ARR_FIND(0, 9, i, sd->status.hotkeys[i].type == type && sd->status.hotkeys[i].id == id && sd->status.hotkeys[i].lv == lv); if(i < 9){ sd->status.hotkeys[i].type = 0; sd->status.hotkeys[i].id = 0; sd->status.hotkeys[i].lv = 0; } } else if(pos >= 9 && pos <= 17){ ARR_FIND(9, 18, i, sd->status.hotkeys[i].type == type && sd->status.hotkeys[i].id == id && sd->status.hotkeys[i].lv == lv); if(i < 18){ sd->status.hotkeys[i].type = 0; sd->status.hotkeys[i].id = 0; sd->status.hotkeys[i].lv = 0; } } else if(pos >= 18 && pos <= 26){ ARR_FIND(18, 27, i, sd->status.hotkeys[i].type == type && sd->status.hotkeys[i].id == id && sd->status.hotkeys[i].lv == lv); if(i < 27){ sd->status.hotkeys[i].type = 0; sd->status.hotkeys[i].id = 0; sd->status.hotkeys[i].lv = 0; } } #if PACKETVER >= 20090603 else if(pos >= 27 && pos <= 35){ ARR_FIND(27, 36, i, sd->status.hotkeys[i].type == type && sd->status.hotkeys[i].id == id && sd->status.hotkeys[i].lv == lv); if(i < 36){ sd->status.hotkeys[i].type = 0; sd->status.hotkeys[i].id = 0; sd->status.hotkeys[i].lv = 0; } } #endif #if PACKETVER >= 20090617 else if(pos >= 36 && pos < MAX_HOTKEYS){ ARR_FIND(36, MAX_HOTKEYS, i, sd->status.hotkeys[i].type == type && sd->status.hotkeys[i].id == id && sd->status.hotkeys[i].lv == lv); if(i < MAX_HOTKEYS){ sd->status.hotkeys[i].type = 0; sd->status.hotkeys[i].id = 0; sd->status.hotkeys[i].lv = 0; } } #endif } else if(flag == 2){ // Delete duplicate on all rows for(i = 0; i < MAX_HOTKEYS; i++){ if(sd->status.hotkeys[i].type == type && sd->status.hotkeys[i].id == id && sd->status.hotkeys[i].lv == lv){ sd->status.hotkeys[i].type = 0; sd->status.hotkeys[i].id = 0; sd->status.hotkeys[i].lv = 0; } } } sd->status.hotkeys[pos].type = type; sd->status.hotkeys[pos].id = id; sd->status.hotkeys[pos].lv = lv; clif_hotkeys_send(sd); return SCRIPT_CMD_SUCCESS; } BUILDIN_FUNC(clearhotkeys) { TBL_PC *sd; int i; if (!script_charid2sd(2,sd)) return SCRIPT_CMD_FAILURE; for(i=0;i<MAX_HOTKEYS;i++){ sd->status.hotkeys[i].type = 0; sd->status.hotkeys[i].id = 0; sd->status.hotkeys[i].lv = 0; } clif_hotkeys_send(sd); return SCRIPT_CMD_SUCCESS; } Im getting this error Quote Link to comment Share on other sites More sharing options...
Question
Eross
Hi ! can anyone help me to revise this to become latest RA compatible ?
Im getting this error
Link to comment
Share on other sites
0 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.