Page 1 of 1

ground spawns

Posted: Sat Jul 03, 2004 2:22 pm
by Riven
Has anyone seen the thread that talks about targeting. meaning i have ground collect mac. When targets the item, it doesnt know it its inside a item or not. I seen something about this some where. i guess i just need to know how i can fixe it so when it does the check for the item and location, it can tell if its inside a wall or something.

Code: Select all



Sub Main 
    /cleanup 
    /call DefineGlobals 
    /if (${Cursor.ID}) /autoinv 
    /Call DoLog Begining Collection in zone ${Zone.Name} 
  :Next
     
    /call FindItem *Green 
    /call MoveToTarget 
    /call PickUpItem
    /goto :Next 
    
    /return 

Sub DefineGlobals 
    /declare CollectedItem outer 
    /declare Evacuate outer 
    /declare LastY outer 
    /declare LastX outer 
    /declare ObstCount outer 
    /declare NotFound outer 
    /return 

Sub FindItem 
  :NotFoundReturn 
    /varset NotFound 0 
    /seterror clear 
    /itemtarget ${Param0} 
    /if (!${Ground.X}) { 
        /call NotFound ${Param0} 
        /goto :NotFoundReturn 
    } 
    /call DoLog "Item found at: ${Ground.Y}, ${Ground.X}." 
    /return 

Sub MoveToTarget 
  :KeepMoving 
    /call CheckForObst 
    /face loc ${Ground.Y}, ${Ground.X} 
    /keypress up hold 
    /if (${Ground.Distance}>10) /goto :KeepMoving 
  :StopMoving 
    /keypress up 
    /return 


Sub PickUpItem 
   /face item 
:Nudge 
    /if (${Ground.Distance}>5) { 
        /keypress up hold 
        /keypress up 
        /goto :Nudge 
    } 
    /face item 
    /click left item 
    /delay 1s 
    /if (!${Cursor.ID}) /goto :Nudge 
    /autoinventory 
    /delay 1s    
    /return 

Sub CheckForObst 
   /if (${Me.X}==${LastX}) /if (${Me.Y}==${LastY}) { 
      /varcalc ObstCount ${ObstCount}+1 
   } else { 
      /varset ObstCount 0 
   } 
    
   /varset LastX ${Me.X} 
   /varset LastY ${Me.Y} 
    
   /if (${ObstCount}>3) { 
      /call DoLog "Obstruction at ${Me.Y}, ${Me.X}" 
      /call GoAroundObst 
   } 
/return 

Sub GoAroundObst 
   /keypress up 

   /keypress down hold 
   /delay ${Math.Calc[2+${Math.Rand[5]}]}s 
   /keypress down 


   /if (${Math.Rand[2]}==1) { 
      /keypress left hold 
      /delay 5 
      /keypress left 
      /keypress up hold 
      /delay 7s 
      /keypress up 
   } else { 
      /keypress right hold 
      /delay 5 
      /keypress right 
      /keypress up hold 
      /delay 7s 
      /keypress up 
   } 
/return 


Sub NotFound 
   /call DoLog "Item: ~~  ${Param0}  ~~ not found. Waiting 1 minute" 
   /delay 1m 
   /return 1 

Sub DoLog 
   /mqlog ${Param0} 
   /echo ${Param0} 
/return 

Posted: Sat Jul 03, 2004 4:11 pm
by GD
Checking the Z Axis helps, cause if it's +/- 100 or more than you are, it's generally stuck in something if you are close to it's location.

fix

Posted: Sat Jul 03, 2004 4:13 pm
by Riven
any ideas how i can add that into my mac.