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

Riven
a lesser mummy
a lesser mummy
Posts: 68
Joined: Sat Jan 31, 2004 12:14 pm
Location: Missouri

ground collect

Post by Riven » Sun Apr 25, 2004 9:11 pm

been working all day on this mac and cant seem to understand why i keep crashing to the desktop with the current mq2 apri 25 2004 download.

Code: Select all

#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)>10{
   /press up
      /goto :Nudge
   }
   /face item
   /sendkey down Page_Down
   /delay 2s
   /sendkey up Page_Down
   /click left item
   /delay 1s
   /if "$cursor()"=="NULL" /goto :Nudge
   /autoinventory
   /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. . ."
   /sit 
   /camp desktop
/return


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

s16z
a ghoul
a ghoul
Posts: 97
Joined: Thu Apr 01, 2004 12:03 pm

Post by s16z » Sun Apr 25, 2004 10:09 pm

All your if statements are wrong. I've noticed when you make an error in the if statement, you CTD. Have not traced it yet, so haven't reported it. Now I'm going to get yelled at :)

User avatar
Seagreen500
crash test
Posts: 47
Joined: Mon Nov 10, 2003 1:04 am

Post by Seagreen500 » Mon Apr 26, 2004 2:23 am

I'd assume you have to rewrite this macro using MQ2Data instead of the older parm system. [EDIT] well by May 1st anyways, sorry if this doesn't answer your question and there really is a problem with /if in old parm ;)

ie;

Code: Select all

 /sendkey down Page_Down 
would become

Code: Select all

/keypress Page_Down hold
or

Code: Select all

/if n $distance(item)>10{
would be

Code: Select all

/if (${Target.Distance}>10) {
and so on, there are some great examples already in the macros in this forum. Look for MQ2Data /nod

Seagreen

Riven
a lesser mummy
a lesser mummy
Posts: 68
Joined: Sat Jan 31, 2004 12:14 pm
Location: Missouri

convert

Post by Riven » Mon Apr 26, 2004 7:08 pm

was really asking for a bit more help in conversion. Ill do my best and keep trying.

helstar
orc pawn
orc pawn
Posts: 21
Joined: Sat Jan 24, 2004 6:23 pm

converting

Post by helstar » Wed Apr 28, 2004 7:52 pm

Hello. well i have noticed that no one has updated this thread. any chance for some one to convert the mac. I too would like the mac updated i use it all the time.