Originally posted by [b]Mastermind[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3150
Have one problem with a script like this:
CODE
- script Test -1,{
OnWhisperGlobal:
Set(.@CharAcc,GetCharID(3,@whispervar0$)); // Get character's acc
If (IsLoggedIn(.@CharAcc)) AttachRID(.@CharAcc); Else End; // Attach him
Mes("Hello. Input something,please."); // Attached character sees this message
Input(.@Str$); // The character sees an inputbox and enters some text into it.
Mes("Thanks. Bye."); // After entering something into the inputbox, the character's dialog freezes without this text and a Close button displayed....
Close;
}
...instead of it the map-server shows debug message like
npc_scriptcont: 'Unknown NPC' (sd->npc_id=0) is not Test (id=REAL_NPC_ID)After parsing the inputbox text the
clif_parse_NpcStringInput function continues the script, which the attached character has (there's a correct npc_id in
RFIFOL(fd,4)). This debug message appears from
npc_scriptcont function, if our character's sd->npc_id = 0, but he has a script running. It's zero, because the attached character's sd didn't get npc_id assigned ever before (it's done only in the
run_script_main function), this npc_id is assigned to our first character, who invoked the
Test::OnWhisperGlobal. This is how I understand this matter.
How then should this
npc_id be assigned to correct this situation? Maybe the old one sd->npc_id should be zeroed on attach/detach RID and a newly attached sd's npc_id should be assigned to our NPC ID? So only the last attached sd will have our NPC's ID, and not the first or the old ones.
This post has been edited by Maistermind: Jun 5 2009, 11:52 AM