Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[EUO] Mining
#1

Made a new macro since the old one stopped working. This one doesn't automate everything like the previous version did so hopefully it should be ok. Works in any mine except Mt. Kendall (mine outside minoc).

Code:
; OzMining 2.0
;
; Features:
; - Moves around the mine randomly
; - Mines a tile clean of ore before moving on to next one
; ==============================================================================

set #LPC 10
set %toolTypes QPF
set %status idle

event sysmessage Starting OzMining 2.0

while ( #charghost = no )
{
  if ( #WEIGHT > #MAXWEIGHT )
  {
    event sysmessage Max weight exceded! Halting...
    halt
  }
  if %status = no_more_ore
  {
     set %status idle
     goto MoveToNextSpot
  }
  set %jrnl #jindex
  gosub MineThisSpot
  gosub ProcessResults
}
halt

sub MineThisSpot
  if ! ( %status = idle )
    return
  finditem %tooltypes C
  if #FINDCNT > 0
  {
    set #lObjectId #findId
    event macro 17 0
    set %jrnl #jindex
    tile Init
    Tile Get #CharPosX #CharPosY 2
    set #lTargetTile #tileType
    set #lTargetX #charPosX
    set #lTargetY #charPosY
    set #lTargetZ #charPosZ
    set #lTargetKind 3
    target 20s
    event Macro 22 0

    set %status mining
  }
return

sub ProcessResults
  set %MiningTimer #SYSTIME
  while ( %status = mining )
  {
    if #jindex > %jrnl
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
      if you_dig_some in #journal
        set %status idle
      if you_carefully_extract_some_workable_stone in #journal
        set %status idle
      if you_loosen_some_rocks in #journal
      {
        if ( #SYSTIME <= %MiningTimer + 1000 )
          wait 7s
        set %status idle
      }
      if You_have_moved_too_far in #journal
        set %status idle
      if you_can't_mine_there in #journal
        set %status idle
      if Someone_has_gotten in #journal
        set %status idle
      if Can't_mine_that in #journal
      {
        set %status no_more_ore
        gosub MoveToNextSpot
      }
      if target_cannot_be_seen in #journal
      {
        set %status no_more_ore
        gosub MoveToNextSpot
      }
      if there_is_no_metal_here_to_mine in #journal
      {
        set %status no_more_ore
        gosub MoveToNextSpot
      }
    }
    if ( #SYSTIME >= %MiningTimer + 7000 )
    {
      set %status no_more_ore
      gosub MoveToNextSpot
    }
  }
return

sub MoveToNextSpot
FindNextSpot:
  set %GotoX #charposX
  set %GotoY #charposY
  set %oldX #charposX
  set %oldY #charposY

  set %randomInc #random % 5
  ; negative or positive?
  set %nDirection #random % 2
  if %nDirection = 1
    set %randomInc %randomInc * -1
  set %GotoY %GotoY + %randomInc

  ; Random amount of tiles to a direction
  set %randomInc #random % 5
  ; negative or positive?
  set %nDirection #random % 2
  if %nDirection = 1
     set %randomInc %randomInc * -1
  set %GotoX %GotoX + %randomInc

  tile Init
  tile Get %GotoX %GotoY 2
  if ( #tilename = cave_floor )
  {
    gosub MoveTo %GotoX %GotoY 0
    set %status idle
  }
return

sub MoveTo
  set %oldX #charposX
  set %oldY #charposY

GetThere:
  if ( #charposX = %1 && #charposY = %2 )
    return
  event pathFind %1 %2 %3
  wait 5
  set %MoveStartTime #SYSTIME
  while ! ( #charposX = %1 && #charposY = %2 )
  {
    if can't_get_there in #journal
      gosub OpenDoor
    if ( #charposX = %oldX && #charposY = %oldY )
      return
    if ( #SYSTIME > %MoveStartTime + 1000  )
      return
  }
return

Just run it using EUO. Macro will halt when your weight exceeds maximum weight. Later on I might add automatic smelting if I can get around to it but I guess banking is a no.


Messages In This Thread
[EUO] Mining - by imported_Kamos - 06-03-2009, 09:06 PM
[EUO] Mining - by smoke - 06-04-2009, 12:14 AM
[EUO] Mining - by Eighty Swords - 06-04-2009, 12:29 AM
[EUO] Mining - by imported_Kamos - 06-04-2009, 12:39 AM
[EUO] Mining - by imported_Paulie - 06-04-2009, 07:57 AM
[EUO] Mining - by imported_Hiroshima - 06-04-2009, 07:34 PM
[EUO] Mining - by smoke - 06-04-2009, 07:49 PM
[EUO] Mining - by imported_Kamos - 06-04-2009, 08:00 PM
[EUO] Mining - by smoke - 06-04-2009, 08:59 PM
[EUO] Mining - by smoke - 06-05-2009, 05:33 PM
[EUO] Mining - by Eighty Swords - 06-05-2009, 11:52 PM
[EUO] Mining - by imported_Captain Morgan - 06-07-2009, 02:16 PM
[EUO] Mining - by imported_Papa Smurf - 06-10-2009, 02:48 AM
[EUO] Mining - by imported_Kamos - 06-10-2009, 09:14 AM
[EUO] Mining - by imported_Papa Smurf - 06-10-2009, 09:26 AM
[EUO] Mining - by imported_Myrial - 06-16-2009, 10:58 AM
[EUO] Mining - by imported_Kamos - 06-16-2009, 12:04 PM
[EUO] Mining - by imported_Myrial - 06-17-2009, 02:31 PM
[EUO] Mining - by imported_Kamos - 06-29-2009, 10:56 AM
[EUO] Mining - by imported_Andrew - 06-29-2009, 02:22 PM
[EUO] Mining - by imported_Andrew - 06-29-2009, 06:22 PM
[EUO] Mining - by imported_Kamos - 06-29-2009, 07:23 PM
[EUO] Mining - by imported_Myrial - 06-30-2009, 10:56 AM
[EUO] Mining - by Eighty Swords - 08-05-2009, 07:13 AM
[EUO] Mining - by smoke - 08-12-2009, 10:46 AM
[EUO] Mining - by imported_Drama - 08-13-2009, 12:17 AM
[EUO] Mining - by imported_Drama - 08-13-2009, 01:42 AM
[EUO] Mining - by smoke - 08-13-2009, 08:29 AM
[EUO] Mining - by imported_Drama - 08-13-2009, 10:10 PM
[EUO] Mining - by smoke - 08-13-2009, 10:38 PM
[EUO] Mining - by imported_Malik - 08-13-2009, 11:34 PM
[EUO] Mining - by smoke - 08-13-2009, 11:54 PM
[EUO] Mining - by imported_LudaKrishna - 08-14-2009, 12:02 AM
[EUO] Mining - by imported_Drama - 08-14-2009, 12:45 AM
[EUO] Mining - by imported_Malik - 08-14-2009, 12:54 AM
[EUO] Mining - by imported_Drama - 08-14-2009, 12:59 AM
[EUO] Mining - by imported_LudaKrishna - 08-14-2009, 01:24 AM
[EUO] Mining - by smoke - 08-14-2009, 01:32 AM
[EUO] Mining - by imported_Papa Smurf - 08-14-2009, 02:17 AM
[EUO] Mining - by imported_Papa Smurf - 08-14-2009, 02:21 AM
[EUO] Mining - by Eighty Swords - 08-14-2009, 03:22 AM
[EUO] Mining - by imported_Papa Smurf - 08-14-2009, 03:45 AM
[EUO] Mining - by imported_Ryuuku - 08-14-2009, 04:12 AM
[EUO] Mining - by smoke - 08-14-2009, 05:01 AM
[EUO] Mining - by imported_Drama - 08-14-2009, 05:31 AM
[EUO] Mining - by imported_LudaKrishna - 08-14-2009, 05:41 AM
[EUO] Mining - by smoke - 08-14-2009, 06:15 AM
[EUO] Mining - by Eighty Swords - 08-14-2009, 02:11 PM
[EUO] Mining - by smoke - 08-14-2009, 10:18 PM
[EUO] Mining - by Eighty Swords - 08-15-2009, 03:47 AM
[EUO] Mining - by smoke - 10-03-2009, 04:44 PM
[EUO] Mining - by Eighty Swords - 10-13-2009, 01:01 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)