Ground Spawn Collection

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

User avatar
FreQuency
a hill giant
a hill giant
Posts: 215
Joined: Tue Sep 23, 2003 6:03 pm

Ground Spawn Collection

Post by FreQuency » Wed Oct 01, 2003 11:58 pm

This is in no way complete but it does work very well.

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
Frequency
"There is a difference between knowing the path and walking the path."

Milten
a hill giant
a hill giant
Posts: 176
Joined: Thu Oct 09, 2003 11:40 am

Post by Milten » Fri Oct 10, 2003 3:43 pm

does this work any more at all? I'd like to collect fungus in kaladim.. could this macro do that?