Page 1 of 2

Minin script

Posted: 2004-06-10 17:07:36
by Hephaisto

Code: Select all

############################################################ 
#              Ultimate Mining Script! v1.11
#                    by  Hephaisto
#                     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=0
   var path="l7el9wl8ek"
   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 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

Posted: 2004-06-10 17:30:35
by Hephaisto
btw if ye like this script goto irc.le.lt and do spam "U R FUCKING LAMER & NOOB :))))"

To those 2 n00bz: Harm, Atrox

Kthx

Posted: 2004-06-10 21:50:52
by Psimorph
My char dont wanna write Path in textWindow, i dont know why =(
What u mean here -

Code: Select all

#   4. Your path is in the textWindow! Copy it to 
#      the 'Var path="xxxx"' on the go_mining sub, where
#      xxxx is your path.

Posted: 2004-06-11 08:34:37
by Hephaisto
when u exec record_path sub and walk around where u want to mine u must say STOP, after that there will appear text window with you path in it, copy this path to "var path=", stand in the place where u started recording path and exec go_mining function

Posted: 2004-06-11 13:45:01
by Psimorph
Yeah,ok, but new problem - i have different tiles types. For example - 1339, 1341, 1342.. And, if under me tile with type '1341'(but in script tyles type is 1339)

Code: Select all

   UO.WaitTargetTile("1341",STR(UO.GetX()),STR(UO.GetY()),"0")
   UO.UseType("pickaxe")

then char dont mine =\ How can i improve this problem??

Posted: 2004-06-11 14:31:31
by Hephaisto
change it to 1339 :> Or try to mine on same types of tiles

Posted: 2004-06-11 19:33:51
by Psimorph
Yeah, i have change , but in the cave every tail have different number- for example. first have - 1339, second - 1341, third 1339, fourth - 1342.... like this =( it's very hard to find mine-line =( Can i create some Massive or somethink like this?

Posted: 2004-06-14 11:26:04
by Hephaisto
I dunno where uer trying to mine... just try to find a mine where are no hills

Posted: 2004-06-27 06:23:44
by FireFlash
i just tried your script, had to remove a line, coz it wasnt working, but once i did that, it works great... will be superb if you do the ore dumping thing aswell.


thanks

Posted: 2004-06-27 19:14:37
by ozcaN
Fire flash can u post ur version of the scripT?

Posted: 2004-07-22 18:09:11
by Thdin
I love this script! It works PERFECTLY for me!! :D

All you have to do is make sure it's UO.UseObject("pickaxe") and NOT UO.UseType("pickaxe"). For some reason, with me, it would say "cannot find item" and it wouldn't mine! But it works now! :D Thanks a lot!!

Also, if you're in a flat mine, like the Minoc cave, use tiletype 1341, instead of 1339 (like in the script). Otherwise, everything else works! :)

Posted: 2004-07-22 18:42:58
by BETEPAH
Try this )))

Code: Select all

############################################ 
### Manning / Шахтер v2.3 ###
############################################
### Шард Dragon World / www.drw.ru
############################################
### Реавтор этого скрипта: BETEP [WOD] or BETEPAH ###
############################################
###                    BETEP™
#############################
### Описание и настройка ###
#############################
###
### Чар стоит в пещере(не ВИП) и копает вокруг себя.После достижения "максимального" веса (в данном случие это 625 стоунов)
### "порталится" домой скидывает руду в сундук,после реколится обратно и продолжает копать.
### Пример: стоите копаете, дошли до придела в 625 веса сработала система рекола
### и вы "порталитесь" домой и складываете руду в сундук,после вы реколитесь обратно в пещеру.И продолжаете копать
### (Цикличность)
###
### Для тех то кто им пользуется сообщаю, переделал, доработал, отредактировал.!
###
### Нововведения:
### 1 )Руда складываются не на пол а в сундук. (BETEPAH)
### 2 )Рекол в пещеру и домой по РУНБУКЕ (а не по рункам). (BETEPAH)
###     ВНИМАНИЕ!!! В СКРИПТЕ РУНБУКИ НАСТРОЕНЫ ПОД DRW (шард)
### 3 )Система сброса руды переделана из MassMove(что в свою очередь иногда приписывалось как фаст лут)в перемещение через 
### Масив.(написана Savage, встроена BETEPAH)
### 4 )Упразнена система выбора "главных обьектов"(теперь просто указываем прицелом).(BETEPAH)
### 5 )Система реконекта (выложаная сверху),хорошо сочетается с этим скриптом. (Fox M)
###
### !!! Чтобы скрипт заработал ВНИМАТЕЛЬНО прочтите настройки.!!!!
###
###################################
### Режимы работы скрипта ###
###################################
### Режим - "Копание".###
###################################
###
### "sub maning()"
### Этот скрипт главный и отвечает за копание.
###
### Положите в суммку к себе Рунбук(с Рунами домой и в лес), Кирку (лопату),рунку к сундуку(по суте копия той что у вас
### в рунбуке).Идите в пещеру в котором вы хотите копать.Запустите Скрипт maning(),Инжект попросит вас указать кирку
### (появится прицел,прицелом на кирку которую вы с собой взяли),потом инжект попросит вас указать Рунбук(появится прицел,
### прицелом на Рунбук ) Внимание!!! В РУНБУКЕ РУНА В 1ом слоте ДОМОЙ,в 8ом В пещеру.
### ВНИМАНИЕ!!! В СКРИПТЕ НОМЕРА РУН В РУНБУКЕ НАСТРОЕНЫ ПОД DRW (шард). 
### Инжект сообщит вам что ('Прячемся..') тоесть чар уйдет в хайд. Чар автоматом возмет в руки кирку и начнет "окапаватся".
### Если выкопали Элементала то скрипт включит "серену" и встанет на паузу пока вы просто не скажите GO.(так как вы в хайде) 
### Если появился ПК то чар зареколится к сундуку (по рунке!! так как на ДРВ рекол через рунбук 8,7 сек,а по рунке 2,3 сек)
### выкинет руду в сундук и будет ждать определенное время которое вы поставите в скрипте.
###
### Чтобы все заработало !!в скрипте!! поставте свои значения:
### 1)wait(180000) -- время в секундах при ожидании пока уйдет ПК (строка 153).
### 2)if uo.weight > 625 then -- Максимальный вес при котором домой с рудой (строка 160).
###
###
##############################
### Режимы - "Супорт".###
##############################
### "loot()"
### Этот скрипт отвечает за сброс руды в сундук.
### После "рекола" домой чар при помощи этого скрипта сбросит руду в сундук (лучше в сейф).
### VAR UnloadCont='0x40041342' ; ID сундука для сброса руды <<<< поставте свой (строка 196).
### 
### "Save()"
### Скрипт "спасатель", отвечает за рекол по любой рунке у вас в паке + реги (включается если прешел ПК)
### будет пытатся реколится пока не "улетит" из пещеры (защита от физла).
###
### "pwav() и pwavw()"
### Скрипты "сирены" отвечают за проигрование Звуковых файлов (WAV) при выкапывании элема или поялении ПК
### uo.playwav("E:\UO\SOUND\sound 01.wav")<< укажите на примере этого путь к своим файлам (строчки 239 и 243).
###
### "Pause()"
### Скрипта пауза если выкопали Элема.
### Если вы выкопали Элема скрипт как бы "зависнет"(встанет на паузу) за это время вы можете убить элема,
### привратившись в Демона или привести Дракона.После просто скажите в игре GO и чар продолжит копать.
###
###################
### Патчи Вердаты: ###
###################
### Сдесь я приведу пару ссылок на патчи которые помогут вам копать:
###
### 1)cave floor (для тех кто предпочитает копать вручную, этот файл-патч отделяет тайлы в пещерах друг от друга,
### что приводит к более комфортабельному копанию)
### www.drguild.fatal.ru/files/verdata/cavefloor.exe
###
### 2)clean dungeons (в пещерах и подземельях не виден всякий мусор, как то: кости, мусор, большая паутина,
### все сталагмиты заменены на маленькие и т.д.)
### www.drguild.fatal.ru/files/verdata/cleandungeons.exe
###
### 3)ore mod (большое количество руды (больше 4 шт.) выглядит как маленькая кучка (3 шт.),
### а изображение руды в количестве одной и двух штук уменьшено)
### www.drguild.fatal.ru/files/verdata/ore.exe
###
### (все пачтчи проверены и протестены,Но скрипт работает и без них,так что ставить или нет - это ваше решение)
###
### Лично я копаю с ними.....удобно. Удачи и приятного Маннинга. ))
### ВЕТЕРАН ака BETEP [WOD]


sub maning()
#BETEP™#
var mx, my, mz, i, j, jor, ser, noto
Uo.exec("set norbcheck 1"); для рекола
uo.exec("set norbcalc 1"); тоже

uo.print('!!Выбери Лопату!! ')
uo.exec('addobject Shovel')
while uo.targeting()
wait(100)
wend
 
uo.print('!!Выбери Рунбук!! ')
uo.exec('addobject Runebook')
while uo.targeting()
wait(100)
wend

na4alo:
mx = UO.GetX("self")
my = UO.GetY("self")
mz = UO.GetZ("self")
UO.DeleteJournal()
for i = mx-4 to mx+4
for j = my -4 to my+4
while not UO.Hidden()
UO.Warmode("0")
uo.print("Прячемся...")
UO.UseSkill("Hiding")
wait(4000)
wend
UO.Print("Копаем в координатах: "+str(mx-i)+" "+str(my-j))
while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock") and not UO.InJournal("Iron Ore") and not UO.InJournal("Copper") and not UO.InJournal("Rusty Ore")
UO.DeleteJournal()
if uo.waiting() then
uo.canceltarget()
endif
UO.Waittargettile("1341", str(i), str(j), str(mz))
UO.Useobject("Shovel")
while not UO.InJournal("You put") and not UO.InJournal("heavy") and not UO.InJournal("location") and not UO.InJournal("no ore") and not UO.InJournal("but fail") and not UO.InJournal("far away") and not UO.InJournal("in rock")
wait (500)
if uo.injournal("heavy") or uo.dead() then
pwav()                   
Pause()
endif
for jor = 0 to 9   
ser = uo.journalserial(jor)
noto = uo.getnotoriety(ser)
if noto <> 1 and noto <> 0 and not uo.injournal("elemental") then
if uo.waiting() then
uo.canceltarget()
endif
Save()
pwavw()
wait(180000) ; время в секундах при ожидании пока уйдет ПК
loot()
wait(3000)
goto reccal
endif
next   
wend
if uo.weight > 625 then  ; Максимальный вес при котором домой с рудой
goto end
endif
wend
UO.DeleteJournal()
next
next
goto na4alo
end:
if uo.waiting() then
uo.canceltarget()
endif
uo.exec("recall Runebook 21") ; домой ( в рунбуке слот 1 )
wait(10000)
loot()
wait(3000)
reccal:
uo.deletejournal()
if uo.waiting() then
uo.canceltarget()
endif
uo.exec("recall Runebook 94") ; в шахту ( в рунбуке слот 8 )
mx = UO.GetX("self")
my = UO.GetY("self")
wait(10000)
if not UO.GetX("self") <> mx and not UO.GetY("self") <> my then
goto reccal
endif
goto na4alo
end sub

sub loot()    ; перекладка руды в сундук
if uo.waiting() then
uo.canceltarget()
endif
VAR a,Exit
VAR UnloadCont='0x40041342' ; АЙДИ сундука для руды 
DIM Ore[5]
Ore[0]=0x19B9 ; 4 and more ore
Ore[1]=0x19B7 ; 1 ore
Ore[2]=0x19BA ; 2 ore
Ore[3]=0x19B8 ; 3 ore
UO.SetReceivingContainer(UnloadCont)
wait(500)
For a=0 to 3
Exit=0
repeat
UO.FindType(Ore[a])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
wait(1500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
end sub

sub Save() ; Реколл от ПК при их появлении (в паке рунка в безопасное место и реги)
var mx, my
reccal:
uo.deletejournal()
if uo.waiting() then
uo.canceltarget()
endif
mx = UO.GetX("self")
my = UO.GetY("self")
UO.DeleteJournal()
UO.FindType('0x1F14',-1,'my')
wait(200)
UO.Cast('Recall','finditem')
wait(4000)
if not UO.GetX("self") <> mx and not UO.GetY("self") <> my then
goto reccal
endif
end sub

sub pwav() ; звук при выкапывании ЭЛЕМЕНТАЛА
uo.playwav("E:\UO\inject\SOUND\chanting sound 01.wav")
endsub

sub pwavw(); звук при появлении ПК
uo.playwav("E:\UO\inject\SOUND\chanting sound 01.wav")
endsub

sub Pause() ; Пауза скрипта если выкопали Элема (продолжить сказав GO )
UO.DeleteJournal()
REPEAT
WAIT(3000)
UO.Print("!!!СКРИПТ НА ПАУЗЕ!!!!")
UNTIL UO.InJournal('GO')
UO.Print("!!!СКРИПТ ПРОДОЛЖЕН!!!!")
endif
end sub

Posted: 2004-07-27 19:35:52
by Thdin
But that one only let's you mine where you can reach from standing still. The other one (first one actually posted in this post) lets you walk all around the mine!!

Posted: 2004-07-28 08:06:34
by BETEPAH
Yup
But what for to you to go on all mine?
On ours shard the ore has time resspawn so it is possible quietly to stand.

Posted: 2004-07-29 03:36:08
by Thdin
Not on my shard. It takes long time for respawn, so walking around means I get constant ore. By the time I get around to where I started the ore respawned again, given it's a big mine :P

Posted: 2004-08-04 05:51:45
by Infectous
Psimorph wrote:Yeah,ok, but new problem - i have different tiles types. For example - 1339, 1341, 1342.. And, if under me tile with type '1341'(but in script tyles type is 1339)

Code: Select all

   UO.WaitTargetTile("1341",STR(UO.GetX()),STR(UO.GetY()),"0")
   UO.UseType("pickaxe")

then char dont mine =\ How can i improve this problem??



Sphere haha is funny that way I am still trying to target a damn stackable potion... oh well any way if you are useing sphere (mine 55*) simply edit this way

Code: Select all

#UO.WaitTargetTile("1339",STR(UO.GetX()),STR(UO.GetY()),"0") 
UO.Exec("waittargetself")


Enjoy!

not moving

Posted: 2004-08-20 04:26:37
by jjdad
Hi guys,

When i run the script, everything works fine its just that my dude doesn't walk around, he just stays still and mines for ages!!, he neva moves, i did record_path, i got the path, pasted it where i was suppose to paste it but the nothing happened. and because i dont move around, the shard i play in doesn't have auto respawn, so it takes time to restore ore so i just get no ore.
Could someone please help me!, All help would be much apprieciatted, thanks


jjdad

Posted: 2004-08-30 12:52:34
by commio
same problem here, any help would be appreciated!

Posted: 2004-08-30 18:07:43
by Thdin
Make sure you record it slowly and there are no obstacles blocking your path. Also, make sure all the journal triggers in the script match the ones on your server. You will have to add UO.InJournal("Try mining elsewhere") for those spots where you cannot actually mine. That way the script can pick it up and move to the next tile.

Tell me exactly what happens when you run the script.

Code: Select all

While (UO.InJournal("There is no") OR UO.InJournal("Try mining"))==0


If you want, I can post my version of this script. I did lots of modding to it, but then again I tweaked it to match my OWN server so it may not work for you.

I could post my recall-home-and-drop-off-ore addition I made to this script. That one would require only a little bit of modding (targetting your Runebook, finding which rune is home, etc.). Simple stuff.

Posted: 2004-08-31 13:20:19
by commio
Thanks! i fixed the problem, the response on my server to not more ore left was different. SO changed the journal and works great.

Yeah those additions like drop off would be awesome! no more lugging around huge amounts of ore.. but first i gotta get a rune etc to recall to the back :(