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

 

  Reveal hidden contents

 

pet.h

 

  Reveal hidden contents

 

 

clif.c

 

  Reveal hidden contents

 

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
  On 3/15/2014 at 3:58 AM, LorexOdia said:

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
  On 3/15/2014 at 4:02 AM, Alexandria said:

 

  On 3/15/2014 at 3:58 AM, LorexOdia said:

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
  On 3/15/2014 at 4:02 AM, Alexandria said:

 

  On 3/15/2014 at 3:58 AM, LorexOdia said:

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
  On 3/16/2014 at 7:37 AM, Alexandria said:

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
  On 3/16/2014 at 8:19 AM, Hououin said:

 

  On 3/16/2014 at 7:37 AM, Alexandria said:

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
  On 3/17/2014 at 11:10 PM, LorexOdia said:

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
  On 3/18/2014 at 1:03 AM, Alexandria said:

 

  On 3/17/2014 at 11:10 PM, LorexOdia said:

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.rarFetching info...

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.


×
×
  • Create New...

Important Information

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