ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: alaskan on May 04, 2014, 05:14:25 PM
-
Hey guys trying to make a healing script for the free shard that I play on. I'm having issues using the last object that was selected by my target prompt. Please help :)
;========Select Bag with bandis=========
display Choose your bag that contains bandages
if #dispres = ok
{
repeat
{
set #targcurs 1
}
until #targcurs = 0
set #ltargetid %container
set #ltargetkind 1
event macro 22 0
finditem ZLF C_ , %container
if #findcnt > 0
{
set #lobjectid #findid
goto mainloop
}
else
if #findcnt < 1
{
display Couldn't find any bandages
halt
}
}
-
Does your shard have
event macro 58 --- Aids self.
I do believe your aids required to be in your main pack. That were I have my.
-
I've tried using event macro 58 and no luck :(. We have backpacks on my shard that can hold a 60k stack of one item so i'm trying to set that container as the container to look in but have it universal for everyone and just not specific to me. We can apply bandages to ourselves even if they're not in our "main" backpack.
-
repeat
{
set #targcurs 1
}
until #targcurs = 0
This Bit Above Won't give you very consistent Results. What you are literally doing is forcing a target cursor 10x a second. So if you click something and it isn't right at the "Until #Targcurs = 0" Then it will just spit out another Cursor.
set #targcurs 1
While #targcurs = 1
wait 1
or
set #targcurs 1
Repeat
wait 1
Until #Targcurs = 1
That will help you with the container portion.
Brackets are also redundant inside of Repeat Untils, but they don't hurt anything for them to be there.
I also don't see you setting %Container in the sub itself.
repeat
{
set #targcurs 1
}
until #targcurs = 0
set #ltargetid %container
set #ltargetkind 1
event macro 22 0
After you get the #Targcurs = 0, you are probably wanting to set the %Container to the #ltargetid
set #targcurs 1
Repeat
wait 1
Until #Targcurs = 1
set %Container #ltargetid
set #ltargetid %container
set #ltargetkind 1
event macro 22 0
wait 20 ;<- A delay so the container can actually open before you check for bandages.
; Plenty of Coders have Subs for waiting for Things to happen like containers opening you can steal that are more reliable
; Than random Delays.
-
Excellent examples of usage for both setting #targcurs and repeats... Very nice. ;)
-
repeat
{
set #targcurs 1
}
until #targcurs = 0
This Bit Above Won't give you very consistent Results. What you are literally doing is forcing a target cursor 10x a second. So if you click something and it isn't right at the "Until #Targcurs = 0" Then it will just spit out another Cursor.
set #targcurs 1
While #targcurs = 1
wait 1
or
set #targcurs 1
Repeat
wait 1
Until #Targcurs = 1
That will help you with the container portion.
Brackets are also redundant inside of Repeat Untils, but they don't hurt anything for them to be there.
I also don't see you setting %Container in the sub itself.
repeat
{
set #targcurs 1
}
until #targcurs = 0
set #ltargetid %container
set #ltargetkind 1
event macro 22 0
After you get the #Targcurs = 0, you are probably wanting to set the %Container to the #ltargetid
set #targcurs 1
Repeat
wait 1
Until #Targcurs = 1
set %Container #ltargetid
set #ltargetid %container
set #ltargetkind 1
event macro 22 0
wait 20 ;<- A delay so the container can actually open before you check for bandages.
; Plenty of Coders have Subs for waiting for Things to happen like containers opening you can steal that are more reliable
; Than random Delays.
Sorry still new to writing for easyuo, i'm still a newbie in training lol. You answered my dilemma and helped me solve the issue of setting the target bag as the variable. The pause after opening the %container makes sense as well. I still have a lot to learn but I'm very grateful for all the helped I've received from everyone on here and who knows maybe one day I can get TM's stamp of approval on a script one day hehe. Well thank you very much good sir :)
-
No problem. that's what we are here for.