;==================================
; Script Name: Runebook Mining
; Author: Spewy
; Version: 3.5
; Client Tested with: 5.0.1c
; EUO version tested with: 1.5 build 62
; Shard OSI / FS: OSI Tested
; Revision Date: October 19th, 2005
; Public Release: September 16th, 2003
; Purpose: Efficient mining with the use of runebooks and pack animal
;==================================
GoSub InitializeRuneBookMiningBySpewy; Do not change/remove this line
Set %UseInteractiveSetup #true; ******* Set to #false to manually set the values for variables ******
If %UseInteractiveSetup
GoSub InteractiveDefaults
; ********* MANUAL ENTRY OF VARIABLES ***************
If ! %UseInteractiveSetup
{
LinesPerCycle %lpsFast
;*********** REQUIRED Variables ******************
; ---------- Backpacks and Home Base Setup ----------
Set %BaseRunebook XXXXXXX; Set this to the ID of your House or Bank Runebook
Set %NumBaseRunes 2; *** NEW *** Set the Total Number of Base runes to randomly use
Set %BaseRune1 5; The position of the house/bank rune in the runebook (1=First rune, 16=last rune)
Set %BaseRune2 6; An alternative rune just in case your first one is blocked (1=First rune, 16=last rune)
; For House Drop-off
Set %SecureId XXXXXXX; Set to your HOUSE Secure ID (best if on stairs 2 squares away from recall spot)
Set %BankDrop #false; Drop ore at the bank? #true = Bank, #false = House (Default)
Set %OreBagId XXXXXXX; Set to the backpack id INSIDE your bank or house secure (Needed: House and Bank)
;---------- Mining Runebook Setup --------------------
; GoSub AddRunebook <RuneBook ID> <# of Mining Runes> [Color] [External Definition Filename]
; GoSub AddRunebook XXXXXXX 16
; Examples: (!!! Make sure you delete the semicolon ';' !!!) (!!! Filename must not contain spaces !!!)
; GoSub AddRunebook XXXXXXX 14 %Valorite SpewRunes.euo
; GoSub AddRunebook XXXXXXX 11 %Verite SpewRunes.euo
; GoSub AddRunebook XXXXXXX 16 %Agapite SpewRunes.euo
; *** LOOK FOR *** SetDigLocations subroutine to enter your mining locations
;********* OPTIONAL Variables *********
;---------- Bonded Packhorse/Packllama Setup ----------
Set %UsePackAnimal #false; Use #true to use a bonded pack animal, #false otherwise
Set %PackAnimalId XXXXXXX; The pack animal ID (use a dagger on it and look at #lTargetId)
Set %PackAnimalBagId XXXXXXX; The Container ID of the pack animal backpack (Open Pack and use #ContId value)
Set %PackAnimalDropId XXXXXXX; Backpack INSIDE pack animal backpack where the ore will be unloaded
;---------- Miscellaneous Variables ----------
Set %MaxWeight 360; Set this to the weight you would like to stop digging at 400 for trammel 380 for felluca
Set %RegSuit #false; #false = Restock regeants, #true = Do not need regeants
Set %MineUseTime 15; Time between shovel usage is much smaller (For 'You must wait...' messages while mining set this higher)
Set %UseTime 23; The wait between item usage other than shovels (For 'You must wait...' message when not mining set this higher)
Set %HideMineInFel #true; *** NEW *** Hide when mining in Feluca only
Set %HideMineElsewhere #false; *** NEW *** Hide when mining even when not in Fel
Set %HideWhileManaWait #true; *** NEW *** Hide when you are waiting for mana to regenerate
Set %HideOnPackUnload #true; *** NEW *** Hide when you unload to the pack animal
Set %HideOnBaseUnload #true; *** NEW *** Hide when you unload to your bank/house
Set %ShowStatus #true; Show the status window while mining (Really should be #true, pause/escape button are on the status window)
Set %MinShovels 2; Set to the minimum number of shovels to carry when leaving Bank/House (Use up all those damn sturdy shovels)
Set %UseTinkering #true; In case you don't have enough tinkering to make shovels (Make sure you set %MinShovels
Set %MakeTwoShovels #true; Make 2 shovels when you have to make a shovel
Set %UseAnyColourIngot #false; *** NEW *** Change this to true if you want the script to pickup coloured ingots from your bank/secure to tinker with
Set %TravelMethod 0; *** NEW *** Change this to True for Magery, False for Chivalry
Set %GiveUpTime 20; # of *seconds* of no successful mining strikes before script moves to the next mining spot
;---------- Walking directions to House Secure after Recall ---------------
Set %StandLocationX 0; Set these three variables to #CharPosX, #CharPosY, #CharPosZ when you have your
Set %StandLocationY 0; character standing in the spot close enough to unload the ore
Set %StandLocationZ -1
Set %DoorID XXXXXXX; To use a door heading to %StandLocation, provide the ID of the door (double click door, use #LObjectID)
Set %DoorUseX 0; Set these three variables to #CharPosX, #CharPosY, #CharPosZ when you have your
Set %DoorUseY 0; character standing in the spot close enough open the door
Set %DoorUseZ -1
;---------- Enemy Detection and Evasion ---------------
Set %RedEscape #true; Run the escape sequence if a red is detected
Set %RedCheckNPC #false; Take extra time to see if Red found is a Red Healer
Set %TrackPackAnimal #true; If your pack animal (if used) moves away from you, the escape sequence is run
Set %EscapeOnMonsterSighting #true; #true: When a monster targets you, the script will try to escape (even before damage is done)
Set %HighThreatMonster N/A; Upon the sighting of the specified monsters you will immediately try to escape
Set %NoThreatMonster GD; (Corpsers, Reapers) Specified monsters will not cause an escape attempt (will still escape on damage)
Set %PauseAfterEscape #false
Set %EscapeOnDamage #true; #true: Run the Escape sequence when you take more than %DamageThreshold damage
Set %DamageThreshold 10; the amount of damage before the escape is triggered [Fixes the escape problem caused by items that increase Hit Points]
Set %EscapeRecallTarget XXXXXXX; ID of runebook or rune to target when you click on the ESCAPE button.
; Leave as is and script will open house runebook and recall from there
; Spewy sets this to %BaseRunebook and in UO sets the runebook default rune to be the house rune.
Set %MinutesBeforeReturn 20; Minutes to avoid the dangerous rune location (NOT TESTED, PLEASE POST IF IT WORKS)
Set %CureWithMagery #true; Attempts to cast Cure after an escape attempt (after you press Run Macro after the pause)
Set %GrHealAfterEscape #true; Attempts to cast Greater Heal after an escape attempt (after you press Run Macro after the pause)
Set %WaitForMana #true; Make sure you have enough mana to recall to and recall out of a mining location (32 mana)
Set %MountBeforeRecall #true; #true to mount your beetle before recalling to a mining location (less chance of loosing the beetle especially if you have hiding)
;---------- Mining Filter Setup ---------------
Set %BringUpMenuForFilters #true; Brings up a selection menu for which colors to mine, and prospect
Set %UseProspector %NoColor; Add (literally +) all the colors you want prospected !!! Spaces between everything are required !!!
Set %MineFor %AllColors; Add (using +) all the colors you wish to mine (filters runebooks used)
; Color Variables:
; %AllColors, %NoColor, %Iron, %Dull, %Shadow, %Copper %Bronze, %Gold, %Agapite, %Verite, %Valorite, and %UnknownColor
; Examples:
; Set %UseProspector %UnknownColor + %Dull + %Bronze + %Agapite; Prospect Dull Copper, Bronze, Agapite and any unlabelled runebooks
; Set %MineFor %AllColors; Use all runebooks
; Set %MineFor %Bronze + %Gold; Use Bronze and Gold runebooks ('Set %UseProspector %Bronze' and you only get Gold ore)
;---------- Mining Efficiency Variables ------------
; These variables are intended for people wanting to increase mining efficiency as much as possible.
; Choosing good mining locations (w/ multiple veins per rune) will yield easy improvements
Set %DumpIron #true; #true results in large IRON ore to be dropped on exisint piles of ore within reach
; Note: I manually place large iron ore in a visible spot 2 squares from me (saw 12% improvement))
Set %NextRuneOnBaseUnload #true; #true results in recalling to the next rune after Unloading to Bank/House [Suggested by Paton]
; This is displayed on the the status window (Keep track of your mining efficiency)
Set %TrackGPValue %ShowStatus; Tracks how much gold (equivalent) you have mined based on the ore evaluation set below
;---------- Logging Variables ----------
; [REQUIRES: ALLOW EXECUTE and the file Save.js, saves to MiningSpots.txt]
Set %LogMiningResults #false; Saves how many large color/iron ore is mined at each mining location
;------------- Siege Support -------------
Set %CastGate #false
; Set %UseGateScrolls #false; Support in future versions
;---------- UOAssist Integration Setup ----------
; For these variables Key is the keystroke (A-Z, 0-9, F1 to F12) and the Mod comes from the list of EUO's Key function (Alt, Ctrl, Shift)
; *** NOTE *** This area was not tested, please report any problems *** NOTE ***
; Tinker Tool creation UOA macro (Should Use Item Type (tinker tools), Choose Tinker Tool, Close Tinker Menu)
Set %UOATinkerToolKey N/A
Set %UOATinkerToolMod N/A
Set %UOATinkerToolWait 10s
; Shovel creation UOA macro (Should Use Item Type (tinker tools), Choose Shovel, Close Tinker Menu)
Set %UOAShovelKey N/A
Set %UOAShovelMod N/A
Set %UOAShovelWait 10s
; Escape UOA macro key (If this is defined, the Escape button will press this key and then pause the script)
Set %UOAEscapeKey N/A
Set %UOAEscapeMod N/A
LinesPerCycle %lpsNormal
}
;********* User Defined Digging Locations Setup *******************************
Sub SetDigLocations
GoSub RunExternalDefinitions; Do not change/remove this line
; You can define multiple mining spots (veins) per recall location (rune). Undefined mining locations will only work in a cave (it mines at your feet)
; There is a howto post on the thread for this script on how to set this up
GoSub FindRunebook XXXXXXX; or %_RuneBook1 if you used the Interactive Setup and do not know the IDs
Set %sdlBook %return
if %sdlBook > 0
{
; SetUserDigCoord - *** Specify world coordinate mining locations ***
; Mine the location then use #LTargetX, #LTargetY, #LTargetZ, #LTargetKind #LTargetTile in EUO (Ctrl-R to View variables)
;
; GoSub SetUserDigCoord <RuneBook Index> <Rune Index 1-16> <#lTargetX> <#lTargetY> <#lTargetZ> <#lTargetKind> <#lTargetTile>
; Look at [url=http://www.easyuo.com/forum/viewtopic.php?t=200]http://www.easyuo.com/forum/viewtopic.php?t=200[/url] for tutorial on how to set these up
}
GoSub FindRunebook XXXXXXX; or %_RuneBook2
Set %sdlBook %return
if %sdlBook > 0
{
; See above
}
Return
;*******************************************************
;******** DONT CHANGE ANYTHING PAST HERE
;*******************************************************
LinesPerCycle %lpsFast
Set %FixForUORecallBug #false; I left this in here just in case the UO Bug hasn't been fixed
Set %HaveTargetted #false
Set %HaveProspected #false
Set %LastMadeWasShovel #false
Set %BackpackId null
Set %IsMounted #true
Set %UsingBeetle #true
Set %LastEnemyID #enemyID
Set %gNeedsCoordConv #false
Set #sCnt2 0
Set #sCnt 0
Set %_uowLastUse #scnt2
Set %TryHideAgain 0
Set %LogTimeUsage #false; Log how much time major operations take and when they happen (Optimize the script, so internal use)
ChooseSkill tink
Set %TinkerSkill #skill
GoSub SetDigLocations
LinesPerCycle %lpsNormal
;*****************************************
;******** Start Up Code
;*****************************************
GoSub MineForMenu
Set %iRune 1
Set %iSpot 1
Set %iRuneBook 0
GoSub CheckInit
GoSub IncrementRuneBook
GoSub CreateStatusWindow
;*****************************************
;******** Main Loop
;*****************************************
GoSub RecordTimingComment Starting...
MainLoop:
GoSub RecallMine
CheckShovel:
GoSub FindShovel
If %return = Escape
{
GoSub Escape
Goto MainLoop
}
GoSub Digger
If %return = Escape
GoSub Escape
If %return = CheckShovel
goto CheckShovel
goto MainLoop
;*****************************************
;******** Tinkering
;*****************************************
; ** FindShovel **
; Tries to find a shovel, if non are found will initial
; tinkering or recall back to home base
Sub FindShovel
GoSub UpdateStatusWindow FindShovel
FindShovelStart:
GoSub CheckEscapeStatus
If %CheckEscapeStatus
Return
GoSub FindUsableMiningTool %BackpackId
If #FindId = X
{
if %UseTinkering
{
If %TinkerSkill >= 900
Set %_fsIngotsNeeded 10
Else
Set %_fsIngotsNeeded 20
FindItem %IngotType C_ , %BackpackId
If #FindKind = -1 || #FindStack < %_fsIngotsNeeded
GoSub UnloadAtBase #false
GoSub MakeShovel
Goto FindShovelStart
}
if ! %UseTinkering
{
GoSub UnloadAtBase #false
Goto FindShovelStart
}
}
Return
; ** MakeShovel **
; Will make 1-2 shovels using tinkering - Using the menus or
; UOA macros if they have been setup
Sub MakeShovel
GoSub CheckEscapeStatus
If %CheckEscapeStatus
Return
Set %_msTimeStart #sCnt2
GoSub UpdateStatusWindow MakeShovel
FindItem %TinkerType C_ , %BackpackId
Wait 5
If #FindKind <> -1 && #FindCnt = 1
{
If %UOATinkerToolKey <> N/A
{
Key %UOATinkerToolKey %UOATinkerToolMod
Wait %UOATinkerToolWait
}
If %UOATinkerToolKey = N/A
{
GoSub BringUpTinkerMenu #FindId
Wait 10
GoSub ClickTinkerButton 30 110
If %return
GoSub ClickTinkerButton 230 130
Set %LastMadeWasShovel #false
}
}
FindItem %TinkerType C_ , %BackpackId
If #FindKind <> -1
{
If %UOAShovelKey <> N/A
{
Key %UOAShovelKey %UOAShovelMod
Wait %UOAShovelWait
}
If %UOAShovelKey = N/A
{
GoSub BringUpTinkerMenu #FindId
If %LastMadeWasShovel; If the last thing we made was a shovel, its easy!
GoSub ClickTinkerButton 285 410
If ! %LastMadeWasShovel
{
GoSub ClickTinkerButton 30 110
If %Return
{
GoSub ClickTinkerButtonNext
GoSub ClickTinkerButton 230 70
}
}
If %return
{
Set %LastMadeWasShovel #true
If %MakeTwoShovels
GoSub ClickTinkerButton 285 410
}
}
Set %_msCancelX #ContPosX + 10
Set %_msCancelY #ContPosY + 10
Click %_msCancelX %_msCancelY R; Close tinker menu
}
GoSub RecordTiming %_msTimeStart MakeShovel
Return
; ** ClickTinkerButton **
Sub ClickTinkerButton
Set %_ctbX %1 + #ContPosX
Set %_ctbY %2 + #ContPosY
Click %_ctbX %_ctbY
Gosub waitForSysVar contSize <> 530_465 30
Gosub waitForSysVar contSize = 530_465 30
Wait 5
Return
; ** ClickTinkerButtonNoWait **
Sub ClickTinkerButtonNext
Set %_ctbnX 385 + #ContPosX
Set %_ctbnY 270 + #ContPosY
Click %_ctbnX %_ctbnY F
Wait 2s
Return
; ** BringUpTinkerMenu **
; Lag resistant opening of tinker menu
; Parameter 1: ID of tinker tool
Sub BringUpTinkerMenu
Set %_butmTinkerTool %1
Wait 5; A lot of times the tinker tool usage get 'You must wait...'
_butmTinkerMenu:
GoSub UseObject %_butmTinkerTool #false #false
Gosub waitForSysVar contSize = 530_465 30
if ! %return
goto _butmTinkerMenu
Return
;*****************************************
;******** Digging routines
;*****************************************
; ** Digger **
; The main digging sub, this is called (at least) once per mining
; location. It will prospect, hide, mine, unload to pack, unload to base
; Returns: GotoNextLocation. StayAtLocation, CheckShovel
Sub Digger
_diggerStart:
Set %_diggerLastStrike #sCnt
Set %_diggerNoReponse #false
; Give the reds less time to react, as soon as we come in, check if they are around and hide before dismounting
GoSub CheckEscapeStatus
If %CheckEscapeStatus
Return
If ( ( %HideMineInFel && #cursKind = 0 ) || ( %HideMineElsewhere && #cursKind <> 0 ) ) && ( H notin #CharStatus ) && #scnt > %TryHideAgain
{
Event Macro 13 21
Set %TryHideAgain #scnt + 12
}
GoSub ShouldProspect
Set %_digShouldProspect %return
If ! %_digShouldProspect
GoSub DismountBeetle
_diggerLoop:
GoSub UpdateStatusWindow Digging
GoSub CheckEscapeStatus
If %CheckEscapeStatus
Return
If ( ( %HideMineInFel && #cursKind = 0 ) || ( %HideMineElsewhere && #cursKind <> 0 ) ) && ( H notin #CharStatus ) && #scnt > %TryHideAgain
{
Event Macro 13 21
Set %TryHideAgain #scnt + 12
}
If ! %HaveTargetted && %_digShouldProspect
GoSub MountBeetle
GoSub FindUsableMiningTool
GoSub UseObject #Result %HaveTargetted #true
Set %_digShovelUsed ( %return <> Blocked )
if %_digShovelUsed
{
GoSub TargetMiningLocation
If %return = Failed
{
Set %return CheckShovel
Return
}
}
LinesPerCycle %lpsFast
GoSub CheckEscapeStatus
If %CheckEscapeStatus
Return
GoSub CheckProgress
Set %CheckProgress %return
If %CheckProgress = Success
{
If %gNeedsCoordConv
GoSub RedefineDigSpot
Set %_diggerLastStrike #sCnt
Set %_diggerNoReponse #false
}
If %CheckProgress = MustWait
goto _diggerLoop
If %CheckProgress = Dismount
{
Set %_diggerNoReponse #false
GoSub DismountUnexpected
}
If %CheckProgress = NoResult
Set %_diggerNoReponse #true
If %CheckProgress = GotoNextLocation || %CheckProgress = CheckShovel
Return
If %CheckProgress = StayAtLocation
Goto _diggerStart
If ( %_diggerLastStrike + %GiveUpTime < #sCnt )
{
GoSub IncrementRuneIndex
Set #MenuButton N/A
If %return = GotoNextLocation
Return
If %return = StayAtLocation
Goto _diggerStart
}
LinesPerCycle %lpsNormal
If %_digShovelUsed && %_digShouldProspect && ! %HaveProspected
{
GoSub CheckEscapeStatus
If %CheckEscapeStatus
Return
GoSub UpdateStatusWindow Prospecting
FindItem %ProspType C_ , %BackpackId
If #FindKind <> -1
{
GoSub UseObject #FindId #false #false
GoSub TargetMiningLocation
GoSub DismountBeetle
}
Set %HaveProspected #true
}
goto _diggerLoop
return
Sub CountUsableMiningTool
Set %_cumtCount 0
_cumtLoop:
FindItem %DiggingTools C_ , %BackpackId
If #FindKind <> -1
{
GoSub IsUsableMiningTool
If #Result
Set %_cumtCount %_cumtCount + 1
IgnoreItem #FindId
goto _cumtLoop
}
IgnoreItem Reset
Return %_cumtCount
Sub FindUsableMiningTool
_fumtLoop:
FindItem %DiggingTools C_ , %BackpackId
If #FindKind <> -1
{
GoSub IsUsableMiningTool
If ! #Result
{
IgnoreItem #FindId
goto _fumtLoop
}
}
IgnoreItem Reset
Return #FindId
Sub IsUsableMiningTool
If #FindType notin %PickAxe || #FindCol <> 0
Return #true
GoSub EventProperty #FindId
Return ( Gargoyle notin #Property )
Sub EventProperty
Event Property %1
Set %_propTimeout #sCnt + 4
_propLoop:
If #Property = 0 && #sCnt < %_propTimeout
goto _propLoop
Return
; ** TargetMiningLocation **
; Gets the mining target for this location, waits for the target cursor
; and actually does the targetting
; Returns: Failed, Success
Sub TargetMiningLocation
target 2s
If #TargCurs = 0
{
Set %return Failed
Return
}
Set %isClickLoc #true
If ! %HaveTargetted
{
GoSub GetUserDigLocation %iRuneBook %iRune %iSpot
if %return = InCoords
Set %isClickLoc #false
if %return <> InCoords
Set %gNeedsCoordConv #true
}
_tmlTargetAgain:
If #TargCurs = 1
{
If %HaveTargetted
Event Macro 22 0
If ! %HaveTargetted
{
if %isClickLoc
Click %DigSpotX %DigSpotY d
if ! %isClickLoc
{
Set #LTargetX %DigSpotX
Set #LTargetY %DigSpotY
Set #LTargetZ %DigSpotZ
Set #LTargetKind %DigSpotKind
Set #LTargetTile %DigSpotTile
Event Macro 22 0
}
}
Goto _tmlTargetAgain
}
Set %HaveTargetted #true
Set %return Success
Return
;*****************************************
;******** Check mining progress
;*****************************************
; ** CheckProgress **
; Checks weight and initiates unload, mining failur attempts, and report whether
; mining is progressing
; Returns: Success, GotoNextLocation, StayAtLocation, Dismount, MustWait
Sub CheckProgress
Set %return Unknown
If #Weight > %MaxWeight
{
If %UsePackAnimal
GoSub UnloadToPackAnimal
If ! %UsePackAnimal
GoSub UnloadAtBase #false
}
for %_cpIndex 1 4
{
ScanJournal %_cpIndex
if #journal = N/A
Return
If ( you_dig_some in #journal ) || ( you_loosen_some_rocks in #journal )
{
Set %return Success
Goto _cpReturn
}
If ( There_is_no_metal_here_to_mine in #journal ) || ( that_is_too_far_away in #journal ) || ( you_can't_mine_that in #journal ) || ( you_can't_mine_there in #journal ) || ( you_cannot_see_that_location in #journal )
{
GoSub IncrementRuneIndex
Goto _cpReturn
}
If mine_while_riding in #journal
{
Set %return Dismount
Goto _cpReturn
}
If You_must_wait in #journal
{
Set %return MustWait7
Goto _cpReturn
}
If ( #Weight > %MaxWeight ) || ( Your_backpack_is_full in #journal )
{
Set %_cpReturnValue %return
If %UsePackAnimal
GoSub UnloadToPackAnimal
If ! %UsePackAnimal
GoSub UnloadAtBase #false
Set %_diggerLastStrike #sCnt
Goto _cpReturn
}
}
Return
_cpReturn:
deletejournal
Return
;*****************************************
;******** Enemy Detection and Evasion
;*****************************************
; ** Escape **
; Does its best attempt to recall away. If successful it will attempt
; to cure and heal before going to the next rune
Sub Escape
_escapeTryRecallAgain:
Set %_escapeLocationX #charPosX
Set %_escapeLocationY #charPosY
Set #MenuButton N/A
If %UOAEscapeKey = N/A
{
If %EscapeRecallTarget <> XXXXXXX
{
wait 30
GoSub RecallWithoutRunebook %EscapeRecallTarget
}
If %EscapeRecallTarget = XXXXXXX
GoSub Travel %BaseRunebook %BaseRune1 %TravelMethod #true
}
If %UOAEscapeKey <> N/A
Key %UOAEscapeKey %UOAEscapeMod
GoSub UpdateStatusWindow Escape
GoSub GetUserAttention Emergency
If %PauseAfterEscape
{
; Press [Play] when you are safe at your escape destination
pause
; Press [Play] when you are safe at your escape destination
}
Else
{
Set %_escapeRecallTimeout #sCnt + 10
_escapeCheckRecall:
If #sCnt > %_escapeRecallTimeout
{
GoSub CheckForConnDeath
Goto _escapeTryRecallAgain
}
If %_escapeLocationX = #charPosX && %_escapeLocationY = #charPosY
Goto _escapeCheckRecall
}
GoSub IncrementRuneIndex 1
Set %LastEnemyID #enemyID
If %UsePackAnimal
Msg All Follow Me$
Wait 1s; Allow time for recall and character information to populate (#charStatus)
Set %_escapeCureAttempt 0
_escapeCheckPoison:
If %CureWithMagery && %_escapeCureAttempt < 7 && ( C in #charStatus )
{
If %TravelMethod = 0
event macro 15 201
Else
event Macro 15 10
Target 6s
event Macro 23 0
Wait 2s
Set %_escapeCureAttempt %_escapeCureAttempt + 1
Goto _escapeCheckPoison
}
If C in #charStatus
{
GoSub GetUserAttention Emergency
Display OK You must cure yourself to continue (Press Play After)
Pause
Goto _escapeCheckPoison
}
Set %_escapeHealAttempt 0
_escapeCheckHP:
If %GrHealAfterEscape && %_escapeHealAttempt < 7 && ( #hits < #MaxHits )
{
If %TravelMethod = 0
event Macro 15 202
Else
event Macro 15 28
Target 6s
event Macro 23 0
Wait 10
Set %_escapeHealAttempt %_escapeHealAttempt + 1
Goto _escapeCheckHP
}
If #hits < #MaxHits
{
GoSub GetUserAttention
Display OK You must heal yourself to full to continue (Press Play After)
Pause
Goto _escapeCheckHP
}
If ! %BankDrop
{
FindItem %SecureId G_2
If #FindKind <> -1
GoSub UnloadAtBase #true
}
Return
; ** CheckEscapeStatus **
; Looks if there are reasons for the script to escape. Reds, damage, pack animal moving
; Returns: Escape, N/A
Sub CheckEscapeStatus
Set %return N/A
If %ShowStatus && #MenuButton = Escape
{
Set %return Escape
Set %escapeReason User , #spc , Request
}
If %EscapeOnDamage && #Hits + %DamageThreshold < #MaxHits
{
Set %return Escape
Set %escapeReason Damage
}
If %RedEscape && %return = N/A && #cursKind = 0
{
_cesSearch:
FindItem NAB_OAB_HS_IS
If #FindKind <> -1
{
If #FindRep <> 6 || #FindId = #CharID || #FindId in #CharID
{
IgnoreItem #findId
Goto _cesSearch
}
If %RedCheckNPC
{
}
Set %return Escape
Set %escapeReason Red , #spc , Sighted
}
}
If %HighThreatMonster <> N/A
{
_cesSearch2:
FindItem %HighThreatMonster
If #FindKind <> -1
{
If #FindId = #CharID || #FindId in #CharID
{
IgnoreItem #findId
Goto _cesSearch2
}
Set %return Escape
Set %escapeReason Monster , #spc , Threat
}
}
If %TrackPackAnimal && %UsePackAnimal && %return = N/A && ! %IsMounted
{
FindItem %PackAnimalId
If #FindDist > 1
{
Set %return Escape
Set %escapeReason Packy , #spc , Left
Msg All Follow Me$
}
}
If %EscapeOnMonsterSighting && %LastEnemyID <> #enemyID
{
Set %LastEnemyID #enemyID
FindItem %LastEnemyID
if #FindType notin %NoThreatMonster
{
Set %return Escape
Set %escapeReason Monster , #spc , Target
}
}
Set %CheckEscapeStatus ( %return <> N/A )
If ! %CheckEscapeStatus && %ShowStatus && #MenuButton = PauseBut
{
GoSub HandlePauseButton
}
Return
;*****************************************
;******** UnloadAtBase
;*****************************************
; ** UnloadAtBase **
; Unloads ore at the house or bank, recalls to the location, opens up all the containers
; moves all the ore to the bag then picks up whatever is needed (ingots, shovels, prosp tools)
; Parameter 1: boolean Need to recall or not
Sub UnloadAtBase
Set %AlreadyAtBase %1
If ! %AlreadyAtBase
{
GoSub CheckEscapeStatus
If %CheckEscapeStatus
Return
If %MountBeforeRecall
GoSub MountBeetle
Set %_uabBaseRuneIndex ( #Random % %NumBaseRunes ) + 1
Set %_uabTimeStart #sCnt2
_uabStart:
GoSub Travel %BaseRunebook %BaseRune . %_uabBaseRuneIndex %TravelMethod #true
if %return = Blocked
{
Wait 6s
Set %_uabBaseRuneIndex %_uabBaseRuneIndex + 1
if %_uabBaseRuneIndex > %NumBaseRunes
Set %_uabBaseRuneIndex 1
Goto _uabStart
}
}
If %UsePackAnimal
{
GoSub DismountBeetle
Msg All Follow Me$
If ! %AlreadyAtBase
Wait 1s
}
If %StandLocationX <> 0
{
GoSub UpdateStatusWindow MoveToPosition
If %DoorID <> XXXXXXX
{
_uabRetryPFDoor:
GoSub PathFind %DoorUseX %DoorUseY %DoorUseZ 6
if ! %Return
goto _uabRetryPFDoor
GoSub UseObject %DoorID #false #false
}
_uabRetryPFSecure:
GoSub PathFind %StandLocationX %StandLocationY %StandLocationZ 6
If ! %Return
goto _uabRetryPFSecure
}
GoSub UpdateStatusWindow UnloadingToBase
GoSub UpdateMiningResults
GoSub OpenAnyContainer PaperDoll #CharID 534 1 5
GoSub OpenAnyContainer Backpack %BackpackId 650 335 5
If %BankDrop
{
GoSub OpenAnyContainer Bank N/A 27 49 5
Set %_uabSecureId #ContId
}
If %HideOnBaseUnload && H notin #CharStatus
Event Macro 13 21
If ! %BankDrop
{
FindItem %SecureId G
If #FindDist > 2
Move #findX #findy 2 5s
GoSub OpenAnyContainer Container %SecureId 27 49 5
Set %_uabSecureId %SecureId
}
FindItem %OreBagId
If #FindKind = -1
{
Display OK Cannot find Backpack in Bank Box/House Secure to drop off ore.$Is it missing or has it not been specified correctly (OreBagId).$$The script will now stop.
Halt
}
If %UsePackAnimal
{
GoSub OpenAnyContainer Container %PackAnimalBagId 40 480 5
;FindItem %PackAnimalDropId C_ , %PackAnimalBagId
;GoSub OpenAnyContainer Container #FindId 265 490 5
GoSub DragAnyItem %OreTypes #true %PackAnimalBagId All %OreBagId %TrackGPValue
GoSub DragAnyItem %GraniteType #true %PackAnimalBagId All %OreBagId #false
GoSub DragAnyItem %OreTypes #true %PackAnimalBagId All %OreBagId %TrackGPValue
}
GoSub DragAnyItem %OreTypes #true %BackpackId All %OreBagId %TrackGPValue
GoSub DragAnyItem %GraniteType #true %BackpackId All %OreBagId #false
If %UseProspector <> %NoColor
{
FindItem %ProspType C_ , %BackpackId
If #FindKind = -1
{
GoSub DragAnyItem %ProspType #true %_uabSecureId 1 #charid #false
If %return = NoneFound
{
Display YesNo Could not find any prospector's tools at the top of your bank/secure container.$$Would you like to continue without the use of a prospector's tool?
If #DispRes = No
Halt
Set %UseProspector %NoColor
}
}
}
if %UseTinkering
{
_uabMoreIngots:
FindItem %IngotType C_ , %BackpackId
If #FindKind = -1 || #FindStack < 40
{
GoSub DragAnyItem %IngotType %UseAnyColourIngot %_uabSecureId 60 %backpackid #false
If %return = NoneFound
{
Display YesNo Could not find any ingots at the top of your bank/secure container.$
+Without more you will not be able to continue mining (can't make shovels)$$
+Would you like to have 20 seconds to place some ingots at the top of your secure?
If #DispRes = No
Halt
Wait 20s
Goto _uabMoreIngots
}
}
}
_uabShovelLoop:
GoSub CountUsableMiningTool
If #Result < %MinShovels
{
GoSub DragAnyItem %DiggingTools #true %_uabSecureId 1 %BackpackId #false
If %return = NoneFound
{
If %UseTinkering
goto _uabBreakShovelLoop
Display YesNo Could not find any shovels at the top of your bank/secure container.$
+You won't be able to continue without more.$$
+Would you like to have 15 seconds to place shovels where script can find them?
If #DispRes = No
Halt
Wait 15s
}
Goto _uabShovelLoop
}
_uabBreakShovelLoop:
If ! %RegSuit
{
GoSub PickupReagent %MandrakeRoot Mandrake %_uabSecureId
GoSub PickupReagent %Bloodmoss Bloodmoss %_uabSecureId
GoSub PickupReagent %BlackPearl Black , #spc , Pearl %_uabSecureId
}
Event Macro 9 1; Close PaperDoll
GoSub SetStartOre #false
GoSub RecordTiming %_uabTimeStart UnloadToBase
If ! %AlreadyAtBase
{
If %NextRuneOnBaseUnload
GoSub IncrementRuneIndex 1
GoSub RecallMine
}
Return
; ** PickupReagent **
; A support function to remove duplicate code
; Parameter 1: ITEM_TYPE Type for Reagent
; Parameter 2: STRING Name of Reagent for user displayed dialog
; Parameter 3: ITEM_ID The container to look for reagents
Sub PickupReagent
Set %_prRegType %1
Set %_prRegName %2
Set %_prSecureId %3
FindItem %_prRegType C_ , %BackpackId
If #findkind = -1 || #findstack < 20
{
_prMoreIngots:
GoSub DragAnyItem %_prRegType #true %_prSecureId 30 %BackpackId #false
If %return = NoneFound
{
Display YesNo Could not find any , #spc , %_prRegName , #spc , at the top of your bank/secure container.$
+You won't be able to continue without more.$$
+Would you like to have 15 seconds to place some regs at the top of your secure?
If #DispRes = No
Halt
Wait 15s
Goto _prMoreIngots
}
}
Return
;*****************************************
;******** Pack Animal Routines
;*****************************************
; ** UnloadToPackAnimal **
; Unloads ore from the backpack to the pack animal (uses DragAnyItem to do the work)
Sub UnloadToPackAnimal
Set %_utpTimeStart #sCnt2
GoSub UpdateStatusWindow UnloadToPack
GoSub UpdateMiningResults
Set %_utpaUnload #false
_utpaStart:
FindItem %PackAnimalId
If #FindKind = -1
Set %_utpaUnload #true
If #FindKind <> -1
{
If #FindDist > 1
{
Msg All Follow Me$
Wait 1s
Goto _utpaStart
}
If %HideOnPackUnload && ( H notin #CharStatus ) && #scnt > %TryHideAgain
{
Event Macro 13 21
Set %TryHideAgain #scnt + 12