Jump to content
  • 0
Alexandria

@dpt command

Question

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 by Alexandria

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 0

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 by quesoph

Share this post


Link to post
Share on other sites
  • 0

seems like the error is not in atcommand.c, can you please post more info about the command code itself?

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

 

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

Share this post


Link to post
Share on other sites
  • 0

Post the full code behind pet no talk. Just like @evilpuncker your problem is not in atcommand.c 

Edited by Hououin

Share this post


Link to post
Share on other sites
  • 0

 

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 :)

Share this post


Link to post
Share on other sites
  • 0

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.

post-1035-0-21627500-1394955450_thumb.jpg

Edited by Alexandria

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

 

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

Share this post


Link to post
Share on other sites
  • 0

your code is not enough to make pet muted.

so i think you don't have full code. so simple it will not work.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

 

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 by bahbi

Share this post


Link to post
Share on other sites
  • 0

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 by Fluffle Puff

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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