Out of sequence target cursor

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Out of sequence target cursor

Post by OldnGrey »

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.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Just running an idea off the top of my head, is this done while the script is critical? If so, you're getting an out of sequence because the script doesnt wait for anything while critical and its probably done and killed before you ever can hit anything on the gump.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

Nope, that was something I checked. No critical(1) statements.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

Well I'll be darned......
My wands run as Run_Script_To_Completion spell scripts.

No wonder I got the error - (in case there is anyone else out there who needs a timely reminder - Run_Script_To_Completion scripts are run critical.)
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post by MuadDib »

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!
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

You are just trying to get me to update to 097 and skip 096 aren't you?
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post by MuadDib »

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.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

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

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
Post Reply