Alexandria 53 Posted March 14, 2014 (edited) Hello guys, I'm moving from rAthena to Hercules. I'm trying to add this custom command to my server but when i recompile it gives this error: <anonymous>’ has no member named This is the command that imtrying to add to src/map/atcommand.c ACMD(dpt){ nullpo_retr(-1, sd); if (!sd->state.pet_no_talk) { sd->state.pet_no_talk = 1; } else { sd->state.pet_no_talk = 0; } sprintf(atcmd_output, "%s pet talk.", (sd->state.pet_no_talk? "Disabled" : "Enabled")); clif_displaymessage(fd, atcmd_output); return 0;} @dpt or @petmute: mutes/unmutes the pet. Thank you. Edited March 14, 2014 by Alexandria Quote Share this post Link to post Share on other sites
0 quesoph 105 Posted May 20, 2014 (edited) atcommand.c ACMD(dpt){ struct pet_data *pd; if(!sd->status.pet_id || !(pd=sd->pd)) { clif->message(fd, msg_txt(184)); return false; } if (!pd->pet_no_talk) { pd->pet_no_talk = 1; } else { pd->pet_no_talk = 0; } sprintf(atcmd_output, "%s pet talk.", (pd->pet_no_talk? "Disabled" : "Enabled")); clif->message(fd, atcmd_output); return 1;} ACMD(pettalk){ char mes[100],temp[100]; struct pet_data *pd;+ if(sd->pd->pet_no_talk) {+ clif->message(fd, "pet muted.");+ return false;+ } if ( battle_config.min_chat_delay ) { if( DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0 ) return true; sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay; } pet.h struct pet_data { struct block_list bl; struct unit_data ud; struct view_data vd; struct s_pet pet; struct status_data status; struct mob_db *db; struct s_pet_db *petDB; int pet_hungry_timer; int target_id;+ int pet_no_talk : 1; struct { unsigned skillbonus : 1; } state; int move_fail_count; int64 next_walktime, last_thinktime; short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex] struct pet_recovery* recovery; struct pet_bonus* bonus; struct pet_skill_attack* a_skill; struct pet_skill_support* s_skill; struct pet_loot* loot; struct map_session_data *msd;}; clif.c /// Notification about a pet's emotion/talk (ZC_PET_ACT)./// 01aa <id>.L <data>.L/// data:/// @see CZ_PET_ACT.void clif_pet_emotion(struct pet_data *pd,int param){ unsigned char buf[16]; nullpo_retv(pd); + if(pd->pet_no_talk)+ return; memset(buf,0,packet_len(0x1aa)); WBUFW(buf,0)=0x1aa; WBUFL(buf,2)=pd->bl.id; if(param >= 100 && pd->petDB->talk_convert_class) { if(pd->petDB->talk_convert_class < 0) return; else if(pd->petDB->talk_convert_class > 0) { // replace mob_id component of talk/act data param -= (pd->pet.class_ - 100)*100; param += (pd->petDB->talk_convert_class - 100)*100; } } WBUFL(buf,6)=param; clif->send(buf,packet_len(0x1aa),&pd->bl,AREA);} Edited May 20, 2014 by quesoph 1 Alexandria reacted to this Quote Share this post Link to post Share on other sites
0 evilpuncker 503 Posted March 14, 2014 seems like the error is not in atcommand.c, can you please post more info about the command code itself? Quote Share this post Link to post Share on other sites
0 hemagx 69 Posted March 15, 2014 if you updated the structs then i can't see any problem in the code but clif_displaymessage it should be changed to clif->message. Quote Share this post Link to post Share on other sites
0 Alexandria 53 Posted March 15, 2014 if you updated the structs then i can't see any problem in the code but clif_displaymessage it should be changed to clif->message. Sorry, what does "if you updated the structs then i can't see any problem in the code" mean? I dont understand, Im so sorry. Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted March 15, 2014 if you updated the structs then i can't see any problem in the code but clif_displaymessage it should be changed to clif->message. Sorry, what does "if you updated the structs then i can't see any problem in the code" mean? I dont understand, Im so sorry. He Just mean, change clif_displaymessage to clif->message Quote Share this post Link to post Share on other sites
0 Dinze 3 Posted March 15, 2014 (edited) Post the full code behind pet no talk. Just like @evilpuncker your problem is not in atcommand.c Edited March 15, 2014 by Hououin Quote Share this post Link to post Share on other sites
0 hemagx 69 Posted March 15, 2014 if you updated the structs then i can't see any problem in the code but clif_displaymessage it should be changed to clif->message. Sorry, what does "if you updated the structs then i can't see any problem in the code" mean? I dont understand, Im so sorry. sorry, i wrote it in sucks way using mobile phone as i see here : if (!sd->state.pet_no_talk) { sd->state.pet_no_talk = 1; } else { sd->state.pet_no_talk = 0; } you have some custom variables added to state struct so make sure you have pet_no_talk in your struct if you don't have it then you should add it. you can find struct code at pc.h also in your code you use clif_displaymessage and you can't call this function anymore after interface updates. so you should call it from the interface. simply change it to. clif->message(fd, atcmd_output); that all. @Dastgir Pojee thank you explain what i meant Quote Share this post Link to post Share on other sites
0 Alexandria 53 Posted March 16, 2014 (edited) But in-game the command gives error ("@dpt failed") and the pet keeps talking, so it doesn't work. Any idea what is going on and how to ffix it ? Thanks. Edited March 16, 2014 by Alexandria Quote Share this post Link to post Share on other sites
0 Dinze 3 Posted March 16, 2014 But in-game the command gives error ("@dpt failed") and the pet keeps talking, so it doesn't work. Any idea what is going on and how to ffix it ? Thanks. change return 0 to return 1 Quote Share this post Link to post Share on other sites
0 Alexandria 53 Posted March 17, 2014 But in-game the command gives error ("@dpt failed") and the pet keeps talking, so it doesn't work. Any idea what is going on and how to ffix it ? Thanks. change return 0 to return 1 Thansk for your help but it didnt work. Any another solution? please. Pet keeps talking anyways Quote Share this post Link to post Share on other sites
0 hemagx 69 Posted March 17, 2014 your code is not enough to make pet muted. so i think you don't have full code. so simple it will not work. Quote Share this post Link to post Share on other sites
0 Alexandria 53 Posted March 18, 2014 your code is not enough to make pet muted. so i think you don't have full code. so simple it will not work. Do you mind if you help me to complete it? please? thanks Quote Share this post Link to post Share on other sites
0 Dinze 3 Posted March 18, 2014 (edited) your code is not enough to make pet muted. so i think you don't have full code. so simple it will not work. Do you mind if you help me to complete it? please? thanks try this one. atcommand.c ACMD(dpt){ struct pet_data *pd; if(!sd->status.pet_id || !(pd=sd->pd)) { clif->message(fd, msg_txt(184)); return false; } if (!pd->pet_no_talk) { pd->pet_no_talk = 1; } else { pd->pet_no_talk = 0; } sprintf(atcmd_output, "%s pet talk.", (pd->pet_no_talk? "Disabled" : "Enabled")); clif->message(fd, atcmd_output); return 1;} pet.h pet_data int pet_no_talk : 1; pet.c clif_pet_emotion after nullpo_retv(pd); if(pd->pet_no_talk) { return; } If you want to mute pet when their master use @pettalk just add this code at ACMD(pettalk) if(pd->pet_no_talk) { return false; } Edited March 22, 2014 by bahbi Quote Share this post Link to post Share on other sites
0 Alexandria 53 Posted May 19, 2014 (edited) I'm sorry for my late answer. @bahbi It didn't give any error when I was recompiling. but it doesn't work, the pet still talks =[ I have done what you said but i'm not sure If i edit the files in the right way. Do you mind if you check it? please Thank you! others.rar Edited May 19, 2014 by Fluffle Puff Quote Share this post Link to post Share on other sites
0 Alexandria 53 Posted May 22, 2014 Thank you so much quesoph! Quote Share this post Link to post Share on other sites
Hello guys,
I'm moving from rAthena to Hercules. I'm trying to add this custom command to my server but when i recompile it gives this error:
This is the command that imtrying to add to src/map/atcommand.c
@dpt or @petmute: mutes/unmutes the pet.
Thank you.
Share this post
Link to post
Share on other sites