Issue information

Issue ID
#5343
Status
Fixed
Severity
Fair
Started
Hercules Elf Bot
Feb 17, 2012 17:46
Last Post
Ind
Feb 1, 2013 14:08
Confirmation
Yes (2)
No (0)

Hercules Elf Bot - Feb 17, 2012 17:46

Originally posted by [b]EvilPuncker[/b]
[color=#ff0000][Error][/color]: delete_timer error : function mismatch 005387FD(npc_timerevent) != 00538203(unknown timer function)

it happens when using:

#define SECURE_NPCTIMEOUT 60

#define SECURE_NPCTIMEOUT_INTERVAL 1


after talking with any NPC

Hercules Elf Bot - Feb 17, 2012 18:03

Originally posted by [b]Ind[/b]
Fixed in [rev=15598]

Hercules Elf Bot - Feb 18, 2012 2:57

Originally posted by [b]Napster[/b]
found bug when npc use script command input

mes "test input";
next; <---- INVALID_TIMER close;
input .@num;

if npc idle timer INVALID_TIMER

variable input save on player

[b]click this npc again show debug in server & dialog npc notrespond[/b]

[quote][DEBUG]: script: menu: script:menu: unexpected selection (0)[/quote]

This post has been edited by Napster on Feb 18, 2012 9:05

Hercules Elf Bot - Feb 18, 2012 10:24

Originally posted by [b]Wildcard[/b]
I can confirm the behavior described above. This is the script I needed to get both to work.

[code]
mes "a";
menu "a:b",-;
mes "a";
next;
// let the timeout occur here while waiting for input, then close the input box and talk to the npc again for a total of 3 debug messages
input .@num;
mes "a";
close;
[/code]

I have quick fixes for both, but it somehow feels to me like this whole "abort script" shebang should be properly encapsulated in a npc_ function, since it is done in more than one place and has a couple nontrivial cleanup to do, as can be seen in clif_parse_LoadEndAck:

[code]
// abort currently running script
sd->state.using_fake_npc = 0;
sd->state.menu_or_input = 0;
sd->npc_menu = 0;

if(sd->npc_id)
npc_event_dequeue(sd);
[/code]

Hercules Elf Bot - Mar 22, 2012 12:42

Originally posted by [b]Epoque[/b]
I believe a particular 'abort' code needs implementing to signal that the player's NPC code was terminated through the time-out feature. For instance, if the time-out occurs then the player's npc_id is reset to 0, and all instances of the script are destroyed. However, if the player then continues to type something into an input; command, the script engine doesn't perform any checks for a 'time-out terminated' clause, and will throw errors/debug messages.

[b]clif.c:clif_parse_NpcAmountInput[/b]
[code]int npcid = RFIFOL(fd,2);
int amount = (int)RFIFOL(fd,6);

sd->npc_amount = amount;
npc_scriptcont(sd, npcid);[/code]

[b]npc.c:npc_scriptcont[/b]
[code]if( id != sd->npc_id ){
TBL_NPC* nd_sd=(TBL_NPC*)map_id2bl(sd->npc_id);
TBL_NPC* nd=(TBL_NPC*)map_id2bl(id);
ShowDebug("npc_scriptcont: %s (sd->npc_id=%d) is not %s (id=%d).\n",
nd_sd?(char*)nd_sd->name:"'Unknown NPC'", (int)sd->npc_id,
nd?(char*)nd->name:"'Unknown NPC'", (int)id);
return 1;
}[/code]

We need some sort of signal flag or something to prevent this from occurring.

Hercules Elf Bot - Apr 18, 2012 4:27

Originally posted by [b]EvilPuncker[/b]
Any news on this, guys? btw seems like i'm the only one using that setting atm :P but since it is an official behavior it should be looked into still xd


@new issue

cutins doesn't disappear too!

This post has been edited by EvilPuncker on May 11, 2012 0:06

Hercules Elf Bot - Jun 1, 2012 13:58

Originally posted by [b]Ind[/b]
the client doesn't sign that the player closed the stuff its hard to tell .-.

Hercules Elf Bot - Nov 23, 2012 5:49

Originally posted by [b]Napster[/b]
Bump!

this problem can fix ?

[url="http://trac.rathena.org/changeset/16949/rathena"]http://trac.rathena.org/changeset/16949/rathena[/url]

Hercules Elf Bot - Dec 12, 2012 2:55

Originally posted by [b]EvilPuncker[/b]
bump't'bump

we should remove this feature them if it no one is able to fix :(

Ind - Feb 1, 2013 14:08

Thanks to malufett's suggestion I thought of something I think fixes this once and for all[quote name="malufett" timestamp="1359695950"]

[quote]
we dont seem able to figure the way the client tells the server when a npc is closed.[/quote]maybe this is how it works[code=auto:0]click npc - timer starts mes something...timer is now running next -> restart timer mes something...timer is now running <timer timeout> close <- issued next -> no more[/code]so maybe 'next' just restart the timer and no more checking if it was close or not.just terminate timer and upon termination check if the player is still dealing with the npc then thats the time we issue 'close' command...

:meow:

[/quote]Fixed in [url="https://github.com/HerculesWS/Hercules/commit/7192b105201499e30a50c061e7ab2005c97d3714"]https://github.com/HerculesWS/Hercules/commit/7192b105201499e30a50c061e7ab2005c97d3714[/url]