set %logfile c:\mininglog.txt
set %packanimalname beetle_name_here
packloop:
finditem ZGB G_2
if #FINDKIND <> -1
{
event property #FINDID
if %packanimalname in #PROPERTY
{
set %packanimal #FINDID
goto skippacksearch
}
ignoreitem #FINDID
goto packloop
}
else
{
display ok Cannot locate a pack animal. Be sure$to change the packanimalname variable$to the name of your packy. If you are$riding, please dismount and run again.
stop
}
skippacksearch:
set %mintinkertools 2
gosub SyncTextScan
gosub OpenStatusBar
gosub OpenBackPack
gosub CheckTinkerTool
gosub CheckShovel
mainloop:
gosub FindValidText where_do_you_wish
if %2 = 1
{
wait 20
goto loop1
}
goto mainloop
loop1:
gosub FindValidTextNoAdvance there_is_no
if %2 = 1
{
sound
gosub SyncTextScan
gosub CheckWeight
goto mainloop
}
gosub FindValidTextNoAdvance that_is_too_far
if %2 = 1
{
gosub SyncTextScan
goto mainloop
}
gosub FindValidTextNoAdvance you_can't_mine
if %2 = 1
{
gosub SyncTextScan
goto mainloop
}
gosub FindValidTextNoAdvance your_backpack_is_full
if %2 = 1
{
gosub SyncTextScan
gosub CheckWeight
goto mainloop
}
gosub FindValidTextNoAdvance target_cannot_be
if %2 = 1
{
gosub SyncTextScan
goto mainloop
}
gosub FindValidTextNoAdvance you_dig_some
if %2 = 1
gosub SyncTextScan
gosub FindValidTextNoAdvance you_loosen_some
if %2 = 1
gosub SyncTextScan
gosub CheckWeight
gosub CheckTinkerTool
gosub CheckShovel
wait 10
event macro 17 0
target 3s
event macro 22 0
goto loop1
;--------------------------------------------
sub CheckWeight
if ( #WEIGHT >= #MAXWEIGHT ) || ( #WEIGHT > 400 )
{
gosub SyncTextScan
drag_again:
finditem DWJ C_ , #BACKPACKID
if #FINDKIND <> -1
{
exevent drag #FINDID #FINDSTACK
wait 5
exevent dropc %packanimal
wait 5
goto drag_again
}
}
return
;--------------------------------------------
sub OpenStatusBar
event macro 8 2 ; open status
gosub GumpWait NULL status_gump NULL
contpos 0 600
return
;--------------------------------------------
sub OpenBackPack
event macro 8 7 ; open backpack
gosub GumpWait NULL container_gump NULL
set %mypack #CONTID
contpos 750 330
return
;--------------------------------------------
sub CheckShovel
CheckShovel_loop1:
finditem ENK C_ , #BACKPACKID ; ingots
if #FINDSTACK < 4
{
display ok You don't have enough ingots to make a shovel.
halt
}
findItem WWF_TWF_QPF C_ , #BACKPACKID ; QPF = pickaxe
if #findkind = -1
{
gosub CheckTinkerTool
finditem JTL_KTL C_ , #BACKPACKID
set #LOBJECTID #FINDID
event Macro 17 0
gosub GumpWait generic_gump generic_gump
set %clickx #CONTPOSX + 28
set %clicky #CONTPOSY + 109
click %clickx %clicky
gosub GumpWait generic_gump generic_gump
set %clickx #CONTPOSX + 384
set %clicky #CONTPOSY + 271
click %clickx %clicky
gosub GumpWait generic_gump generic_gump
set %clickx #CONTPOSX + 234
set %clicky #CONTPOSY + 71
click %clickx %clicky
gosub GumpWait generic_gump generic_gump
findItem WWF_TWF C_ , #BACKPACKID
if #findkind <> -1
{
set %clickx #CONTPOSX + 166
set %clicky #CONTPOSY + 337
click %clickx %clicky r
set #LOBJECTID #FINDID
set #LTARGETKIND 2
return
}
goto CheckShovel_loop1
}
else
{
set #LOBJECTID #FINDID
}
return
;--------------------------------------------
sub CheckTinkerTool
set %close FALSE
tinkerloop:
set %tinkcount 0
findItem JTL_KTL C_ , #BACKPACKID
if #findkind = -1
{
display ok Ack, no more tinker tool
halt
}
if #FINDCNT < %mintinkertools
{
set #LOBJECTID #FINDID
event Macro 17 0
gosub GumpWait generic_gump generic_gump
if %tinkcount = 0
{
set %clickx #CONTPOSX + 28
set %clicky #CONTPOSY + 109
click %clickx %clicky
gosub GumpWait generic_gump generic_gump
set %clickx #CONTPOSX + 236
set %clicky #CONTPOSY + 129
click %clickx %clicky
gosub GumpWait generic_gump generic_gump
set %tinkcount %tinkcount + 1
goto tinkerloop
}
set %clickx #CONTPOSX + 286
set %clicky #CONTPOSY + 413
click %clickx %clicky
gosub GumpWait generic_gump generic_gump
set %tinkcount %tinkcount + 1
set %close TRUE
goto tinkerloop
}
if %close = TRUE
{
set %clickx #CONTPOSX + 166
set %clicky #CONTPOSY + 337
click %clickx %clicky r
}
return
;-------------------------------------------------------------------------------
; %1 = FindText
sub SyncTextScan
set %_jindex #jindex + 1
return
;-------------------------------------------------------------------------------
; %1 = string to search for
; %2 = 0 = bad text, 1 = string found
sub FindValidText
if ( %_jindex = N/A ) || ( #jindex < %_jindex )
{
set %_jindex #jindex
}
set %2 0
FindValidText_loop1:
if #jindex >= %_jindex
{
scanjournal %_jindex
if %1 in #journal
{
if :_ , %1 notin #journal
{
set %2 1
set %_jindex %_jindex + 1
return
}
}
set %_jindex %_jindex + 1
goto FindValidText_loop1
}
return
;-------------------------------------------------------------------------------
; %1 = string to search for
; %2 = 0 = bad text, 1 = string found
sub FindValidTextNoAdvance
if ( %_jindex = N/A ) || ( #jindex < %_jindex )
{
set %_jindex #jindex
}
set %temp_jindex %_jindex
set %2 0
FindValidTextNoAdvance_loop1:
if %temp_jindex <= #jindex
{
scanjournal %temp_jindex
if %1 in #journal
{
if :_ , %1 notin #journal
{
set %2 1
set %temp_jindex %temp_jindex + 1
return
}
}
set %temp_jindex %temp_jindex + 1
goto FindValidTextNoAdvance_loop1
}
return
;-------------------------------------------------------------------------------
; %1 = Gumpname 1
; %2 = Gumpname 2
sub GumpWait
wait 10
set %timedelay #SCNT
GumpWait_loop1:
if #CONTNAME = %1 || #CONTNAME = %2
return
if #SCNT > %timedelay + 7
return
goto GumpWait_loop1
return