Ground Collect

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Losingteam
a lesser mummy
a lesser mummy
Posts: 75
Joined: Wed May 21, 2003 8:52 pm
Location: Chicago,Illinois

Ground Collect

Post by Losingteam » Thu Oct 16, 2003 11:44 pm

Anyone able to convert this code please. It is not my code personally, but I am sure others, as well as myself would truelly appreciate it.

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


Here is my attempt at it. Hoping I am coming pretty close.

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 

Sub Main
/declare CollectedItem     global

/declare LastY         global 
/declare LastX          global 
/declare ObstCount       global 

/declare NotFound      global 
   /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 @Param0 
   /if "@getlasterror"=="ITEM_NOTFOUND" /call NotFound @Param0 
   /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: ~~  @Param0  ~~ not found. Waiting 1 min. . ." 
   /delay 1m 
/return 1 

/return 
Sub DoLog 
   /mqlog @Param0 
   /echo @Param0 
/return

I probably didn't accomplish anything, but atleast I gave it a shot, and I hope you give me some credit for atleast trying. Hehe.
Last edited by Losingteam on Fri Oct 17, 2003 12:05 am, edited 1 time in total.

DekeFentle
a lesser mummy
a lesser mummy
Posts: 48
Joined: Wed Oct 22, 2003 1:41 pm

Post by DekeFentle » Thu Oct 23, 2003 5:39 pm

I second the request to get one of the guru's to work on updati9ng this one. Not only would it be a very useful too, it's fairly short and simple and would certainly assist me in understanding how to use MQ better.
Revelation 6:8

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Thu Oct 23, 2003 8:25 pm

Converted and cleaned up a bit, enjoy.

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

Sub Main
   /cleanup
   /call DefineGlobals
   /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 DefineGlobals
/declare CollectedItem global

/declare LastY global
/declare LastX global
/declare ObstCount global

/declare NotFound global
/return

Sub MistyAcorn_Mains
   /Call DoLog "Begining Collection of Misty Acorns"
:Next
   /call FindItem *Green
   /call MoveToTarget
   /call PickUpItem
   /goto :Next
/return

Sub OakBark_Main
   /Call DoLog "Begining Collection of Oak Bark"
:Next
   /call FindItem *Green
   /call MoveToTarget
   /call PickUpItem
   /goto :Next
/return

Sub YewLeaves_Main
   /Call DoLog "Begining Collection of Yew Leaves"
:Next
   /call FindItem *Green
   /call MoveToTarget
   /call PickUpItem
   /goto :Next
/return

Sub FindItem
:NotFoundReturn
   /varset NotFound 0
   /seterror clear
   /itemtarget @Param0
   /if "$getlasterror"=="ITEM_NOTFOUND" /call NotFound @Param0
   /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
: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: ~~  @Param0  ~~ not found. Waiting 1 min. . ."
   /delay 1m
/return 1

Sub DoLog
   /mqlog @Param0
   /echo @Param0
/return

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

Post by FreQuency » Thu Oct 23, 2003 9:00 pm

Opps guess i should have posted the converted one, not to worry im working on another that will hopefully be able to follow a path around certain mapped zones and hopefully ignore unatainable spawns.

Thanks for the Clean up and convert Scrime me be lazy sometimes

tac8357
orc pawn
orc pawn
Posts: 25
Joined: Fri Oct 17, 2003 5:18 pm
Contact:

cant seem to get it to run

Post by tac8357 » Fri Oct 24, 2003 9:59 am

Having problems firing that one up for some reason. Doesnt kick up an error or anything. Probably somthing i'am doing.

DekeFentle
a lesser mummy
a lesser mummy
Posts: 48
Joined: Wed Oct 22, 2003 1:41 pm

Post by DekeFentle » Fri Oct 24, 2003 10:34 am

In that I'm a total n00b to all of this I tried last night to just use the simple pieces I thought I understood.

/targetitem *green leaf
/face item

Then I walked myself to the spot repeating "/face item" as necessary.

Worked well I found 6 of the Yew Leaves I was looking for.

However, on two occasions I was lead to a tree and no leaf was present. I'm guessing the item spawned "inside" the tree or at least at a spot invisible to me.

My question, is there a way to retrieve these "hidden" spawns?
Revelation 6:8

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

Post by FreQuency » Fri Oct 24, 2003 2:39 pm

However, on two occasions I was lead to a tree and no leaf was present. I'm guessing the item spawned "inside" the tree or at least at a spot invisible to me.
Yes this means the leaves were inside an object. It is possible to retrieve them but not with MQ and I will leave that at that PM and Ill point you in the right direction(if im in a good mood :wink: ) Also i maybe possible the leaves are up above you in/on the tree.

Having problems firing that one up for some reason. Doesnt kick up an error or anything. Probably somthing i'am doing
Macro in its current form only works in Misty, Wakenlands and Butcherblock Mountains. Use the code below to search most otehr zones

Untested but should work

Code: Select all

|** 
GroundCollect.mac  - v 1. 2. 1  by FreQuency 10/24/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 

Sub Main 
   /cleanup 
   /call DefineGlobals 
   /if $cursor()!=NULL /click left auto 
   /if $invpanel==True /press I 
   /Call DoLog Begining Collection in zone $zone
:Next 
   /call FindItem *Green 
   /call MoveToTarget 
   /call PickUpItem 
   /goto :Next 
    
/return 

Sub DefineGlobals 
/declare CollectedItem global 

/declare LastY global 
/declare LastX global 
/declare ObstCount global 

/declare NotFound global 
/return 

Sub FindItem 
:NotFoundReturn 
   /varset NotFound 0 
   /seterror clear 
   /itemtarget @Param0 
   /if "$getlasterror"=="ITEM_NOTFOUND" /call NotFound @Param0 
   /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 
: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: ~~  @Param0  ~~ not found. Waiting 1 min. . ." 
   /delay 1m 
/return 1 

Sub DoLog 
   /mqlog @Param0 
   /echo @Param0 
/return 

Mixy
a lesser mummy
a lesser mummy
Posts: 46
Joined: Tue Jul 09, 2002 5:00 pm

Post by Mixy » Fri Oct 24, 2003 9:13 pm

When i run this macro i get an eroor which says "Cannot call with no macro running"
Any idea what this might be?

-Mixy

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Fri Oct 24, 2003 9:21 pm

Try changing the multi-line comment:

Code: Select all

|**
GroundCollect.mac  - v 1. 2. 1  by FreQuency 10/24/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

**| 
to single line comments:

Code: Select all

| GroundCollect.mac  - v 1. 2. 1  by FreQuency 10/24/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

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Sat Oct 25, 2003 4:40 am

Another bug: if can't target any items and /items doesn't return any names, you have a bugged ItemDB.txt file. Find the entry for 0 and delete it.

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Mon Oct 27, 2003 2:19 pm

Anybody have any ideas for modifying this macro to ignore ground spawns that are not reachable? ( i.e. Yew Leafs under trees)

Thanks!

Mixy
a lesser mummy
a lesser mummy
Posts: 46
Joined: Tue Jul 09, 2002 5:00 pm

Post by Mixy » Mon Oct 27, 2003 4:18 pm

By the way Scrime, that worked for me.
-Mixy

EnterTheFist
orc pawn
orc pawn
Posts: 17
Joined: Sat Aug 30, 2003 3:49 am

Post by EnterTheFist » Wed Oct 29, 2003 12:02 pm

NotSoCSharp wrote:Anybody have any ideas for modifying this macro to ignore ground spawns that are not reachable? ( i.e. Yew Leafs under trees)

Thanks!
Perhaps when you run the GoAroundObst sub, if the distance between you and the yew leaf happens to be within a certain small value (ie. you've run into a tree and the item is within say 5 units, then it must be inside the tree), then you can tell it to skip this item and go to the next.

Not sure how you do that, though... is there a command "/itemtarget next *Item" or something?

EnterTheFist
orc pawn
orc pawn
Posts: 17
Joined: Sat Aug 30, 2003 3:49 am

Post by EnterTheFist » Wed Oct 29, 2003 12:17 pm

Also, not sure if this is cross-server or not (it should be, right?).. but..

Code: Select all

   /if "$zone"=="Wakening Lands" /call YewLeaves_Main 
Should be changed to:

Code: Select all

   /if "$zone"=="The Wakening Land" /call YewLeaves_Main 
For this to work in WL. Not sure about the other two zones.[/code]

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Tue Nov 04, 2003 2:59 pm

where can I find the routines.mac? I did a search and got 696 hits..and none of em where routines.mac