Code: Select all
|**
GroundCollect.mac - v 1. 0. 1 by FreQuency 10/2/03
Still kinda Incomplete but gonna release as a start for expansion
~ Obstruction Code basis borrowed from Scrime who borrowed from GrimJack
Collects groundspawns from Misty, Butcherblock and Wakening Lands
~Known Issues
* Will not filter spawns considered to be out of reach.
* obstruction code may not get charecter around all areas
*** Many others
Must be monitored to ensure character does not get stuck
**|
#event turbo
#include routines.mac
#define CollectedItem v0
#define LastY v10
#define LastX v11
#define ObstCount v12
#define NotFound v20
Sub Main
/cleanup
/if $cursor()!=NULL /click left auto
/if $invpanel==True /press I
/if "$zone"=="Misty Thicket" /call MistyAcorn_Mains
/if "$zone"=="Butcherblock Mountains" /call OakBark_Main
/if "$zone"=="Wakening Lands" /call YewLeaves_Main
/return
Sub MistyAcorn_Mains
/Call DoLog "Begining Collection of Misty Acorns"
:Next
/call FindItem *Green Leaf
/call MoveToTarget
/call PickUpItem
/goto :Next
/return
Sub OakBark_Main
/Call DoLog "Begining Collection of Oak Bark"
:Next
/call FindItem *Green Leaf
/call MoveToTarget
/call PickUpItem
/goto :Next
/return
Sub YewLeaves_Main
/Call DoLog "Begining Collection of Yew Leaves"
:Next
/call FindItem *Green Leaf
/call MoveToTarget
/call PickUpItem
/goto :Next
/return
Sub FindItem
:NotFoundReturn
/varset NotFound 0
/seterror clear
/itemtarget $p0
/if "$getlasterror"=="ITEM_NOTFOUND" /call NotFound $p0
/if "$getlasterror"=="ITEM_NOTFOUND" /varset NotFound $return
/if n "$NotFound"=="1" /goto :NotFoundReturn
/call DoLog "Item found at: $ground(y), $ground(x)."
/return
Sub MoveToTarget
:KeepMoving
/call CheckForObst
/face loc $ground(y), $ground(x)
/sendkey down up
/if n "$distance(item)">"15" /goto :KeepMoving
/if n "$distance(item)"<="15" /goto :StopMoving
:StopMoving
/sendkey up up
/return
Sub PickUpItem
/face item
:Nudge
/if n "$distance(item)">"$rand(2)" /press up
/if n "$distance(item)">"$rand(2)" /goto :Nudge
/face item
/sendkey down Page_Down
/delay 2s
/sendkey up Page_Down
/mouseto item
/delay 1s
/click left
/delay 1s
/if "$cursor()"=="NULL" /goto :Nudge
/click left auto
/delay 1s
/if $invpanel==True /press I
/press Home
/return
Sub CheckForObst
/if n $char(x)==$LastX /if n $char(y)==$LastY {
/varadd ObstCount 1
} else {
/varset ObstCount 0
}
/varset LastX $char(x)
/varset LastY $char(y)
/if n $ObstCount>3 {
/call DoLog "Obstruction at $char(y), $char(x)"
/call GoAroundObst
}
/return
Sub GoAroundObst
/sendkey up up
/sendkey down down
/delay (2+$rand(5))s
/sendkey up down
/if n "$rand(20)">="10" {
/sendkey down left
/delay 5
/sendkey up left
/sendkey down up
/delay 7s
/sendkey up up
} else {
/sendkey down right
/delay 5
/sendkey up right
/sendkey down up
/delay 7s
/sendkey up up
}
/return
Sub NotFound
/call DoLog "Item: ~~ $p0 ~~ not found. Waiting 1 min. . ."
/delay 1m
/return 1
/return
Sub DoLog
/mqlog $p0
/echo $p0
/return
"There is a difference between knowing the path and walking the path."
