ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Ultima on October 08, 2011, 12:12:16 PM
-
This is the code I incorporated into the FaFer to cut up the fish. It's working 90% of the time but it hangs every once in a while for some reason. I could have make a mistake with one of the FISH IDs or it could be the 200 ms Ping that is creating hiccups. Sometimes I get the message "Use this on corpse to carve away meat and hide".
I'm happy with it but it's not 100%. It could have to do with where I placed it in the script...
I pieced it together looking at some of C2's code. Anything stand out at first glance?
finditem %knife C_ , #backpackid
set #lobjectid #findid
event macro 17
target
finditem %fish C_ , #backpackid
set #ltargetid #findid
set #ltargetkind 1
event macro 22
wait 8
-
Hi,
I would add a few waits to make sure you will not end up with hicups,
from what I know about my own scripts the event command can
be very tricky without any delay !
Set %DelayEvent 20 ; Waittime for Event Macro Function
Set %DelayDrop 15 ; Waittime after Object Movement
finditem %knife C_ , #backpackid
set #lobjectid #findid
event macro 17
Wait %DelayEvent
target
finditem %fish C_ , #backpackid
set #ltargetid #findid
set #ltargetkind 1
event macro 22
Wait %DelayDrop
-
Thanks Rana70!
I'll edit the sub and add the event delays and see if it fixes the hiccup. :D
-
Added the Delay but that wasn't the problem.
I included the ID for Cut of Meat (VRD) in the Fish% that's why I was getting the message "Use this on corpse to carve away meat and hide". I really should have caught that before posting this however I'm happy I didn't because I learned something (how to incorporate wait times another way).
Thanks again Rana70! 8)
-
This is the code I incorporated into the FaFer to cut up the fish. It's working 90% of the time but it hangs every once in a while for some reason. I could have make a mistake with one of the FISH IDs or it could be the 200 ms Ping that is creating hiccups. Sometimes I get the message "Use this on corpse to carve away meat and hide".
I'm happy with it but it's not 100%. It could have to do with where I placed it in the script...
I pieced it together looking at some of C2's code. Anything stand out at first glance?
finditem %knife C_ , #backpackid
set #lobjectid #findid
event macro 17
target
finditem %fish C_ , #backpackid
set #ltargetid #findid
set #ltargetkind 1
event macro 22
wait 8
Well here we see the most common mistake. There are missing brackets on check if found.
finditem %something C_ %somewhere
if #findcnt > 0
{
do whatever you need to do if found
}
else
{
do whatever you need to do if not found
}
At the moment, even if the item is not found, you execute following code
set #lobjectid #findid
event macro 17
target
finditem %fish C_ , #backpackid
set #ltargetid #findid
set #ltargetkind 1
event macro 22
wait 8
So I would do it like this
finditem %knife C_ , #backpackid
if #findcnt > 0
{
set #lobjectid #findid
finditem %fish C_ , #backpackid ; search for fish in backpack
while #findcnt > 0 ; WHILE There is fish in the backpack, peform everything inside the brackets
{
event macro 17
target
set #ltargetid #findid
set #ltargetkind 1
event macro 22
wait 8
finditem %fish C_ , #backpackid ; search for more fish in your backpack.
}
}
else
{
display knife not found
halt
}
-
Thanks feedback Cambotik.
Script is still messing up afterall and it may have to do with not having a #findcnt> 0.
Interesting on the brackets...
I'll test this evening.