Minin script

Anything and all.

Moderators: Murderator+, Murderator

ozcaN
Posts: 34
Joined: 2004-06-18 17:21:40

Post by ozcaN »

can u please post your version wiht the recalling.
Thdin
Posts: 51
Joined: 2004-07-22 07:37:37

Post by Thdin »

Sure!

Read through this code and make SURE to read the commentary (after the # tags)

Code: Select all


sub Oredroppings()

UO.DeleteJournal()

Checkmana()

UO.Cast('Mark','temprune') #Keep an extra rune loose inside your backpack and add it to your Objects in Injection naming it "temprune"
Wait(8000)
While UO.InJournal("spell fizzle")==1
UO.Cast('Mark','temprune')
Wait(8000)
Wend

Checkmana()

UO.Exec("recall Runebook 23") #Change 23 to match the rune of your house in your runebook
Wait(8000)
While UO.InJournal("spell fizzle")==1
UO.Exec("recall Runebook 23") 
Wait(8000)
Wend

Wait(200)
UO.Exec("emptycontainer 100 orebag OreDC") #Add an object to your Injection called "orebag" and target a bag inside your backpack. OreDC is a chest at my house which is locked and secured outside my front door for easy access. 
Wait(1000)

Checkmana()

UO.Cast('Recall','temprune') #Then it recalls back to where you were last and continues mining with the path you recorded! Remember, this only works with this particular mining script at the beginning of the post.
Wait(8000)
While UO.InJournal("spell fizzle")==1
UO.Cast('Recall','temprune')
Wait(8000)
Wend

endsub
  
sub CheckLag() #Simple lag checking function so that you don't mess up marking or recalling
   UO.DeleteJournal()
   UO.Click('backpack')

   Repeat
      wait(200)
   Until UO.InJournal('backpack')
end sub 

sub Checkmana() #Another simple function so that in case you try to recall and don't have enough mana it will meditate instead of not doing the rest of the script (thusly never actually dropping off the ore :P)

Startmeditation:
Repeat
If UO.Mana<30 Then
UO.Useskill('Meditation')
Wait(2500)
Until UO.InJournal("You must wait") #Change this to match the message you get when you try to meditate but already are...

Repeat
Wait(100)
If UO.InJournal("You lose your concentration") OR UO.InJournal("You stop")
goto Startmeditation
Until UO.Mana>99 #If you don't have this much mana, fix this number to match your stats
endif

endsub

Place all that's above somewhere in your autoload script as seperate functions. Don't worry about having to define the functions, they are already made, just don't copy and paste this INTO another function :P

Ok now I will show you where to place the Findore() and Oredroppings() functions in the actual mining script so that they are probably executed.

Code: Select all


   If UO.Weight>250 Then #Set this weight according to your strength or server settings
   	Oredroppings()
   Endif

   UO.DeleteJournal()

   While (UO.InJournal("There is nothing") OR UO.InJournal("Try mining"))==0
   UO.Print("Mining time!")
   UO.DeleteJournal()
   UO.WaitTargetTile("1341",STR(UO.GetX()),STR(UO.GetY()),"0")
   UO.UseObject("pickaxe")

Place it before the part where the mining starts so that you don't mine when you're overweight. Remember to change the weight so that it works with your server.

Now, this next part will allow the ore to fall into the "orebag" you previously setup so that when you empty all your ore, you only empty the stuff inside the bag with ore in it instead of everything inside your actual backpack :P (This could mistakely drop off your pickaxe/shovel, runes, "temprune", runebook, etc. You don't want that to happen or the script won't be able to find them!)

Code: Select all


UO.SetCatchBag('orebag')
   Repeat
      timeout=timeout+20
      Wait(20)
      #UO.Print("Waiting...")
      Until UO.InJournal("You loosen") OR UO.InJournal("You put the") OR UO.InJournal("There is nothing here") OR UO.InJournal("Try mining") OR UO.InJournal("You are starving") OR UO.InJournal("World save") OR timeout>maxMineTime
      UO.UnSetCatchBag()

Find this section in your script and replace it with what's above. I added some triggers to the journal, but otherwise it's identical except for the SetCatchBag and UnSetCatchBag which will store the ore in your "orebag".

I know it's long and seemingly complicated, but with some study and application it will help in the long run ;) I mined up 40k+ iron ore overnight once with this script.

If you have ANY questions, no matter how small, feel free to ask and I will explain as much as possible! :D
commio
Posts: 6
Joined: 2004-08-30 12:38:29

Post by commio »

Many thanks for all that code! Ill have to try it out when i get a house, runebook (or runes) and a bit more mana and meditating up :)

But for now slight problem with prev script. everything is working but on the odd occasion it seems to just stop completely and my miner will stop doing anything. It seems its straight after a world save this happens (last thing in journal when i come back). But when i watch, it sometimes mines through a world save (it will keep retrying until world save is complete).

Im thinkin maybe sometimes it retries too many during a world save so the script stops ? And so he just ends up standing there. Anyone got any extra script to fix this minor thing up ?
Thdin
Posts: 51
Joined: 2004-07-22 07:37:37

Post by Thdin »

It's got to do with timers. You should fix up the mining triggers to stop mining and go to next location if it reads "World save" or something. In my script above I have actually made that change. Check it out :)
commio
Posts: 6
Joined: 2004-08-30 12:38:29

Post by commio »

Sorry about this thdin, but im quite new. I tried to look into it my self but anything i tried just didnt work.

I just wanted it when it reads in journal "World Save in 2 minutes" or even "world save" it waits say 20 seconds then moves onto mining in the next location.

If you could edit my script i supplied below to do this, it would be greatly appreciated.

Code: Select all

############################################################ 
#   Main Mining Function! Conf. Needed (look above) 
############################################################ 
sub go_mining() 
   var cycle=1 
   var path="kskin2ol" 
   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=5000 
   var times=0 
   var timeout=0 
   While UO.InJournal("There's no ore")==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("World Save") OR UO.InJournal("There's no ore") 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

Thanks again.
Thdin
Posts: 51
Joined: 2004-07-22 07:37:37

Post by Thdin »

This should do it. If you replace my posted code here with the matching section in your script it should all work fine. Remember to place a bag inside your backpack and add it as an object named "orebag". :)

Code: Select all


UO.SetCatchBag('orebag')
   Repeat
      timeout=timeout+20
      Wait(20)
      #UO.Print("Waiting...")
      Until UO.InJournal("You loosen") OR UO.InJournal("You put the") OR UO.InJournal("There is nothing here") OR UO.InJournal("Try mining") OR UO.InJournal("You are starving") OR UO.InJournal("World save") OR timeout>maxMineTime
If UO.InJournal("World save") Then
Wait(5000)
Endif
UO.DeleteJournal()       
      UO.UnSetCatchBag()

commio
Posts: 6
Joined: 2004-08-30 12:38:29

Post by commio »

Weird but i am, on the line of code

Code: Select all

 
timeout=timeout+20
i get a error message "variable undefined - TIMEOUT".

any idea ?

My code is looking like this. I changed orebag, to oresbag.

Code: Select all

   UO.SetCatchBag("oresBag") 
	Repeat 
      timeout=timeout+200 
      Wait(20) 
      #UO.Print("Waiting...") 
      Until UO.InJournal("You loosen") OR UO.InJournal("You put the") OR UO.InJournal("There is nothing here") OR UO.InJournal("Try mining") OR UO.InJournal("You are starving") OR UO.InJournal("World save") OR timeout>maxMineTime 
	If UO.InJournal("World save") Then 
	Wait(5000) 
	Endif 
   UO.DeleteJournal()
Thdin
Posts: 51
Joined: 2004-07-22 07:37:37

Post by Thdin »

Um well...what I posted isn't the entire script.. you have to put it IN to the section that matches it lol

Also, you can't have it say timeout=timeout+200 and then have a Wait(20). Timeout has to match it (both 20) since timeout is the time that passes. If 200 milliseconds "pass" every 20 milliseconds, the timeout would run out before 8 seconds had actually passed. Make sure to fix that up :P
Infectous
Posts: 55
Joined: 2004-07-29 16:29:52

complete Ultimate Mining Macro

Post by Infectous »

This is the Ultimate Mining Macro written by Hephaisto from the Yoko Forums NOW with fixes by Thdin and Genocide

If you need directions Click here is the original version. but take note you won't have to set up the oresBag, nor the pickaxe so you may skip those steps

It now recalls! and unloads your oresBag in to a container (oresChest)....

I have simplified the script so it asks you question alls you need to set up is the oreChest (container to drop ores off in) and the recall part.
use ,addobject oresChest and target your container!
oreChest should be a secure container in front out your house where you recall in or I use my UID chest in the WarehouseW.

you will need a rune, a pick axe and a bag in your pack to start

knowledge of how to use the recall function of injection is a must

basically to use the recall function you use the runebook as normal then type ,infogump and then you should get a new text window... scroll down and find
Reply: ___________
[0004] primary reply
Checks&Radios (0)
Entryes (0)
a simple conversion of the [0004] to 0x04 (binary) is what we use in our scripts
more examples : 0001 = 0x01, 0023 = 0x23, NOTICE THE PATTERN... even my 5 year old gets it
Change the second "0" to an "x"...

go over the comments and set macro up to suit your character & settings

Code: Select all

### Ultimat Mining Macro w/fixes

sub go_mining() 
  var cycle=1 
  var path="7oi7ki" #change this from your exec record_path text  
  var test=0 
  var i=0 
  var j
uo.print('Target the bag for your ingots to go into') 
uo.exec('addobject oresBag') 
while uo.targeting() 
wait(100) 
wend 
uo.print('Target your Pickaxe') 
uo.exec('addtype pickaxe') 
while uo.targeting() 
wait(100) 
wend
uo.print('Target your rune') 
uo.exec('addobject temprune') 
while uo.targeting() 
wait(100) 
wend 
UO.SetCatchBag("oresBag")   

  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
 
sub mine_spot() 
  var maxMineTime=9000 
  var times=0 
  var timeout=0
If UO.Weight>2000 Then #Set this weight according to your strength or server settings (2000 stone  = about 500 str)
      Oredroppings()
   Endif

   UO.DeleteJournal()
ToHide()
  While (UO.InJournal("There is no") OR UO.InJournal("Try mining"))==0 
  UO.Print("Mining time!") 
  UO.DeleteJournal() 
#UO.WaitTargetTile("1339",STR(UO.GetX()),STR(UO.GetY()),"0") ; edited out to work on Dominaira 
UO.Exec("waittargetself") 
  UO.UseType("pickaxe") 
  timeout=0 
  times = times +1 
  if times>20 then 
     wait(maxMineTime) 
     times = 0 
  endif 
  Repeat
      timeout=timeout+20
      Wait(20)
      #UO.Print("Waiting...")
      Until UO.InJournal("You loosen") OR UO.InJournal("You put the") OR UO.InJournal("There is no") OR UO.InJournal("Try mining") OR UO.InJournal("That is too") OR UO.InJournal("You are starving") OR UO.InJournal("World save") OR timeout>maxMineTime
If UO.InJournal("World save") Then
Wait(5000)
UO.DeleteJournal()
Endif
 Wend      
  return 0 
end sub
 
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 
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 
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

sub Oredroppings()

UO.DeleteJournal()

Checkmana()
UO.UnSetCatchBag() 
  UO.DeleteJournal() 

UO.Cast('Mark','temprune') #Keep an extra rune loose inside your backpack
Wait(5000)
While UO.InJournal("spell fizzle")==1
UO.Cast('Mark','temprune')
Wait(5000)
Wend

Checkmana()

UO.warmode(0)
UO.Exec("recall Runebook 0x03") #Change 0x03 to match the slot of your house in your runebook 
Wait(2000)
While UO.InJournal("spell fizzle")==1
UO.warmode(0)
UO.Exec("recall Runebook 0x03")
Wait(2000)
Wend

ToHide()
Wait(200)
UO.Exec("emptycontainer 100 oresBag oreChest") # use ",addobject oreChest" then target your chest you want to drop off the ore in (a secure container in front of your house)
Wait(100)

Checkmana()

UO.warmode(0)
UO.Cast('Recall','temprune') #Then it recalls back to where you were last and continues mining with the path you recorded!
Wait(3000)
While UO.InJournal("spell fizzle")==1
UO.Cast('Recall','temprune')
Wait(3000)
Wend
UO.SetCatchBag("oresBag")
endsub
 
sub CheckLag() #Simple lag checking function so that you don't mess up marking or recalling
   UO.DeleteJournal()
   UO.Click('backpack')

   Repeat
      wait(200)
   Until UO.InJournal('backpack')
end sub

sub Checkmana() #Another simple function so that in case you try to recall and don't have enough mana it will meditate instead of not doing the rest of the script (thusly never actually dropping off the ore :P) Genocide

if UO.Mana<100 then #rewritten by Genocide - set this amount to your chars INT value if not 100 
while UO.Mana<UO.INT 
UO.UseSkill("Meditation") 
wait(3000) 
wend 
endif 

endsub

sub ToHide() 
while not UO.Hidden() 
uo.print('Attempting to hide') 
uo.deletejournal() 
UO.UseSkill("Stealth") 
wait(4100) 
wend 
wait(100) 
end sub
Thank you to everyone who taken part of sharing....
I post this in our forums also along with many others

Edit: I forgot a Wend and I moved a deletejournal into the if statement so far so good, before it was minging one time and moving, it again mines till the spot is done then moves
Atsumi
Posts: 1
Joined: 2005-01-11 12:13:41

Stealer

Post by Atsumi »

Thanks for stealing my script without giving me any credit. Lots of thanks.
Infectous
Posts: 55
Joined: 2004-07-29 16:29:52

Re: Stealer

Post by Infectous »

Atsumi wrote:Thanks for stealing my script without giving me any credit. Lots of thanks.
I was just going by what I read here
############################################################
# Ultimate Mining Script! v1.11
# by Hephaisto
# 04/9/2003
# Special Thanks to Voyta for ideas!
############################################################
anyway with even more modification and even easier setup Click here
GimFlex
Expert!
Posts: 766
Joined: 2005-01-07 13:22:19
Contact:

Post by GimFlex »

блин буржуи :) хоть бы срочку по русски
Post Reply