It has been posted on old Yoko forum but i thought id post it here again
Code:
############################################################
# Ultimate Mining Script! v1.11
# by =Alas=
# 04/9/2003
# Special Thanks to Voyta for ideas!
############################################################
#
#=== Main Idea
# First of all, user records a path inside the mine,
# then... the script follows this path mining under
# user's position each step.
#
#=== Possible Upgrades
# - Recalling between mines (at least in my shard, this
# macro mines faster than the mine regeneration rate,
# even in the biggest mines).
# - Override using of setcatchbag. Considered illegal
# in most of shards. First idea is to let the macro
# walk to a house and drop the ore there. UNFINISHED!
# - Correcting the lang... my englis is poor *lol*
#
#=== How to setup (it isn't that difficult)
# 1. Create an Object TYPE called "pickaxe", init
# it to your mining tool.
# 2. In my shard, mining time of a spot never takes
# more than 5 seconds. If in yours this time can
# be longer, change the maxMineTime var on the
# mine_spot sub.
# 3. If you wish to use the "setCatchBag" thing,
# create an injection OBJECT called "oresBag",
# and set it to the container in the bank (old
# spheres only) or in you pack wich will store
# the ores.
# 4. If you want to cycle the path (neverending
# mining, till you stop the macro), set the
# value of "cycle" variable in the go_mining
# sub to 1.
#
#=== Action starts! How to record the path?!
# 1. Go to the starting location (have to remember it!)
# and execute the record_path sub.
# 2. Walk normally all over where you you want to
# mine later (char will follow YOUR path, try to
# repeat as low spots as you can)
# 3. When you're done, just say "stop"
# 4. Your path is in the textWindow! Copy it to
# the 'Var path="xxxx"' on the go_mining sub, where
# xxxx is your path.
#
# IMPORTANT! IMPORTANT! IMPORTANT! IMPORTANT!
# The path is a fucking long string :P
# If you want to cycle this path, make sure it ends
# EXACTLY where it stats! (no need to look at same dir)
#
#=== Hardcore Action time! Let's rock!
# 1. Go to the starting position of your path.
# 2. Execute the go_mining function!
# 3. Let the time do his work, woh0h0h0h0!
#
#=== Considerations
# This macro NEVER uses the mouse! Why? This way you
# can use your comp while it's working. You can even
# use multiclient and have as many chars mining as you
# want.
# I use it to mine with one char while I play with my
# main char.
############################################################
# Main Mining Function! Conf. Needed (look above)
############################################################
sub go_mining()
var cycle=1
var path="3l9o9iik7i8k9lk3lo2l"
var test=0
var i=0
var j
UO.SetCatchBag("oresBag")
UO.DeleteJournal()
While i<LEN(path)
if VAL(path[i]) then
j=VAL(path[i])
i=i+1
else
j=1
endif
Repeat
if test<>1 then
UO.DeleteJournal()
mine_spot()
end if
UO.Print("New Location!")
if not make_step(path[i]) then
UO.Print("Probably Stuck!")
UO.Print("Hope it is a Worldsave")
endif
j=j-1
Until j==0
i = i + 1
if cycle && i==LEN(path) then
i=0
endif
Wend
end sub
############################################################
# Auxilliar Function. Little mod needed (look above)
############################################################
sub mine_spot()
var maxMineTime=7000
var times=0
var timeout=0
While UO.InJournal("There is no")==0
UO.Print("Mining time!")
UO.DeleteJournal()
UO.WaitTargetTile("1339",STR(UO.GetX()),STR(UO.GetY()),"0")
UO.UseType("pickaxe")
timeout=0
times = times +1
if times>20 then
wait(maxMineTime)
times = 0
endif
Repeat
timeout=timeout+200
Wait(200)
#UO.Print("Waiting...")
Until UO.InJournal("You put") OR UO.InJournal("There is no") OR timeout>maxMineTime
Wend
return 0
end sub
############################################################
# Main Path-Recording function!
############################################################
sub record_path()
var x
var y
var path=""
UO.DeleteJournal()
Repeat
x=UO.GetX()
y=UO.GetY()
if waitNewPos(x,y) then
path=path+extract_dir(x,y,UO.GetX(),UO.GetY())
endif
Until UO.InJournal("stop")
path = compressPath(path)
UO.TextClear()
UO.TextOpen()
UO.TextPrint("Your path is:")
UO.TextPrint(path)
end sub
############################################################
# Auxilliar sub.
############################################################
sub send_step(keycode,dir)
var x = UO.GetX()
var y = UO.GetY()
var timeout = 0
if UO.GetDir()<>dir then
UO.Press(keycode)
Repeat
wait(50)
Until UO.GetDir()==dir
endif
UO.Press(keycode)
Repeat
timeout=timeout+50
wait(50)
Until x<>UO.GetX() || y<>UO.GetY() || timeout>2000
if timeout>2000 then
return 0
endif
return 1
end sub
############################################################
# Bunch of auxilliar subs. No need to change anything!
############################################################
sub waitNewPos(x,y)
while x==UO.GetX() && y==UO.GetY()
if UO.InJournal("stop") then
return 0
endif
wend
return 1
end sub
sub compressPath(path)
Var i=0
Var j=0
Var newPath=""
while i<LEN(path)
j=1
while path[i]==path[i+1] AND j<9
i=i+1
j=j+1
wend
if j==1 then
newPath=newPath+path[i]
else
newPath=newPath+STR(j)+path[i]
endif
i=i+1
wend
return newPath
end sub
sub extract_dir(x,y,a,b)
if x>a then
if y==b then
return "i"
else
if y>b then
return "n"
else
return "w"
endif
endif
else
if x<a then
if y==b then
return "l"
else
if y>b then
return "e"
else
return "s"
endif
endif
else
if y>b then
return "o"
else
return "k"
endif
endif
endif
end sub
sub make_step(dir)
if dir=="e" then
send_step(39,1)
return 1
endif
if dir=="l" then
send_step(34,2)
return 1
endif
if dir=="s" then
send_step(40,3)
return 1
endif
if dir=="k" then
send_step(35,4)
return 1
endif
if dir=="w" then
send_step(37,5)
return 1
endif
if dir=="i" then
send_step(36,6)
return 1
endif
if dir=="n" then
send_step(38,7)
return 1
endif
if dir=="o" then
send_step(33,0)
return 1
endif
if dir=="d" then
While UO.Count("0x19b9")
UO.Drop("0x19b9")
wait(1000)
Wend
wait(200)
return 1
endif
UO.Print("Recall Time!")
return 0
end sub