ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Noobie on March 30, 2011, 02:28:35 PM
-
Can someone help me understand what would cause this code to fail sometimes?
sub recallhome
finditem %home_book C_ , #BACKPACKID
wait 20
set #LTARGETID #findid
event macro 15 31
wait 1s
target 3s
event macro 22 0
-
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.
-
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?
-
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.
-
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 ...)
-
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.
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!