ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Paulonius on October 13, 2009, 11:52:52 AM

Title: Target Cursor Detection
Post by: Paulonius on October 13, 2009, 11:52:52 AM
Is there a way to detect the presence of a target cursor?

I would like to put together a target cursor check/wait sub to replace standard wait intervals before selecting a target and I need a way to know whether I have a target cursor or not.  I have been reading up on it and I can't find anything on point.

Any help greatly appreciated!

-P
Title: Re: Target Cursor Detection
Post by: _C2_ on October 13, 2009, 11:57:51 AM
#targetcurskind  or something close to that tells what kind of cursor.
Title: Re: Target Cursor Detection
Post by: Cerveza on October 13, 2009, 12:04:26 PM
if #targCurs = 1 ; active
if #targCurs = 0 ; inactive
Value     Description
0    Cursor is a normal cursor.
1    Cursor is a target cursor.

#cursKind tells you where you are.
Value     Description
0    Felucca
1    Trammel
2    Ilshenar
3    Malas
4    Tokuno

Code: [Select]
if #targCurs = 0 ; NOT a target cursor, so you can cast your spell
{
event macro 15 28
while #targCurse = 0 ; wait for target cursor to become a 1 or active
  wait 0
event macro 23 0 ; target self
wait 10 ; or whatever your cast recovery is
}
Title: Re: Target Cursor Detection
Post by: Paulonius on October 13, 2009, 12:07:26 PM
Awesome, thanks for pointing that guys.  Now I don't have to use a wait 10 or some such.   I appreciate it.
Title: Re: Target Cursor Detection
Post by: Cerveza on October 13, 2009, 12:10:37 PM
Also, you can use

Code: [Select]
; This will pause the script until either the target cursor is displayed,
; or 3 seconds passes.
; Set the timout just over what you expect the delay to take, otherwise
; you may miss the target cursor and cause errors in your script.
target 3s

Which is what most people use.

All is in the docs over at easyuo ;)
Title: Re: Target Cursor Detection
Post by: Paulonius on October 13, 2009, 12:26:29 PM
Thanks guys. I am going to try using the following instead of the wait 10 after I hit something that should bring up a target cursor:

set %targetcursorwait 1

          gosub WaitForTargetCursor
          if ! #result
             {
             display -Target Cursor did not come up. [Bring up related cursor] and hit play
             pause
             }

;================== Wait for Target Cursor Sub======================

sub WaitForTargetCursor

set %timeout #scnt + 30

Repeat
      wait %targetcursorwait
      if #scnt > %timeout
         return #false
Until #TARGCURS = 1

return #true
Title: Re: Target Cursor Detection
Post by: _C2_ on October 13, 2009, 04:01:39 PM
thank you cerv!  I was at work and still am.  I could not look in the variables to see it.