ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Noobie on March 30, 2011, 02:28:35 PM

Title: A little help needed
Post by: Noobie on March 30, 2011, 02:28:35 PM
Can someone help me understand what would cause this code to fail sometimes?


Code: [Select]
sub recallhome
finditem %home_book C_ , #BACKPACKID
wait 20
set #LTARGETID #findid
event macro 15 31
wait 1s
target 3s
event macro 22 0
Title: Re: A little help needed
Post by: Paulonius on March 30, 2011, 02:38:15 PM
As I read it you are attempting to recall off of your rune book, but you don't have any mechanism to wait until you have the spell cast.  I would build in a wait that resolves when you have a target cursor up.

I don't believe that you need the wait after the finditem.
Title: Re: A little help needed
Post by: Noobie on March 30, 2011, 02:42:45 PM
I was under the impression that the

target 3s

would wait until the courser was up or time out ( 3s here) then target.
Is that not very reliable?
Title: Re: A little help needed
Post by: Paulonius on March 30, 2011, 02:59:43 PM
I spewed ignorance in my previous post. Its late in the day I guess.  That should work, but I don't use it, so I was not as familiar with it.  Maybe you have a slow caster that is taking more than 3S to cast recall and is missing the window.  That would cause a failure.  

You might use the #targcurs value under "Extended Info" in the EUO window as an alternative, but its not as pretty as your code.  This would still fail if your toon takes longer than 3s to cast

Set #TargCurs 0
Set #CastTimeout #Scnt + 3
Event macro 15 31
Repeat
Wait 1
Until #TargCurs = 1 || #CastTimeout <= #Scnt

If we knew what the absolute longest you can take to cast recall is you might use that instead of 3

Presumably the target command is based on the #targcurs value and it should be just as reliable. 


Title: Re: A little help needed
Post by: Endless Night on March 30, 2011, 08:12:30 PM
set #ltargetkind  1    

1 is probably the right value without looking it up...   (But you should probably check the wiki for what this command does ...)
Title: Re: A little help needed
Post by: Scrripty on March 30, 2011, 10:52:04 PM
set #ltargetkind  1    

1 is probably the right value without looking it up...   (But you should probably check the wiki for what this command does ...)

1 is correct for objects.  Paul's way allows for more error checking.  This is just another way to do it.  After doing it this way, you can check for a change of physical location after a certain amount of time, plus the journal for spell fizzling, or failing to cast or whatever, then loop back around and recast if you fail or timeout also.

Code: [Select]
sub recallhome
finditem %home_book C_ , #BACKPACKID
if #findcnt > 0
{
  event macro 15 31
  target 3s
  set #LTARGETID #findid
  set #ltargetkind 1
  event macro 22 0
}
else
  display ok YOU HAVE NO BOOK! Set the var!