Easy UO Script: Mining - Updated! -
Atlas - 02-20-2012
A gift for you slimey bichez.
Copy and paste this into EasyUO for an updated version of the popular OzMining for Imagine Nation.
Follow
all of the instructions! I left plenty of comments in there to make things easier to understand (hopefully)
Code:
; OzMining 1.0
; This is OzMining 1.1 Edited by Atlas
;
; For mining on the Imagine Nation 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. )
; -Removed this because it doesn't work on windows vista/7...copy/paste from old version if you want it back =p
;
; - Upates in 1.1
; *Patched up the infinite looping of failed mining [constantly loosening rocks] with a time-limit catch.
; *Added convenient global variables/constants to top for easy editing.
; *Enabled smelting of 'smaller stacks' (i.e. ores in stacks of 1, 2, and 3)
; *Allows exclusion of unwanted ores.
; *Found major error where all #CHARPOSY's were X's...hopefully fixed
; *Cleaned up certain bits...and made some more messy =]
; *Commented like a mother****er!
;
; Known bugs:
; - Macro gets "stuck" mining too fast sometimes -patched up, but not 100% fixed
; - Sometimes gets suck on "Can't Get There" [more rare]
;
; ============= 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.
; on the right side of EUO window, expand "Container Info"
; #CONTID variable 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 MHDDDND
; Change this to whatever ID your bank container has.
set %bankcontainerID ITESOMD
; Edit these integers according to how often you wish to bank/smelt your ore.
; If you set the value closer to your max weight (so lower values), it will bank/smelt more often
; Set it to ZER0 for default. Typically the bankweight var should be slightly MORE than smeltweight
set %bankweight 80
set %smeltweight 50
;Change these to whatever ores you wish to skip after digging once.
;The script will see when you dig the ore once, and move on to the next spot.
;If you don't want it to avoid ores, simply set the "you_dig_some_[ore]" to some short string of characters.
;Example: "gjrkgj" or "you_dig_some_Atlas" ... CANNOT be blank or a common phrase.
set %Ore1 you_dig_some_Atlas
set %Ore2 you_dig_some_Atlas
set %Ore3 you_dig_some_Shadow
set %Ore4 you_dig_some_Rose
set %Ore5 you_dig_some_Verite
set %Ore6 you_dig_some_Gold
set %Ore7 you_dig_some_Ice
set %Ore8 you_dig_some_Amethyst
; Change these X and Y locations (using .where) to change your desired pathfinding points when banking.
; Change the Z if there's a third number using .where (if the ground inclines/declines)
set %pfPosX0 2562
set %pfPosY0 491
set %pfPosZ0 0
set %pfPosX1 2558
set %pfPosY1 506
set %pfPosZ1 0
set %pfPosX2 2562
set %pfPosY2 513
set %pfPosZ2 15
; Change the "forgePosX/Y" below (using .where) to change your desired pathfinding locations to the forge
; (Should already be correct for Mt. Kendall)
; ================================================================================================
set #LPC 10
set %forgePosX 2574
set %forgePosY 490
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.1
while #charghost <> YES
{
if ( #WEIGHT > #MAXWEIGHT - %smeltweight ) ;smeltweight value here
gosub GoSmelt
if %status = no_more_ore
{
set %status idle
goto MoveToNextSpot
}
if ( #WEIGHT > 400 )
gosub GoSmelt
set %jrnl #jindex
gosub MineThisSpot
gosub ProcessResults
}
sub MineThisSpot ;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 10s
event Macro 22 0
set %status mining
}
return
sub ProcessResults
set %theTime #TIME ;sub ProcessResults
while %status = mining
{
set %jrnl #jindex
scanjournal %jrnl
if you_dig_some in #journal || You_have_moved_too_far in #journal || Someone_has_gotten in #journal
{
set %status idle
set %theTime #TIME
}
if you_loosen_some_rocks in #journal ;This is where it loops infinitely sometimes
set %status idle
if there_is_no_metal_here_to_mine in #journal || you_can't_mine_that in #journal || target_cannot_be_seen in #journal
{
set %status no_more_ore
gosub MoveToNextSpot
}
;===================================== Exempt-ore-type vars here =====================================
if %Ore1 in #journal || %Ore2 in #journal || %Ore3 in #journal || %Ore4 in #journal || %Ore5 in #journal || %Ore6 in #journal || %Ore7 in #journal || %Ore8 in #journal
{
set %status no_more_ore
gosub MoveToNextSpot
set %theTime #TIME
}
;=====================================================================================================
;if for_validating_your_presence in #journal ;Commented out - not needed for Imagine Nation
;{
; set %status no_more_ore
; gosub MoveToNextSpot
;}
if #TIME > ( %theTime + 14 ) ;This is a catch to prevent infinite looping
{ ;It keeps track of time. As soon as 14 seconds have passed, it moves on to a different spot after 10 second pause
set %status no_more_ore
wait 10s
gosub MoveToNextSpot
}
}
return
sub MoveToNextSpot ;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 ;sub GoSmelt
set #LPC 1
SmeltOre:
set %oldX #charposX
set %oldY #charposY
event pathFind %forgePosX %forgePosY
wait 2s
if ( #charposX = %oldX && #charposY = %oldY )
goto SmeltOre
CheckForMoreOre:
finditem DWJ C ;Check stacks of 4+ and smelt
if #FINDCNT > 0
{
set #lObjectId #findId
event macro 17 0
goto CheckForMoreOre
}
finditem GWJ ;Check stacks of 3 and smelt
if #FINDCNT > 0
{
set #lObjectId #findId
event macro 17 0
goto CheckForMoreOre
}
finditem EWJ ;Check stacks of 2 and smelt
if #FINDCNT > 0
{
set #lObjectId #findId
event macro 17 0
goto CheckForMoreOre
}
finditem TVJ ;Check for 1 ore and smelt
if #FINDCNT > 0
{
set #lObjectId #findId
event macro 17 0
goto CheckForMoreOre
}
wait 1s
if ( #weight > #maxweight - %bankweight ) ;BANK WEIGHT VALUE HERE
gosub BankOre
GoBack:
event pathFind %oldX %oldY
wait 2s
if ( #charposX = %forgePosX && #charposY = %forgePosY )
goto FindNextSpot
return
sub BankOre ;sub BankOre
if ( %DegugMode )
event sysmessage ++ Going to bank ingots...
BankingStep0:
event pathFind %pfPosX0 %pfPosY0 %pfPosZ0 ;Should coincide with pathfinding varibles/coordinates at the top
wait 1s
if ( #CHARPOSX <> %pfPosX0 && #CHARPOSY <> %pfPosY0 )
goto BankingStep0
if Can't_get_there in #journal
gosub MoveToNextSpot
BankingStep1:
event pathFind %pfPosX1 %pfPosY1 %pfPosZ1
wait 1s
if ( #CHARPOSX <> %pfPosX1 && #CHARPOSY <> %pfPosY1 )
goto BankingStep1
if Can't_get_there in #journal
gosub MoveToNextSpot
BankingStep2:
event pathFind %pfPosX2 %pfPosY2 %pfPosZ2
wait 1s
if ( #CHARPOSX <> %pfPosX2 && #CHARPOSY <> %pfPosY2 )
goto BankingStep2
if Can't_get_there in #journal
gosub MoveToNextSpot
Openbank:
set #LOBJECTID %bankID
event macro 17 0
wait 10
if ( #CONTID <> %bankcontainerID )
{
goto Openbank
event sysmessage Your bank CONTID (bankcontainerID) is incorrect. ; -Atlas
}
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 %pfPosX1 %pfPosY1 %pfPosZ1
wait 1s
if ( #CHARPOSX <> %pfPosX1 && #CHARPOSY <> %pfPosY1 )
goto GoingBackStep1
GoingBackStep2:
event pathFind %pfPosX0 %pfPosY0 %pfPosZ0
wait 1s
if ( #CHARPOSX <> %pfPosX0 && #CHARPOSY <> %pfPosY0 )
goto GoingBackStep2
GoingBackStep3:
event pathFind %forgePosX %forgePosY
wait 1s
if ( #CHARPOSX <> %forgePosX && #CHARPOSY <> %forgePosY )
goto GoingBackStep3
set #LPC 10
return
For those of you who want to take the time...this will make editing the script for mining elsewhere much easier. Simply edit the relevant variables and values and it should work :p
DOWNLOAD EasyUO: http://download.easyuo.com/cheffe/euox196.zip - if this link isn't proper, someone let me know and ill edit. I took it from old thread
If you're lazy and don't want to do that, PM me and I'll do it for you...for the right price
Also PM me if there are any bugs or the script isn't running properly.
Easy UO Script: Mining - Updated! -
Cana - 02-21-2012
Nice to see someone is still making updates to this. Nine job
I eventually got to fixing the looping problems, added other mining locations and made a reliable pathing subroutine. I don't think I posted it on the forums though, and I lost it. If anyone I gave it to still has some later versions, please contact me.
Easy UO Script: Mining - Updated! -
Eadred - 02-21-2012
[COLOR="white"]
I've tried to use this script, and I'm not having much luck for some reason. I opened the client using easyuo, and filled in what I -believe- to be the correct ID's. As stated in Taran's thread on this script, I get the message, "Starting OzMining 1.1" and it asks me to choose where I'd like to dig. After that... Nada... Zilch... It won't continue from that point, and I can't get it to walk around, much less smelt and bank. It's probably something simple, but I can't work it out, nonetheless. Any thoughts?
Edit: Stiil can't get it to run. I can get it to attempt to smelt with the status bar up, but not dig. :facepalm:[/COLOR]
Easy UO Script: Mining - Updated! -
Cana - 02-21-2012
Have you made sure you have correct version of EUO? Tried running EUO as admin? If you browse the dropdown menus on right side of the EUO window do you see your character name under "Status Bar > #CHARNAME" ?
Easy UO Script: Mining - Updated! -
Eadred - 02-21-2012
Yes, I do see #CHARNAME: Eadred. on the status bar. I'm not sure exactly what the ideal version for this script is. I use version 206 of Easyuo 1.5. Any further help would be much appreciated. Thank you.
Easy UO Script: Mining - Updated! -
Atlas - 02-21-2012
Hmm I use 1.5 V 202. Are you using a pickaxe and not a shovel? I don't think it allows the use of shovels, but haven't tested it. If you'll PM me in game sometime or msg me when I'm on, i can come to you and help you with it
Easy UO Script: Mining - Updated! -
Eadred - 02-22-2012
Yes, I am using a pickaxe to mine. I probably should have pointed that out earlier. I may just take you up on that offer, Atlas. Thank you.
Easy UO Script: Mining - Updated! -
Raziel_ - 02-22-2012
sometimes when i get to bank the ingots the macro ends up with some kind of mistake, i think its because of lag while using the drag and dropc exevents..
i have raised the value of the pause to 20 between each action.. it has made it more rare to happen but still happen... do you have any idea or get the same problem?
Easy UO Script: Mining - Updated! -
Atlas - 02-22-2012
What's wrong that happens? What does it do? I've never really had an issue with the drag/dropping
Easy UO Script: Mining - Updated! -
Raziel_ - 02-23-2012
It seem to lock the ingot on my mouse, though i cannot see its sprite on the mouse cursos and it "shows" at the bag.. i had this issue with other macros i made but i fixed it increasing the wait time to drop and after the drop.. in this macro, increasing the time seems to lower the issue but still happens.. i really dont know why.
[EDIT]
I believe i have found the problem...
at this part:
Quote:BankMore:
finditem %ingotTypes C
if #FINDCNT > 0
{
Exevent Drag #findid #findstack
wait 10
Exevent Dropc %ingotContainer
wait 10
goto BankMore
}
where i ask the macro to find the ingots i dont especify the container, maybe it bugs.... i have put this on the finditem:
finditem %ingotTypes C_ , #backpackid
so it will only look for ingots in my backpack!
i'm not sure if it solved the problem.. i hope it has since i havent got it anymore!
Easy UO Script: Mining - Updated! -
Atlas - 02-23-2012
Yea it would seem like one or the other =p either it was looking for ingots everywhere, and not just in your pack, or it wasn't able to find the ingotContainer properly, but the second option wouldn't be valid since it works most of the time.
If it was getting stuck after all of the ingots in your pack had been banked, then that was probably the problem
Easy UO Script: Mining - Updated! -
Raziel_ - 02-23-2012
Well... guess what? that wasnt the problem, and i havent figured out...
What i know now is my bank seems to freeze!
It remains open, but i cant open a bag in it, move anything in it or move anything out... I changed the bank box... lets see if this time it works >.<
This is getting really annoying hehe