It's bad practice to have a repeat without an until. Also, your wait timers don't allow for any error at all. So your character would be walking all over the place. To every corpse. What if the corpse was 9 tiles away? Is 2 seconds enough time while walking? Maybe. What if you lag? Having that wait 10 after the event macro 17 isn't very efficient either. It's a better idea to set a wait timer, over what it would normally take for a corpse to open, and detect if the #contid has changed. Because no 2 corpse container ids will be alike. Then on error, you can break out of that loop while you wait. What if the corpse doesn't open for some reason? Then you wait that 10, and continue through the code like an error never occurred. Which it did... That's not a good idea. You should look at mine for a better idea of how to do it. I actually put in a return for a corpse cont error so it will not continue to execute code if the container doesn't open. That also will fix missing corpses, because it won't ignore that corpse if it errors and it will reloot that corpse again. It's just more logical.
Plus #findkind is oldschool.

#findcnt is better. That's a very basic wait to handle cutting corpses. Now that I wrote all that, I'll write corpse cutting into mine to show you. Another issue you have, is you are doing a finditem every loop for tools, when that isn't needed. It's fine, just slows things down needlessly, when you start writing larger scripts that will matter. And this code should now account for all timings from actions performed in the script itself, so outside of this code, no timing should be needed to use it. It's all taken care of in the looting code itself. You could probly just do a gosub loot and put that code into that, with the variables at the top of the script and it would work fine.
set %cutCorpse #true
set %knife ; Set this to any knives or corpse cutting tool
if %cutCorpse = #true
{
finditem %knife c_ , #backpacked
if #findcnt > 0
set %knifeTool #findid
else
display ok Tool not found! Get a tool!
}
set %targetTimer #sysTime
set %corpseContSize 144_212; Set this to whatever size the container is for a corpse on your shard
set %corpseLooted n/a
set %itemTypes VLK
set %corpses YFM
repeat
finditem %corpses G_2
if #findcnt > 0
{
set %corpse #findid
set %contid #contid
if %cutCorpse = #true
{
set #lobjectid %knifeTool
if #targCurs = 1
{
set #targCurs 0
wait 5
}
event macro 17
set #ltargetkind 1
set %targetTimer #sysTime + 1000
while %targetTimer > #sysTime && #targCurs = 0
{
}
if #targCurs = 1
{
event macro 22
while %targetTimer > #sysTime
{
}
}
}
while %targetTimer > #sysTime
{
}
event macro 17
set %contWait #sysTime + 1100
while #contsize <> %corpseContSize || #contid = %contid
{
if #contid <> %contid
{
wait 5
break
}
}
if %contWait < #sysTime
{
set %corpseLooted #false
while %contWait > #sysTime
{
}
return ; Return on container error
}
set %corpseContId #contid
finditem %itemTypes c_ , %corpseContId
{
if #findcnt > 0
{
; Find and loot whatever you want here
set %corpseLooted #true
}
}
if %corpseLooted = #true
ignoreitem %contid
while %contWait > #systime
{
}
}
until #false