I get this message in a script I use - Out of sequence target cursor
I know what it means - the client is sending back target info when the server didn't request it.
This is a script issue and not the normal macro issue.
I send a yesno gump to the player and immediately the system message area shows the text 'cancelled' which should have happened only if you select NO in the gump. But they player hasn't even selected NO yet. If they select yes or no I get the Out of Sequence target message on the console and the script returns as if I had clicked NO.
The bit that confuses me is that I get the Cancelled message at the same time as the yesno gump puts the question on the screen.
I can't seem to sort this one out, so are there any other tricks to avoiding this error?
The script is part of a freehands function as a casting check. It works fine if the player casts from the spellbook but I get this error when casting from a scroll. I don't expect anyone to look at the scripts, just tell me if you know of any things to look for I may have overlooked.
Out of sequence target cursor
BTW.......
Contrary to popular belief, I discovered the "Real" reason behind that msg from the core when I rewrote targeting in 097 beta 1.
Here is the problem (but 097 will NOT have this problem)...
1.) Character Joe Casts Magic Missle. He waits for something to target.
2.) Character Jack stabs Joe with a pitchfork in the rump.
3.) Character Joe has a script that keeps him healed. So the pitchfork damage makes his script use his bandages.
4.) Core bitches about out of sequence target cursors. Scripts become confused.
The problem is, when the client has an "existing" cursor up, and the core tries to send another, it realizes this and cancels. The problem, it does NOT, I repeat NOT tell the calling script it cancels. It then sets the current "target cursor object" to the CANCELED cursor's object reference. Then, when the client responds, the core says "Wtf? This cursor id does not match the "target cursor object" id set for the character!!!". It then bitches at you, in the console for this poor design.
Do we see the problem?
So, in 097, it does NOT changes the target reference for the character, AND it sends back a struct ERROR{} report to the calling script! YAY!
Contrary to popular belief, I discovered the "Real" reason behind that msg from the core when I rewrote targeting in 097 beta 1.
Here is the problem (but 097 will NOT have this problem)...
1.) Character Joe Casts Magic Missle. He waits for something to target.
2.) Character Jack stabs Joe with a pitchfork in the rump.
3.) Character Joe has a script that keeps him healed. So the pitchfork damage makes his script use his bandages.
4.) Core bitches about out of sequence target cursors. Scripts become confused.
The problem is, when the client has an "existing" cursor up, and the core tries to send another, it realizes this and cancels. The problem, it does NOT, I repeat NOT tell the calling script it cancels. It then sets the current "target cursor object" to the CANCELED cursor's object reference. Then, when the client responds, the core says "Wtf? This cursor id does not match the "target cursor object" id set for the character!!!". It then bitches at you, in the console for this poor design.
Do we see the problem?
So, in 097, it does NOT changes the target reference for the character, AND it sends back a struct ERROR{} report to the calling script! YAY!
Not at all.
In 96.1 and older, there is an EASY way to track this and stop it. However, it requires making your own version of Target() and TargetCoordinates(). In them, check for a "#Targ" cprop before using Target() and TargetCoordinates(). Set that cprop before firing it (if it doesn't have it already, which means it already stopped it). Remove it after the return of them also.
Just means using your custom 2 functions for those two. Not hard really. Yes, a pain in the butt, but worth it imo.
In 96.1 and older, there is an EASY way to track this and stop it. However, it requires making your own version of Target() and TargetCoordinates(). In them, check for a "#Targ" cprop before using Target() and TargetCoordinates(). Set that cprop before firing it (if it doesn't have it already, which means it already stopped it). Remove it after the return of them also.
Just means using your custom 2 functions for those two. Not hard really. Yes, a pain in the butt, but worth it imo.
or if 096, you just packethook targets to keep macros from excessively sending targets and spamming the console (This wont fix the core confusing itself when it sends a target while they have a target up though)
uopacket.cfg
targethook.src
uopacket.cfg
Code: Select all
Packet 0x6C
{
Length 19
ReceiveFunction targethook:recvtarg
SendFunction targethook:sendtarg
}
Packet 0x99
{
Length 26
SendFunction targethook:sendtarg
}
targethook.src
Code: Select all
use uo;
program targethook()
return 1;
endprogram
exported function sendtarg(who, byref packet)
SetObjProperty(who, "#targetcursor", 1);
return 0;
endfunction
exported function recvtarg(who, byref packet)
if (!GetObjProperty(who, "#targetcursor"))
SendSysMessage(who, "Targeting failed. You don't have a target cursor!");
return 1;
endif
EraseObjProperty(who, "#targetcursor");
return 0;
endfunction