ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: declo on March 21, 2016, 03:29:49 PM
-
I have a written a small script that uses Snicker7's s7smeltonbeetle to loot ore off elementals. The problem is sometimes it opens the corpse and does nothing but hide it. It doesn't smelt the ore or loot the gems. And when there is no corpse, it moves my backpack. Any help would be really appreciated!!
set %loot HVF_UVF_FVF_EVF_OVF_VUF_GVF_RVF_BVF_VVF_NVF_ZVF_
event macro 3 0 All follow me
Start:
finditem YFM G_2
if finditem <> -1
{
set #lobjectid #findid
set %oreContainer #findid
event macro 17 0
wait 1s
contpos 100 0
wait 1s
gosub s7SmeltOnBeetle %oreContainer
wait 1s
gosub gems
wait 1s
hideitem %oreContainer
}
goto start:
;==============Loot Jewels============
sub gems
Gms:
finditem %loot C_ , %oreContainer
if #findkind = -1
{
return
}
exevent drag #findid #findstack
wait 20
exevent DropC #backpackid
wait 27
goto gms
;==============Smelt Ore============
;----
;* @name s7SmeltOnBeetle
;* @author snicker7
;* @ver 1.1 13Feb05
;* @purpose smelt all ore in specified container
;* (default: backpack) on a firebeetle within
;* 2 tiles.
;* @params %1 (optional) the container from
;* which to smelt ore. if none is
;* specified it defaults to backpack.
;* @returns #true if all ore was successfully smelted
;* #false fire beetle was not found within 2 tiles.
;* @notes props to Quintok for the specify container idea.
;* @example: gosub s7SmeltOnBeetle %oreContainer
;* @status done
;----
sub s7SmeltOnBeetle
set #result #backpackid
if %0 > 0 && %1 <> N/A
set #result %1
ignoreitem reset s7IOre
finditem JJ G_2 ;jj
if #findkind = -1
return #false
set #ltargetid #findid
set #ltargetkind 1
s7SmOB:
finditem DWJ_EWJ_GWJ_TVJ C_ , #result
if #findkind <> -1
{
if ( ( #findtype = TVJ && #findstack >= 2 ) || #findtype <> TVJ )
{
set #lobjectid #findid
event macro 17 0
target
event macro 22 0
wait 10
}
if #findtype = TVJ && #findstack < 2
ignoreitem #findid s7IOre
goto s7SmOB
}
return #true
-
well here's one mistake:
set %loot HVF_UVF_FVF_EVF_OVF_VUF_GVF_RVF_BVF_VVF_NVF_ZVF_
event macro 3 0 All follow me
Start:
finditem YFM G_2
if finditem <> -1 <----- mistake...
should be:
if #findkind <> -1
maybe that will fix?
*edit*
ok, was looking at this more, and I recommend writing your gem sub without the #findkind return thing, though that IS a very interesting and inventive way to write that. This is not technically any better, but will reduce the *cringe* factor for inspectors of your script.
sub gems
finditem %loot C_ , %oreContainer
for #findindex 1 #findcnt
{
exevent drag #findid #findstack
wait 20
exevent DropC #backpackid
wait 27
}
return
all in all, not a bad job. That first fix will probably work fine without this, but this is much better scripting practice. :)
-
Awesome!! Thank you so much!!
-
ok, was looking at this more, and I recommend writing your gem sub without the #findkind return thing, though that IS a very interesting and inventive way to write that. This is not technically any better, but will reduce the *cringe* factor for inspectors of your script.
sub gems
finditem %loot C_ , %oreContainer
for #findindex 1 #findcnt
{
exevent drag #findid #findstack
wait 20
exevent DropC #backpackid
wait 27
}
return
all in all, not a bad job. That first fix will probably work fine without this, but this is much better scripting practice. :)
[/quote]
Quick question to understand, the "for #findindex 1 #findcnt" repeats 1 thru #findcnt correct? So if #findcnt was 3, it would loop 3 times, then return?
-
yes, and using #findindex as the counter iterates through each indexed id.