cheese mac converted to bear meat maker that fails randomly (im thinking lagg) added delays that did not help. maybe just the wrong spot. here is the code before adding delays to everything and still having it fail from time to time.
fails from time to time on the sell and every now and then fails after buying bear meat saying my inv is full.. no more room
it works but if it ran without failing it would be better
| - bear.mac -
|
#include routines.mac
Sub Main
/mqlog
/varcalc v50 $char(plat)*10+$char(gold)
/varset t0 3000
/varset t1 0
/call FindCombiner baking
/if $return==99 /return
/varset v80 $return
:StartLoop
/cleanup
/click left auto
/click right inv $v80
/if $pack($v80,empty)==FALSE /call CleanPack
/if $pack($v80,empty)==FALSE /goto :TooFull
/sendkey down ctrl
/call Makebear
/sendkey up ctrl
| /if n $t1==0 /call CastCHA
/call SellBuy
/if $t0==0 /call LogStats
/goto :StartLoop
:TooFull
/echo You are too full on stuff, aborting macro.
/return
Sub CleanPack
/varcalc v2 $pack($v80,slots)-1
/sendkey down shift
/for v1 0 to $v2
/click left pack $v80 $v1
/click left auto
/next v1
/sendkey up shift
/return
Sub Makebear
:Makebear
/finditem "bear meat"
/click left pack $v80 0
/finditem "filleting knife"
/click left pack $v80 3
/if "$item($v80,0,name)"=="bear meat" /if "$item($v80,3,name)"=="filleting knife" /goto
/return
/click left pack $v80 combine
:LoopWait
/if "$cursor()"=="NULL" /goto :LoopWait
/if "$cursor(name)"=="filleting knife" /goto :Failed
/click left auto
:LoopFail
/if "$cursor()"=="NULL" /goto :LoopFail
:Failed
/click left auto
/goto :Makebear
/return
Sub SellBuy
| Open merchant
/click left auto
/target drible
/face
/press u
/delay 25
/sendkey down shift
| Sell our bearmeat
:Sellbear
/varset v98 $char(gold)
/finditem "filleted bear"
/if $find()==FALSE /goto
/click left merchant buy
:WaitSale
/if n $v98==$char(gold) /goto :WaitSale
/goto :Sellbear
/varset v51 0
/finditem "bear meat"
/if $find()==TRUE /varset v51 1
/goto :buybearmeat
:buybearmeat
| Buy bearmeat
/click left merchant 11
/call BuyItem
/call BuyItem
/call BuyItem
/call BuyItem
/call BuyItem
/sendkey up shift
/press esc
/return
Sub LogStats
| Calc profit in gold
/varcalc v51 $char(plat)*10+$char(gold)-$v50
| calc plat/hr
/varcalc v52 $v51*360/$running
| Plat
/varcalc v53 $v51/10
| left over gold
/varcalc v54 $v51%10
/echo Profit: $v53.$v54pp, avg: $v52pp/hr
/mqlog Run time: $running sec, Profit: $v53.$v54pp, Average = $v52pp/hr
/varset t0 3000
/return
Sub BuyItem
/varcalc v98 $char(gold)*100+$char(silver)*10+$char(copper)
/click left merchant buy
:WaitBuy
/varcalc v97 $char(gold)*100+$char(silver)*10+$char(copper)
/if n $v98==$v97 /goto :WaitBuy
/return
Sub CastCHA
/target myself
/call Event_CastFizzle
:LoopFizzle
/doevents
/if n $t9>0 /goto :LoopFizzle
/varset t1 30m
/return
Sub Event_CastFizzle
/delay 5
/cast 1
/varset t9 7s
/return


