ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: declo on October 07, 2016, 10:00:46 AM
-
Sometimes it loots... sometimes it does not.... What have am I missing?
Trying to get this sub to work all the time rather than 50/50ish. Would love any input!
sub lootrock
finditem YFM G_2
if #finditem = -1
return
wait 20
set #lobjectid #findid
wait 20
set %lootContainer #findid
wait 20
event macro 17 0
gosub wfcontainer container_gump 144_212
if ! #result
{
ignoreitem %dead
goto start
}
wait 10
if #contsize <> 144_212
{
ignoreitem %dead
goto start
}
wait 60
finditem POF C_ , %lootContainer
exevent drag #findid #findstack
wait 20
exevent DropC #backpackid
wait 12
hideitem %lootContainer
wait 12
return
;===============================
;Waiting for Container to open
;===============================
sub wfcontainer
set %waittime 120
set %wfgump #sCnt2 + %waittime
gosub wfopen contname %1 contsize %2
return #result
sub wfopen
wfo:
if # . %1 = %2 && # . %3 = %4
return #true
if %wfgump < #scnt2
return #false
goto wfo
-
Could be timing that it is not seeing the item in the container after it opens. It could also be that there is more than one Item Type for the item. Not sure what items you are looting.
One way to do it is to add it messages as it goes through the loot process that tells you what it did or did not do. Takes a bit more logic to add, but it can really help debug when it comes to looting problems.
-
Where would be the best location to adjust the timing if it's not seeing the gold? Placing a wait after the finditem and before the exevent drag?
-
First question that come to mind is why do you use goto start to exit a Sub routine.
if #contsize <> 144_212 ; can I assume that the size of the corpse
You can try this to loot gold
sub lootrock
finditem YFM G_2
if #finditem = -1
return
set #lobjectID %lootContainer
set #lobjectID #findID
event macro 17
wait 10
finditem POF C_ , %lootContainer
if #FINDCNT > 0 ; if you find any gold it will loot
{
exevent drag #findid #findstack
wait 15
exevent dropc #BackPackID
wait 15
}
hideitem %lootContainer
wait 10
return
-
You can try this to loot gold
sub lootrock
finditem YFM G_2
if #finditem = -1
return
set #lobjectID %lootContainer
set #lobjectID #findID
event macro 17
wait 10
finditem POF C_ , %lootContainer
if #FINDCNT > 0 ; if you find any gold it will loot
{
exevent drag #findid #findstack
wait 15
exevent dropc #BackPackID
wait 15
}
hideitem %lootContainer
wait 10
return
[/quote]
I tweaked to your example. Still oddly skips looting a corpse now and then... not sure why. Tried longer waits to see if lag related.
-
Try this if that work better.
sub lootrock
finditem YFM G_2
if #findkind = -1
return
set #lobjectID #findID
event macro 17
ignoreitem #findid
wait 10
IF #CONTTYPE = YFM
set %corpse #contid
finditem POF C_ , %corpse
if #FINDCNT > 0 ; if you find any gold it will loot
{
exevent drag #findid #findstack
wait 15
exevent dropc #BackPackID
wait 15
}
wait 10
return
-
What I've always had to do is just ignore the Loot Container and just check all containers that aren't your backpack.
Finditem POF C
For #Findindex 1 #Findcnt
{
if #Findbagid <> #Backpackid
{
; Loot
}
}
This prevents any errors that come from not getting the property container id.
-
Try this if that work better.
sub lootrock
finditem YFM G_2
if #findkind = -1
return
set #lobjectID #findID
event macro 17
ignoreitem #findid
wait 10
IF #CONTTYPE = YFM
set %corpse #contid
finditem POF C_ , %corpse
if #FINDCNT > 0 ; if you find any gold it will loot
{
exevent drag #findid #findstack
wait 15
exevent dropc #BackPackID
wait 15
}
wait 10
return
That did it!! So far, 30 minutes, no missed gold.
-
glad it work,
Trial and error that how u learn
-
I have been hitting a wall for several weeks. Appreciate it!