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

Easy UO Script: Mining at Mt. Kendall
#1

This is an Easy UO Script that is customized to work on Imagine Nation and won't work on other UO shards without editing.

You'll have to do some editing on this one, but this is a mining script for Mt. Kendall. It will mine, move to the forge when you're at your weight limit, smelt, then go back to mining. Once you're overweight with ingots, it will walk to the bank box outside, use it, then put all your ingots into a bag in the bank. Very useful, but it makes you a PK target and it tends to cut out sometimes:

Code:
; OzMining 1.0
;
; For mining at Mt. Kendall on IN:X shard.
;
; Features:
; - Moves around the mine randomly
; - Mines a tile clean of ore before moving on to next one
; - Smelting when overweight
; - Banking ore when you have certain amount of weight after smelting
;
; - Notifies you with a sound if your character is dead and stops the macro
;   ( might only work in windows xp.. )
;   ( replace sounds with some other ones if you use another OS. )
;
; Known bugs:
; - Macro gets "stuck" mining too fast sometimes
;
; ============= User variables and instructions ================================
; YOU WILL NEED TO CHANGE THE ID VALUES BELOW TO MATCH YOUR CHARACTERS CONTAINERS
; OR AUTOMATIC BANKING WON'T WORK CORRECTLY!

; You can find out ID of a container by having EUO running and opening a container.
; Right side of EUO window there should be "Container Info" as a folded menu and
; there #CONTID variable now holds the information. For example LHUGMMD

; Change this to the ID of container in your bank where you would like
; your ingots to be placed.
set %ingotContainer AXITEND

; Change this to whatever ID your bank container has.
set %bankcontainerID JWHLKMD

; ==============================================================================

set #LPC 10
set %forgePosX 2570
set %forgePosY 482
set %ingotTypes RMK_BVI
set %forgeTypes JBG_JJ_SMF
set %toolTypes QPF
set %status idle
set %bankID DMMRJMD
set %DebugMode #true

event sysmessage Starting OzMining 1.0

while #charghost <> YES
{
  if ( #WEIGHT > #MAXWEIGHT )
      gosub GoSmelt
  if %status = no_more_ore
  {
     set %status idle
     goto MoveToNextSpot
  }
  if ( #WEIGHT > #MAXWEIGHT )
     gosub GoSmelt
  set %jrnl #jindex
  gosub MineThisSpot
  gosub ProcessResults
}
; Player dead: stopping macro after making some racket..
sound Windows XP critical stop.wav
wait 2s
sound Windows XP critical stop.wav
wait 2s
sound Windows XP critical stop.wav
wait 2s
halt

sub MineThisSpot
  set #LPC 10
  if ( %status <> idle )
      return
  finditem %tooltypes C
  if #FINDCNT > 0
  {
    set #lObjectId #findId
    event macro 17 0
    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
  while %status = mining
  {
    if #jindex > %jrnl
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
      if you_dig_some in #journal
        set %status idle
      if you_loosen_some_rocks in #journal
        set %status idle
      if World_save_complete in #journal
        set %status idle
      if You_have_moved_too_far in #journal
        set %status idle
      if Someone_has_gotten in #journal
        set %status idle
      if Can't_mine_that in #journal
        set %status idle
      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 you_can't_mine_that in #journal
      {
        set %status no_more_ore
        gosub MoveToNextSpot
      }
      if world_save_complete. in #journal
      {
        set %status no_more_ore
        gosub MoveToNextSpot
      }
      if that_is_too_far_away in #journal
      {
        set %status no_more_ore
        gosub MoveToNextSpot
      }
      if for_validating_your_presence in #journal
      {
        set %status no_more_ore
        gosub MoveToNextSpot
      }
    }
  }
return

sub MoveToNextSpot
  set #LPC 1
  if ( %DegugMode )
      event sysmessage ++ Trying to find a new location to mine...

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 %GotoX %GotoX + %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 %GotoY %GotoY + %randomInc

  if ( %DegugMode )
      event sysmessage -- Initializing tile info...
  tile Init
  tile Get %GotoX %GotoY 2
  if ( %DegugMode )
      event sysmessage #tilename / #tiletype
  if ( #tilename = cave_floor )
  {
      if ( %DegugMode )
          event sysmessage Found cave location...
      event pathFind %GotoX %GotoY
      wait 10
      if ( #charposX = %oldX && #charposY = %oldY )
         goto FindNextSpot
  }
  if ( #charposX <> %oldX && #charposY <> %oldY )
      if ( #charposX = %GotoX && #charposY = %GotoY )
          set %status idle
  else
      goto FindNextSpot
  set #LPC 10
return

sub GoSmelt
  set #LPC 1
SmeltOre:
  set %oldX #charposX
  set %oldY #charposY

  event pathFind %forgePosX %forgePosY
  wait 1s
  if ( #charposX = %oldX && #charposY = %oldY )
      goto SmeltOre
CheckForMoreOre:
  finditem  DWJ C
  if #FINDCNT > 0
  {
      set #lObjectId #findId
      event macro 17 0
      goto CheckForMoreOre
  }
  wait 1s
  if ( #weight > #maxweight - 50 )
      gosub BankOre
GoBack:
  event pathFind %oldX %oldY
  wait 1s
  if ( #charposX = %forgePosX && #charposY = %forgePosY )
      goto GoBack
return

sub BankOre
  if ( %DegugMode )
      event sysmessage ++ Going to bank ingots...
BankingStep1:
  event pathFind 2561 492
  wait 1s
  if ( #CHARPOSX <> 2561 && #CHARPOSX <> 492 )
      goto BankingStep1
BankingStep2:
  event pathFind 2559 504
  wait 1s
  if ( #CHARPOSX <> 2559 && #CHARPOSX <> 504 )
      goto BankingStep2
BankingStep3:
  event pathFind 2564 513 15
  wait 1s
  if ( #CHARPOSX <> 2564 && #CHARPOSX <> 513 )
      goto BankingStep3
Openbank:
  set #LOBJECTID %bankID
  event macro 17 0
  wait 10
  if ( #CONTID <> %bankcontainerID )
      goto Openbank
BankMore:
  finditem %ingotTypes C
  if #FINDCNT > 0
  {
      Exevent Drag #findid #findstack
        wait 10
        Exevent Dropc %ingotContainer
        wait 10
        goto BankMore
  }
  wait 1s
  event sysmessage ++ Going back...
GoingBackStep1:
  event pathFind 2559 504 0
  wait 2s
  if ( #CHARPOSX <> 2559 && #CHARPOSX <> 504 )
      goto GoingBackStep1
GoingBackStep2:
  event pathFind 2561 492
  wait 2s
  if ( #CHARPOSX <> 2561 && #CHARPOSX <> 492 )
      goto BankingStep2
GoingBackStep3:
  event pathFind %forgePosX %forgePosY
  wait 2s
  if ( #CHARPOSX <> %forgePosX && #CHARPOSX <> %forgePosY )
      goto GoingBackStep3
  set #LPC 10
return
#2

It doesn't open my bankbox I set the correct ID, after i open it manually it continues working...
#3

Hmm try changing %bankID to NFUMKMD

If it works let me know and I will update the script.
#4

it didn't work =/
#5

I had the same problem, so now I stop the script manually do that part then restart it. Also still can't get it to go to the forge I have to manually do that as well.
I set all the id's right, have my paper doll, backpack, status bar open, journal open can't think of anything else to do.
#6

The thing is, with the bank box, you're not going to want to set it by container ID. The container ID is *YOUR* bank box, not the Bank Box outside Mt. Kendall. You'll need to get that item's ID instead. I forget how to do that exactly, but hopefully that points you in the right direction. I'll have to mess with it later. Gottta go now.
#7

%bankcontainerID is your bank container ID

%bankID is the ID of the chest which you doubleclick to open your bank.

%bankID should be NFUMKMD and %bankcontainerID should be the ID of your bank.
#8

There was a forge located in the middle on INX so forge position is wrong. You might need to adjust that part of the script. Even if you set forge position right it might not be able to go there directly if the location is off screen so it's bound to jam eventually. Also, the pathfinding sucks on this version so that might get you stuck too. The version that had a subroutine named MoveTo which handled movement is more reliable. That version might still be somewhere around old INX forums.
#9

I have the variable corrclty set and it still doesn't open the bank container
#10

I changed the occurrences of the %abankID var to its value and it works but haven't checked what the problem is.
#11

I'll bet you have an old version of EUO. Sometimes I have some script that refuses to run and I just update EUO and it works. You might try that.

http://download.easyuo.com/cheffe/euox196.zip
#12

i don't think its that old... 1.5 191


Forum Jump:


Users browsing this thread: 2 Guest(s)