DRW Vip mining

Anything and all.

Moderators: Murderator+, Murderator

korzh
Posts: 220
Joined: 2007-04-26 23:35:15

Post by korzh »

Kynep wrote:
korzh wrote:В любом случае больше finddistance ставь не больше 24, оптимально 14( размер экрана)...
10 макс 12, т.к. детектятся элемы соседей, и еще одну строку нужно поправить, в самом мининге перед запуском кила идет проверка по журналу, там поменяй
В таком случае пусть ближайших элемов ищет :)
Dimage
Posts: 36
Joined: 2006-12-04 00:23:37
Contact:

Post by Dimage »

Спасибо Kynep
Kynep
Expert!
Posts: 1348
Joined: 2006-02-07 08:51:40
Location: г. Старый Оскол
Contact:

Post by Kynep »

Dimage wrote:Спасибо Kynep
Да не за что )
Dillersss
Posts: 39
Joined: 2007-08-11 16:44:45
Location: www.drw.ru

Post by Dillersss »

Code: Select all

############################################################## 
#===---====----===---===---= Mining =---=-=-=-=-=--=-=-=-=-=-=# 
#    Single char mining for VIP Mine. DRW Shard www.drw.ru    # 
#           Scripted by Savage (c) 2005 ICQ:33336141          # 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
# To start script use ",exec mine" command from client window # 
############################################################### 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
;==================== Main mining script ====================== 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
sub mine() 
   VAR DigDistance, TileNum, KillElemental 
   VAR ElemSignal, LastTimer 
   DIM BaseX[4], BaseY[4] 
   VAR BaseZ, WayPoint, WayPoints 
   VAR MaxWeight 

   VAR i,j,TileY,TileX,DirX,DirY 
   VAR Delta,BeginX,EndX,BeginY,EndY 
    

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; TileNum='Num' - Use ",infotile" command on the floor 
; Номер тайла в котором можно копать ,потыкайте командой 
; ",infotile" по разнвм тайлам и посмотрите не отличаются ли их 
; номера. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   TileNum='1339' 
    

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Максимальный вес, который может поднять чар. Ставьте его 
; немного меньше реального. То есть если чар поднимает 760, то 
; ставим 730. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   MaxWeight=500 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; DigDistance=4 - Distance from tile where pickaxe targeting 
; Радиус круга по которому будет копать чар, то есть расстояние 
; до клетки куда можно дотянуться киркой. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   DigDistance=4 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; KillElemental='Yes'/'No' - Use 'Yes' if char skilled to morph 
;                            in daemon and wrestling > 50 
; Если чар достаточно прокачен чтоб бить элемов, ставьте 'Yes' 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   KillElemental='Yes' 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; ElemSignal='Off'/'On' - Play sound when elemental is digged 
; Оповешать при появлении элема 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   ElemSignal='Off' 


;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Здесь указываем координаты точек копания. Нужно встать на 
; позицию и посмотреть координаты в инжекте. Их и нужно 
; подставить вместо моих. Чара ставьте на 4 клетки от стен. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   BaseX[0]=5839 
   BaseY[0]=1213 
   BaseZ=0 

   BaseX[1]=5844
   BaseY[1]=1213 

   BaseX[2]=5850 
   BaseY[2]=1214 

   BaseX[3]=5846 
   BaseY[3]=1212 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Указываем количество точек копания 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   WayPoints=2 


   CheckLag() 
   UO.UseObject('Sunduk') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("Podoydi k sunduku i tkni v nego pricelom!") 
      UO.AddObject('Sunduk') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
      UO.UseObject('Sunduk') 
   Else 
;      UO.Say("Ok! Viju sunduk.") 
   Endif 


   CheckLag() 
   UO.UseObject('IronBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' Iron Ore") 
      UO.AddObject('IronBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya Iron Ore viju") 
   Endif 


   CheckLag() 
   UO.UseObject('OtherBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' rudu?") 
      UO.AddObject('OtherBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya rudy viju.") 
   Endif 


   CheckLag() 
   UO.UseObject('BestBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' vihu?") 
      UO.AddObject('BestBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya vihi viju.") 
   Endif 

   While NOT UO.Dead() 
    
      For WayPoint=0 to WayPoints-1
         walkn(BaseX[WayPoint],BaseY[WayPoint],"") 
         digitstay(MaxWeight,DigDistance,KillElemental,ElemSignal,BaseX[WayPoint],BaseY[WayPoint]) 
      Next 
   wend 
end sub 


; Проверка нужности руды. Закоментировать то что нужно копать. 
sub CheckOre() 
   VAR Cont=1, i=0, Exit=0 
   VAR Count=11   ; Сколько элементов в массиве. 
   DIM Ores[13]    

   Ores[0]="Iron"
   Ores[1]="Rusty" 
   Ores[2]="Old Copper" 
   Ores[3]="Dull Copper" 
   Ores[4]="Copper" 
   Ores[5]="Bronze" 
   Ores[6]="Silver" 
   Ores[7]="Gold" 
   Ores[8]="Rose" 
   Ores[9]="Shadow"
   Ores[10]="Agapite" 
   Ores[11]="Blood Rock" 
   Ores[12]="Verite" 
;   Ores[13]="Valorite" 
;   Ores[14]="Mytheril" 

   While i<Count AND Exit==0 
      If UO.InJournal(Ores[i]) Then 
         Cont=0 
         Exit=1 
      Endif 
;      UO.Print(STR(i)) 
;      UO.Print(Ores[i]) 
      i=i+1 
   Wend 
    
   return Cont 
end sub 


;-------------------- Try to mine under self ------------------ 
sub digitstay(MaxWeight,MaxDistance,KillElemental,ElemSignal,BaseX,BaseY) 
   VAR x,y,z='0',TileNum='1339' 
   VAR Last=0,LastTimer, ContFlag=1 
   VAR MaxTimer=110 

   For x=-MaxDistance to MaxDistance 
      For y=-MaxDistance to MaxDistance 
         Repeat 
            CheckLag() ; deleting journal 
            ToHide() 
             
            UO.WaitTargetTile(TileNum,STR(UO.GetX()+x),STR(UO.GetY()+Y),z) 
            UO.UseType('0x0E85') 

            LastTimer=UO.Timer() 

            Repeat 
               wait(500) 
            until UO.InJournal("Try mining") OR UO.InJournal("You put") OR UO.InJournal("You loosen") OR UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("OOPS") OR UO.InJournal("attacking you") OR LastTimer+200<UO.Timer() 

            If NOT UO.InJournal('There is no') then 
               ContFlag=CheckOre() 
            Endif 

            If UO.InJournal('You loosen') then 
               repeat 
                  wait(500) 
               until UO.InJournal("You put") OR LastTimer+MaxTimer<UO.Timer() 
            Endif 

            If UO.InJournal('something with ore') OR UO.InJournal("attacking you") then 
               If ElemSignal=='On' Then 
                  Gong(2) 
               Endif 

               If KillElemental=='Yes' Then 
                  KillElem() 
                  walkn(BaseX,BaseY,"") 
               Else 
; any user defined command when char digget elemental 

               Endif 
            Endif 
             
            If UO.InJournal("attacking you") then 
               gong(3) 
            Endif 

            If UO.Weight>=MaxWeight then 
               unloadore() 
            Endif 
         Until UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("Try mining") OR ContFlag==0 
      Next 
   Next 
end sub 


;------------------------- Unload ore ------------------------- 
sub unloadore() 
   VAR TempX,TempY,i,Exit, Exit1, ConTainer, j 
   VAR SundukX=5839 
   VAR SundukY=1216 
   VAR Index=14 ; количество элементов массива 
   DIM Ore[5], Colors[20] 

   Colors[0]="0x09F0" ; Gorgan 
   Colors[1]="0x09D3" ; Steel 
   Colors[3]="0x0BA7" ; Eldar 
   Colors[4]="0x08AF" ; Plut 
   Colors[5]="0x0085" ; Dragon 
   Colors[6]="0x0060" ; Aqua 
   Colors[7]="0x09E6" ; Elvin 
   Colors[8]="0x010F" ; Krinit 
   Colors[9]="0x09DA" ; Vulkan 
   Colors[10]="0x09EC" ; Blood Crest 
   Colors[11]="0x008F" ; Sand Rock 
   Colors[12]="0x09B9" ; Acid 
   Colors[13]="0x09A4" ; Crystaline 


   TempX=UO.GetX() 
   TempY=UO.GetY() 
    
   walkn(SundukX,SundukY,"") 
   ToHide() 
   UO.UseObject("Sunduk") 

   Ore[0]=0x19B9 ; 4 and more ore 
   Ore[1]=0x19B7 ; 1 ore 
   Ore[2]=0x19BA ; 2 ore 
   Ore[3]=0x19B8 ; 3 ore 

   For i=0 to 3 
      Exit=0 
      repeat 
         UO.FindType(Ore[i]) 
          
         if UO.GetQuantity('finditem')>0 then 
            If UO.GetColor('finditem')=='0x0000' Then 
               Container=UO.GetSerial('IronBag') 
            Else 
               Container=UO.GetSerial('OtherBag') 
               Exit1=0 
               j=0 
               While j<Index AND Exit1<>1 
                  If UO.GetColor('finditem')==Colors[j] Then 
                     Container=UO.GetSerial('BestBag') 
                     Exit1=1 
                  Endif 
                  j=j+1 
               Wend 
            Endif 
            UO.MoveItem('finditem',0,Container) 
            CheckLag() 
            wait(1000) 
         Else 
            Exit=1 
         endif 
      until Exit==1 
   Next 

   walkn(TempX,TempY,"") 
   ToHide() 
end sub 

;----------- Summon Energy Vortex, kill elem and loot him ----------- 
sub killelem()
DIM Ore[4] 
Ore[0]='0x19B7' ; 1 ore 
Ore[1]='0x19BA' ; 2 ore 
Ore[2]='0x19B8' ; 3 ore 
Ore[3]='0x19B9' ; 4 and more ore 
var i, exit,l
UO.DeleteJournal() 
UO.UnSetReceivingContainer() 
uo.usetype('0x0f0e','0x0631')
wait(3000)
povtor:
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500)
uo.usetype('0x1f66','')
wait(5000)
if uo.injournal('spell fizzles') then
goto povtor
endif
wait(13000)
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500)
uo.usetype('0x1f66','')
wait(10000)

For i=0 to 3 
Exit=0 
While Exit<>1 
UO.FindType(Ore[i],-1,'ground') 
If UO.GetQuantity('finditem')>0 then 
UO.Grab('all','finditem') 
CheckLag() 
Wait(1000) 
Else 
Exit=1 
Endif 
Wend 
Next 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
dispel:
uo.usetype('0x1f62','')
wait(6000)
if uo.injournal('fizzles') then
  goto dispel
endif
end sub

############################################################### 
############################################################### 
; 
;                        Shared Subs 
; 
############################################################### 
############################################################### 

#============================================================== 
#  tohide() - try hidding char. When char lose HP, drink inviz 
#             potion if it found in backpack 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub tohide() 
   while NOT UO.Hidden() 
      UO.DeleteJournal() 
      UO.FindType('0x0F0E','0x0631','my') 

      if UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 then 
         UO.UseType('0x0F0E','0x0631') ; inviz potion 
         UO.Exec('warmode 0') 
         wait(2000) 
      else 
         UO.Exec('warmode 0') 
         UO.UseSkill('Stealth') 
         repeat 
            wait(50) 
         until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') 
      endif 
   wend 
end sub 


#============================================================== 
#  CheckLag() - click on backpack and awaiting "backpack" 
#               message in journal. 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub CheckLag() 
   UO.DeleteJournal() 
   UO.Click('backpack') 

   repeat 
      wait(500) 
   until UO.InJournal('backpack') 
end sub 


#============================================================== 
#  Gong(counter) - playing wav-file 'counter'-times 
#  http://www.jetta.ru/cow.wav 
#-------------------------------------------------------------- 
sub Gong(times) ; play wav-file 
   VAR i 
   for i=1 to times 
      UO.Exec("playwav d:\game\uo\injection\cow") 
      wait(1200) ; time to play sample at once 
   next 
end sub 


#============================================================== 
#  Alarm() - when char lose some HP, U are informed :) 
#-------------------------------------------------------------- 
sub Alarm() 
   VAR CharHP=150 
   while 1==1 
      wait(1000) 
      if UO.Life<CharHP then 
         gong(1) 
      endif       
   wend 
end sub 

;---------------- Ходилка ----------------------- 
sub GoW() 
   VAR walkwait=300 
   VAR x,y,dir=6 
   VAR key=36 ; Home key 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()+1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoN() 
   VAR walkwait=300 
   VAR x,y,dir=0 
   VAR key=33 ; PgUp 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()+1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoE() 
   VAR walkwait=300 
   VAR x,y,dir=2 
   VAR key=34 ; PgDown 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()-1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoS() 
   VAR walkwait=300 
   VAR x,y,dir=4 
   VAR key=35 ; End 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()-1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoWN() 
   VAR walkwait=300 
   VAR x,y,dir=7 
   VAR key=38 ; UpArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoNE() 
   VAR walkwait=300 
   VAR x,y,dir=1 
   VAR key=39 ; RightArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSE() 
   VAR walkwait=300 
   VAR x,y,dir=3 
   VAR key=40 ; DownArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSW() 
   VAR walkwait=300 
   VAR x,y,dir=5 
   VAR key=37 ; LeftArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


#============================================================== 
#  WalkN(X,Y,Serial) - char is walking by dX and dY step 
#                sub using Home, End, PgUp, PgDown keys 
#                d'not rebind this key from default action! 
#     walkwait - delay after keypress 
#-------------------------------------------------------------- 
sub WalkN(x,y,Target) 
   VAR i 
   VAR dx,dy,Exit=0 
    
   While Exit<>1    
      If Target<>"" Then 
         dx=UO.GetX(Target)-UO.GetX() 
         dy=UO.GetY(Target)-UO.GetY() 
;         UO.Print("Target locked!") 
         If UO.GetDistance(Target)<2 Then 
            Exit=1 
         Endif 
      Else 
         dx=x-UO.GetX() 
         dy=y-UO.GetY() 
         If dx==0 AND dy==0 Then 
            Exit=1 
         Endif 

      Endif 
    
      If dx<>0 AND dy<>0 Then 
         If dx>0 AND dy>0 Then 
            GoSE() 
         Endif 

         If dx>0 AND dy<0 Then 
            GoNE() 
         Endif 

         If dx<0 AND dy>0 Then 
            GoSW() 
         Endif 

         If dx<0 AND dy<0 Then 
            GoWN() 
         Endif 

      Endif 
    
      If dx<>0 AND dy==0 Then 
         If dx>0 Then 
            GoE() 
         Endif 
          
         If dx<0 Then 
            GoW() 
         Endif 
      Endif 


      If dx==0 AND dy<>0 Then 
         If dy>0 Then 
            GoS() 
         Endif 
          
         If dy<0 Then 
            GoN() 
         Endif 
      Endif 
   Wend 
Собсно вопрос как в нём исправить чтоб чар сначало диспелил вортексов а только потом лутал руду, а то на дрв щас исправили хайд со стелсом, тоесть при луте с пола вы автоматически раздетективаитесь.
Kynep
Expert!
Posts: 1348
Joined: 2006-02-07 08:51:40
Location: г. Старый Оскол
Contact:

Post by Kynep »

Dillersss wrote: Собсно вопрос как в нём исправить чтоб чар сначало диспелил вортексов а только потом лутал руду, а то на дрв щас исправили хайд со стелсом, тоесть при луте с пола вы автоматически раздетективаитесь.
Блин а в асе низя попросить было? Замени у себя эту функцию.

Code: Select all

;----------- Summon Energy Vortex, kill elem and loot him ----------- 
sub killelem() 
DIM Ore[4] 
Ore[0]='0x19B7' ; 1 ore 
Ore[1]='0x19BA' ; 2 ore 
Ore[2]='0x19B8' ; 3 ore 
Ore[3]='0x19B9' ; 4 and more ore 
var i, exit,l 
UO.DeleteJournal() 
UO.UnSetReceivingContainer() 
uo.usetype('0x0f0e','0x0631') 
wait(3000) 
povtor: 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(5000) 
if uo.injournal('spell fizzles') then 
goto povtor 
endif 
wait(13000) 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(10000) 

uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
dispel: 
uo.usetype('0x1f62','') 
wait(6000) 
if uo.injournal('fizzles') then 
  goto dispel 
endif 

For i=0 to 3 
Exit=0 
While Exit<>1 
UO.FindType(Ore[i],-1,'ground') 
If UO.GetQuantity('finditem')>0 then 
UO.Grab('all','finditem') 
CheckLag() 
Wait(1000) 
Else 
Exit=1 
Endif 
Wend 
Next 

end sub 
Dillersss
Posts: 39
Joined: 2007-08-11 16:44:45
Location: www.drw.ru

Post by Dillersss »

спасибо, да я вроде спросил :roll:
Kynep
Expert!
Posts: 1348
Joined: 2006-02-07 08:51:40
Location: г. Старый Оскол
Contact:

Post by Kynep »

Dillersss wrote:спасибо, да я вроде спросил :roll:
Ага спросил и удалился в офф )))
Dillersss
Posts: 39
Joined: 2007-08-11 16:44:45
Location: www.drw.ru

Post by Dillersss »

:D
Dillersss
Posts: 39
Joined: 2007-08-11 16:44:45
Location: www.drw.ru

Post by Dillersss »

Code: Select all

############################################################## 
#===---====----===---===---= Mining =---=-=-=-=-=--=-=-=-=-=-=# 
#    Single char mining for VIP Mine. DRW Shard www.drw.ru    # 
#           Scripted by Savage (c) 2005 ICQ:33336141          # 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
# To start script use ",exec mine" command from client window # 
############################################################### 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
;==================== Main mining script ====================== 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
sub mine() 
   VAR DigDistance, TileNum, KillElemental 
   VAR ElemSignal, LastTimer 
   DIM BaseX[4], BaseY[4] 
   VAR BaseZ, WayPoint, WayPoints 
   VAR MaxWeight 

   VAR i,j,TileY,TileX,DirX,DirY 
   VAR Delta,BeginX,EndX,BeginY,EndY 
    

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; TileNum='Num' - Use ",infotile" command on the floor 
; Номер тайла в котором можно копать ,потыкайте командой 
; ",infotile" по разнвм тайлам и посмотрите не отличаются ли их 
; номера. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   TileNum='1339' 
    

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Максимальный вес, который может поднять чар. Ставьте его 
; немного меньше реального. То есть если чар поднимает 760, то 
; ставим 730. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   MaxWeight=500 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; DigDistance=4 - Distance from tile where pickaxe targeting 
; Радиус круга по которому будет копать чар, то есть расстояние 
; до клетки куда можно дотянуться киркой. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   DigDistance=4 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; KillElemental='Yes'/'No' - Use 'Yes' if char skilled to morph 
;                            in daemon and wrestling > 50 
; Если чар достаточно прокачен чтоб бить элемов, ставьте 'Yes' 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   KillElemental='Yes' 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; ElemSignal='Off'/'On' - Play sound when elemental is digged 
; Оповешать при появлении элема 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   ElemSignal='Off' 


;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Здесь указываем координаты точек копания. Нужно встать на 
; позицию и посмотреть координаты в инжекте. Их и нужно 
; подставить вместо моих. Чара ставьте на 4 клетки от стен. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   BaseX[0]=5839 
   BaseY[0]=1213 
   BaseZ=0 

   BaseX[1]=5844
   BaseY[1]=1213 

   BaseX[2]=5850 
   BaseY[2]=1214 

   BaseX[3]=5846 
   BaseY[3]=1212 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Указываем количество точек копания 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   WayPoints=2 


   CheckLag() 
   UO.UseObject('Sunduk') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("Podoydi k sunduku i tkni v nego pricelom!") 
      UO.AddObject('Sunduk') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
      UO.UseObject('Sunduk') 
   Else 
;      UO.Say("Ok! Viju sunduk.") 
   Endif 


   CheckLag() 
   UO.UseObject('IronBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' Iron Ore") 
      UO.AddObject('IronBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya Iron Ore viju") 
   Endif 


   CheckLag() 
   UO.UseObject('OtherBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' rudu?") 
      UO.AddObject('OtherBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya rudy viju.") 
   Endif 


   CheckLag() 
   UO.UseObject('BestBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' vihu?") 
      UO.AddObject('BestBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya vihi viju.") 
   Endif 

   While NOT UO.Dead() 
    
      For WayPoint=0 to WayPoints-1
         walkn(BaseX[WayPoint],BaseY[WayPoint],"") 
         digitstay(MaxWeight,DigDistance,KillElemental,ElemSignal,BaseX[WayPoint],BaseY[WayPoint]) 
      Next 
   wend 
end sub 


; Проверка нужности руды. Закоментировать то что нужно копать. 
sub CheckOre() 
   VAR Cont=1, i=0, Exit=0 
   VAR Count=11   ; Сколько элементов в массиве. 
   DIM Ores[13]    

   Ores[0]="Iron"
   Ores[1]="Rusty" 
   Ores[2]="Old Copper" 
   Ores[3]="Dull Copper" 
   Ores[4]="Copper" 
   Ores[5]="Bronze" 
   Ores[6]="Silver" 
   Ores[7]="Gold" 
   Ores[8]="Rose" 
   Ores[9]="Shadow"
   Ores[10]="Agapite" 
   Ores[11]="Blood Rock" 
   Ores[12]="Verite" 
;   Ores[13]="Valorite" 
;   Ores[14]="Mytheril" 

   While i<Count AND Exit==0 
      If UO.InJournal(Ores[i]) Then 
         Cont=0 
         Exit=1 
      Endif 
;      UO.Print(STR(i)) 
;      UO.Print(Ores[i]) 
      i=i+1 
   Wend 
    
   return Cont 
end sub 


;-------------------- Try to mine under self ------------------ 
sub digitstay(MaxWeight,MaxDistance,KillElemental,ElemSignal,BaseX,BaseY) 
   VAR x,y,z='0',TileNum='1339' 
   VAR Last=0,LastTimer, ContFlag=1 
   VAR MaxTimer=110 

   For x=-MaxDistance to MaxDistance 
      For y=-MaxDistance to MaxDistance 
         Repeat 
            CheckLag() ; deleting journal 
            ToHide() 
             
            UO.WaitTargetTile(TileNum,STR(UO.GetX()+x),STR(UO.GetY()+Y),z) 
            UO.UseType('0x0E85') 

            LastTimer=UO.Timer() 

            Repeat 
               wait(500) 
            until UO.InJournal("Try mining") OR UO.InJournal("You put") OR UO.InJournal("You loosen") OR UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("OOPS") OR UO.InJournal("attacking you") OR LastTimer+200<UO.Timer() 

            If NOT UO.InJournal('There is no') then 
               ContFlag=CheckOre() 
            Endif 

            If UO.InJournal('You loosen') then 
               repeat 
                  wait(500) 
               until UO.InJournal("You put") OR LastTimer+MaxTimer<UO.Timer() 
            Endif 

            If UO.InJournal('something with ore') OR UO.InJournal("attacking you") then 
               If ElemSignal=='On' Then 
                  Gong(2) 
               Endif 

               If KillElemental=='Yes' Then 
                  KillElem() 
                  walkn(BaseX,BaseY,"") 
               Else 
; any user defined command when char digget elemental 

               Endif 
            Endif 
             
            If UO.InJournal("attacking you") then 
               gong(3) 
            Endif 

            If UO.Weight>=MaxWeight then 
               unloadore() 
            Endif 
         Until UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("Try mining") OR ContFlag==0 
      Next 
   Next 
end sub 


;------------------------- Unload ore ------------------------- 
sub unloadore() 
   VAR TempX,TempY,i,Exit, Exit1, ConTainer, j 
   VAR SundukX=5839 
   VAR SundukY=1216 
   VAR Index=14 ; количество элементов массива 
   DIM Ore[5], Colors[20] 

   Colors[0]="0x09F0" ; Gorgan 
   Colors[1]="0x09D3" ; Steel 
   Colors[3]="0x0BA7" ; Eldar 
   Colors[4]="0x08AF" ; Plut 
   Colors[5]="0x0085" ; Dragon 
   Colors[6]="0x0060" ; Aqua 
   Colors[7]="0x09E6" ; Elvin 
   Colors[8]="0x010F" ; Krinit 
   Colors[9]="0x09DA" ; Vulkan 
   Colors[10]="0x09EC" ; Blood Crest 
   Colors[11]="0x008F" ; Sand Rock 
   Colors[12]="0x09B9" ; Acid 
   Colors[13]="0x09A4" ; Crystaline 


   TempX=UO.GetX() 
   TempY=UO.GetY() 
    
   walkn(SundukX,SundukY,"") 
   ToHide() 
   UO.UseObject("Sunduk") 

   Ore[0]=0x19B9 ; 4 and more ore 
   Ore[1]=0x19B7 ; 1 ore 
   Ore[2]=0x19BA ; 2 ore 
   Ore[3]=0x19B8 ; 3 ore 

   For i=0 to 3 
      Exit=0 
      repeat 
         UO.FindType(Ore[i]) 
          
         if UO.GetQuantity('finditem')>0 then 
            If UO.GetColor('finditem')=='0x0000' Then 
               Container=UO.GetSerial('IronBag') 
            Else 
               Container=UO.GetSerial('OtherBag') 
               Exit1=0 
               j=0 
               While j<Index AND Exit1<>1 
                  If UO.GetColor('finditem')==Colors[j] Then 
                     Container=UO.GetSerial('BestBag') 
                     Exit1=1 
                  Endif 
                  j=j+1 
               Wend 
            Endif 
            UO.MoveItem('finditem',0,Container) 
            CheckLag() 
            wait(1000) 
         Else 
            Exit=1 
         endif 
      until Exit==1 
   Next 

   walkn(TempX,TempY,"") 
   ToHide() 
end sub 

;----------- Summon Energy Vortex, kill elem and loot him ----------- 
sub killelem() 
DIM Ore[4] 
Ore[0]='0x19B7' ; 1 ore 
Ore[1]='0x19BA' ; 2 ore 
Ore[2]='0x19B8' ; 3 ore 
Ore[3]='0x19B9' ; 4 and more ore 
var i, exit,l 
UO.DeleteJournal() 
UO.UnSetReceivingContainer() 
uo.usetype('0x0f0e','0x0631') 
wait(3000) 
povtor: 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(5000) 
if uo.injournal('spell fizzles') then 
goto povtor 
endif 
wait(13000) 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(10000) 

uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
dispel: 
uo.usetype('0x1f62','') 
wait(6000) 
if uo.injournal('fizzles') then 
  goto dispel 
endif 

For i=0 to 3 
Exit=0 
While Exit<>1 
UO.FindType(Ore[i],-1,'ground') 
If UO.GetQuantity('finditem')>0 then 
UO.Grab('all','finditem') 
CheckLag() 
Wait(1000) 
Else 
Exit=1 
Endif 
Wend 
Next 

end sub

############################################################### 
############################################################### 
; 
;                        Shared Subs 
; 
############################################################### 
############################################################### 

#============================================================== 
#  tohide() - try hidding char. When char lose HP, drink inviz 
#             potion if it found in backpack 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub tohide() 
   while NOT UO.Hidden() 
      UO.DeleteJournal() 
      UO.FindType('0x0F0E','0x0631','my') 

      if UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 then 
         UO.UseType('0x0F0E','0x0631') ; inviz potion 
         UO.Exec('warmode 0') 
         wait(2000) 
      else 
         UO.Exec('warmode 0') 
         UO.UseSkill('Stealth') 
         repeat 
            wait(50) 
         until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') 
      endif 
   wend 
end sub 


#============================================================== 
#  CheckLag() - click on backpack and awaiting "backpack" 
#               message in journal. 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub CheckLag() 
   UO.DeleteJournal() 
   UO.Click('backpack') 

   repeat 
      wait(500) 
   until UO.InJournal('backpack') 
end sub 


#============================================================== 
#  Gong(counter) - playing wav-file 'counter'-times 
#  http://www.jetta.ru/cow.wav 
#-------------------------------------------------------------- 
sub Gong(times) ; play wav-file 
   VAR i 
   for i=1 to times 
      UO.Exec("playwav d:\game\uo\injection\cow") 
      wait(1200) ; time to play sample at once 
   next 
end sub 


#============================================================== 
#  Alarm() - when char lose some HP, U are informed :) 
#-------------------------------------------------------------- 
sub Alarm() 
   VAR CharHP=150 
   while 1==1 
      wait(1000) 
      if UO.Life<CharHP then 
         gong(1) 
      endif       
   wend 
end sub 

;---------------- Ходилка ----------------------- 
sub GoW() 
   VAR walkwait=300 
   VAR x,y,dir=6 
   VAR key=36 ; Home key 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()+1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoN() 
   VAR walkwait=300 
   VAR x,y,dir=0 
   VAR key=33 ; PgUp 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()+1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoE() 
   VAR walkwait=300 
   VAR x,y,dir=2 
   VAR key=34 ; PgDown 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()-1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoS() 
   VAR walkwait=300 
   VAR x,y,dir=4 
   VAR key=35 ; End 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()-1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoWN() 
   VAR walkwait=300 
   VAR x,y,dir=7 
   VAR key=38 ; UpArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoNE() 
   VAR walkwait=300 
   VAR x,y,dir=1 
   VAR key=39 ; RightArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSE() 
   VAR walkwait=300 
   VAR x,y,dir=3 
   VAR key=40 ; DownArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSW() 
   VAR walkwait=300 
   VAR x,y,dir=5 
   VAR key=37 ; LeftArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


#============================================================== 
#  WalkN(X,Y,Serial) - char is walking by dX and dY step 
#                sub using Home, End, PgUp, PgDown keys 
#                d'not rebind this key from default action! 
#     walkwait - delay after keypress 
#-------------------------------------------------------------- 
sub WalkN(x,y,Target) 
   VAR i 
   VAR dx,dy,Exit=0 
    
   While Exit<>1    
      If Target<>"" Then 
         dx=UO.GetX(Target)-UO.GetX() 
         dy=UO.GetY(Target)-UO.GetY() 
;         UO.Print("Target locked!") 
         If UO.GetDistance(Target)<2 Then 
            Exit=1 
         Endif 
      Else 
         dx=x-UO.GetX() 
         dy=y-UO.GetY() 
         If dx==0 AND dy==0 Then 
            Exit=1 
         Endif 

      Endif 
    
      If dx<>0 AND dy<>0 Then 
         If dx>0 AND dy>0 Then 
            GoSE() 
         Endif 

         If dx>0 AND dy<0 Then 
            GoNE() 
         Endif 

         If dx<0 AND dy>0 Then 
            GoSW() 
         Endif 

         If dx<0 AND dy<0 Then 
            GoWN() 
         Endif 

      Endif 
    
      If dx<>0 AND dy==0 Then 
         If dx>0 Then 
            GoE() 
         Endif 
          
         If dx<0 Then 
            GoW() 
         Endif 
      Endif 


      If dx==0 AND dy<>0 Then 
         If dy>0 Then 
            GoS() 
         Endif 
          
         If dy<0 Then 
            GoN() 
         Endif 
      Endif 
   Wend 
Вставьте пожалусто суда реконектор, именно в этот скрипт, а то я хз как правильно его вставить туда что работало норм. :)
justme
Posts: 36
Joined: 2009-08-11 19:49:55

Re: DRW Vip mining

Post by justme »

Code: Select all

############################################################### 
#===---====----===---===---= Mining =---=-=-=-=-=--=-=-=-=-=-=# 
#    Single char mining for VIP Mine. DRW Shard www.drw.ru    # 
#           Scripted by Savage (c) 2005 ICQ:33336141          # 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
# To start script use ",exec mine" command from client window # 
############################################################### 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
;==================== Main mining script ====================== 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
sub mine() 
UO.Exec('terminate Reconnector') 
wait(1000) 
uo.exec('exec Reconnector') 
   VAR DigDistance, TileNum, KillElemental 
   VAR ElemSignal, LastTimer 
   DIM BaseX[2], BaseY[2] 
   VAR BaseZ, WayPoint, WayPoints 
   VAR MaxWeight 

   VAR i,j,TileY,TileX,DirX,DirY 
   VAR Delta,BeginX,EndX,BeginY,EndY 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; TileNum='Num' - Use ",infotile" command on the floor 
; Номер тайла в котором можно копать ,потыкайте командой 
; ",infotile" по разнвм тайлам и посмотрите не отличаются ли их 
; номера. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   TileNum='1339' 
    

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Максимальный вес, который может поднять чар. Ставьте его 
; немного меньше реального. То есть если чар поднимает 760, то 
; ставим 730. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   MaxWeight=380

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; DigDistance=4 - Distance from tile where pickaxe targeting 
; Радиус круга по которому будет копать чар, то есть расстояние 
; до клетки куда можно дотянуться киркой. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   DigDistance=4 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; KillElemental='Yes'/'No' - Use 'Yes' if char skilled to morph 
;                            in daemon and wrestling > 50 
; Если чар достаточно прокачен чтоб бить элемов, ставьте 'Yes' 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   KillElemental='Yes' 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; ElemSignal='Off'/'On' - Play sound when elemental is digged 
; Оповешать при появлении элема 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   ElemSignal='Off' 


;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Здесь указываем координаты точек копания. Нужно встать на 
; позицию и посмотреть координаты в инжекте. Их и нужно 
; подставить вместо моих. Чара ставьте на 4 клетки от стен. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   BaseX[0]=5775	 
   BaseY[0]=1053 
   BaseZ=0 

   BaseX[1]=5781 
   BaseY[1]=1053 

   BaseX[2]=5787 
   BaseY[2]=1053 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Указываем количество точек копания 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   WayPoints=3 


   CheckLag() 
   UO.UseObject('Sunduk') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("Podoydi k sunduku i tkni v nego pricelom!") 
      UO.AddObject('Sunduk') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
      UO.UseObject('Sunduk') 
   Else 
;      UO.Say("Ok! Viju sunduk.") 
   Endif 


   CheckLag() 
   UO.UseObject('IronBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' Iron Ore") 
      UO.AddObject('IronBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya Iron Ore viju") 
   Endif 


   CheckLag() 
   UO.UseObject('OtherBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' rudu?") 
      UO.AddObject('OtherBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya rudy viju.") 
   Endif 


   CheckLag() 
   UO.UseObject('BestBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' vihu?") 
      UO.AddObject('BestBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya vihi viju.") 
   Endif 

   While NOT UO.Dead() 
    
      For WayPoint=0 to WayPoints-1 
         walkn(BaseX[WayPoint],BaseY[WayPoint],"") 
         digitstay(MaxWeight,DigDistance,KillElemental,ElemSignal,BaseX[WayPoint],BaseY[WayPoint]) 
      Next 
   wend 
               If UO.InJournal('Elemental') then 
               UO.TextPrint('Elemental founded '+MakeTime()) 
end sub 


; Проверка нужности руды. Закоментировать то что нужно копать. 
sub CheckOre() 
   VAR Cont=1, i=0, Exit=0 
   VAR Count=0   ; Сколько элементов в массиве. 
   DIM Ores[15]    

;   Ores[0]="Rusty" 
;   Ores[1]="Old Copper" 
;   Ores[2]="Dull Copper" 
;   Ores[3]="Copper" 
;   Ores[4]="Bronze" 
;   Ores[5]="Silver" 
;   Ores[6]="Iron" 
;   Ores[7]="Shadow" 
;   Ores[8]="Rose" 
;   Ores[9]="Gold" 
;   Ores[10]="Agapite" 
;   Ores[11]="Blood Rock" 
;   Ores[12]="Verite" 
;   Ores[13]="Valorite" 
;   Ores[14]="Mytheril" 

   While i<Count AND Exit==0 
      If UO.InJournal(Ores[i]) Then 
         Cont=0 
         Exit=1 
      Endif 
;      UO.Print(STR(i)) 
;      UO.Print(Ores[i]) 
      i=i+1 
   Wend 
    
   return Cont 
end sub 


;-------------------- Try to mine under self ------------------ 
sub digitstay(MaxWeight,MaxDistance,KillElemental,ElemSignal,BaseX,BaseY) 
   VAR x,y,z='0',TileNum='1339' 
   VAR Last=0,LastTimer, ContFlag=1 
   VAR MaxTimer=110 

   For x=-MaxDistance to MaxDistance 
      For y=-MaxDistance to MaxDistance 
         Repeat 
            CheckLag() ; deleting journal 
            ToHide() 
              
            UO.WaitTargetTile(TileNum,STR(UO.GetX()+x),STR(UO.GetY()+Y),z) 
            UO.UseType('0x0E85') 

            LastTimer=UO.Timer() 

            Repeat 
               wait(500) 
            until UO.InJournal("Try mining") OR UO.InJournal("You put") OR UO.InJournal("You loosen") OR UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("OOPS") OR UO.InJournal("attacking you") OR LastTimer+200<UO.Timer() 

            If NOT UO.InJournal('There is no') then 
               ContFlag=CheckOre() 
            Endif 

            If UO.InJournal('You loosen') then 
               repeat 
                  wait(300) 
               until UO.InJournal("You put") OR LastTimer+MaxTimer<UO.Timer() 
            Endif 

            If UO.InJournal('something with ore') OR UO.InJournal("attacking you") then 
               If ElemSignal=='On' Then 
                  Gong(2) 
               Endif 

               If KillElemental=='Yes' Then 
                  KillElem() 
                  walkn(BaseX,BaseY,"") 
               Else 
; any user defined command when char digget elemental 

               Endif 
            Endif 
              
            If UO.InJournal("attacking you") then 
               gong(3) 
            Endif 

            If UO.Weight>=MaxWeight then 
               unloadore() 
            Endif 
         Until UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("Try mining") OR ContFlag==0 
      Next 
   Next 
end sub 


;------------------------- Unload ore ------------------------- 
sub unloadore() 
   VAR TempX,TempY,i,Exit, Exit1, ConTainer, j 
   VAR SundukX=6094 
   VAR SundukY=1216 
   VAR Index=14 ; количество элементов массива 
   DIM Ore[5], Colors[20] 

   Colors[0]="0x09F0" ; Gorgan 
   Colors[1]="0x09D3" ; Steel 
   Colors[3]="0x0BA7" ; Eldar 
   Colors[4]="0x08AF" ; Plut 
   Colors[5]="0x0085" ; Dragon 
   Colors[6]="0x0060" ; Aqua 
   Colors[7]="0x09E6" ; Elvin 
   Colors[8]="0x010F" ; Krinit 
   Colors[9]="0x09DA" ; Vulkan 
   Colors[10]="0x09EC" ; Blood Crest 
   Colors[11]="0x008F" ; Sand Rock 
   Colors[12]="0x09B9" ; Acid 
   Colors[13]="0x09A4" ; Crystaline 


   TempX=UO.GetX() 
   TempY=UO.GetY() 
    
   walkn(SundukX,SundukY,"") 
   ToHide() 
   UO.UseObject("Sunduk") 

   Ore[0]=0x19B9 ; 4 and more ore 
   Ore[1]=0x19B7 ; 1 ore 
   Ore[2]=0x19BA ; 2 ore 
   Ore[3]=0x19B8 ; 3 ore 

   For i=0 to 3 
      Exit=0 
      repeat 
         UO.FindType(Ore[i]) 
          
         if UO.GetQuantity('finditem')>0 then 
            If UO.GetColor('finditem')=='0x0000' Then 
               Container=UO.GetSerial('IronBag') 
            Else 
               Container=UO.GetSerial('OtherBag') 
               Exit1=0 
               j=0 
               While j<Index AND Exit1<>1 
                  If UO.GetColor('finditem')==Colors[j] Then 
                     Container=UO.GetSerial('BestBag') 
                     Exit1=1 
                  Endif 
                  j=j+1 
               Wend 
            Endif 
            UO.MoveItem('finditem',0,Container) 
            CheckLag() 
            wait(1000) 
         Else 
            Exit=1 
         endif 
      until Exit==1 
   Next 

   walkn(TempX,TempY,"") 
   ToHide() 
end sub 

;----------- Summon Energy Vortex, kill elem and loot him ----------- 
sub killelem() 
DIM Ore[4] 
Ore[0]='0x19B7' ; 1 ore 
Ore[1]='0x19BA' ; 2 ore 
Ore[2]='0x19B8' ; 3 ore 
Ore[3]='0x19B9' ; 4 and more ore 
var i, exit,l 
UO.DeleteJournal() 
UO.UnSetReceivingContainer() 
uo.usetype('0x0f0e','0x0631') 
wait(3000) 
povtor: 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(5000) 
if uo.injournal('spell fizzles') then 
goto povtor 
endif 
wait(13000) 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(10000) 

uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
dispel: 
uo.usetype('0x1f62','') 
wait(6000) 
if uo.injournal('fizzles') then 
  goto dispel 
endif 

For i=0 to 3 
Exit=0 
While Exit<>1 
UO.FindType(Ore[i],-1,'ground') 
If UO.GetQuantity('finditem')>0 then 
UO.Grab('all','finditem') 
CheckLag() 
Wait(1000) 
Else 
Exit=1 
Endif 
Wend 
Next 

end sub


############################################################### 
############################################################### 
; 
;                        Shared Subs 
; 
############################################################### 
############################################################### 

#============================================================== 
#  tohide() - try hidding char. When char lose HP, drink inviz 
#             potion if it found in backpack 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub tohide() 
   while NOT UO.Hidden() 
      UO.DeleteJournal() 
      UO.FindType('0x0F0E','0x0631','my') 

      if UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 then 
         UO.UseType('0x0F0E','0x0631') ; inviz potion 
         UO.Exec('warmode 0') 
         wait(2000) 
      else 
         UO.Exec('warmode 0') 
         UO.UseSkill('Stealth') 
         repeat 
            wait(50) 
         until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') 
      endif 
   wend 
end sub 


#============================================================== 
#  CheckLag() - click on backpack and awaiting "backpack" 
#               message in journal. 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub CheckLag() 
   UO.DeleteJournal() 
   UO.Click('backpack') 

   repeat 
      wait(500) 
   until UO.InJournal('backpack') 
end sub 


#============================================================== 
#  Gong(counter) - playing wav-file 'counter'-times 
#  http://www.jetta.ru/cow.wav 
#-------------------------------------------------------------- 
sub Gong(times) ; play wav-file 
   VAR i 
   for i=1 to times 
      UO.Exec("playwav C:\InformedFile.wav") 
      wait(1200) ; time to play sample at once 
   next 
end sub 


#============================================================== 
#  Alarm() - when char lose some HP, U are informed :) 
#-------------------------------------------------------------- 
sub Alarm() 
   VAR CharHP=190 
   while 1==1 
      wait(1000) 
      if UO.Life<CharHP then 
         gong(1) 
      endif        
   wend 
end sub 

;---------------- Ходилка ----------------------- 
sub GoW() 
   VAR walkwait=300 
   VAR x,y,dir=6 
   VAR key=36 ; Home key 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()+1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoN() 
   VAR walkwait=300 
   VAR x,y,dir=0 
   VAR key=33 ; PgUp 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()+1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoE() 
   VAR walkwait=300 
   VAR x,y,dir=2 
   VAR key=34 ; PgDown 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()-1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoS() 
   VAR walkwait=300 
   VAR x,y,dir=4 
   VAR key=35 ; End 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()-1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoWN() 
   VAR walkwait=300 
   VAR x,y,dir=7 
   VAR key=38 ; UpArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoNE() 
   VAR walkwait=300 
   VAR x,y,dir=1 
   VAR key=39 ; RightArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSE() 
   VAR walkwait=300 
   VAR x,y,dir=3 
   VAR key=40 ; DownArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSW() 
   VAR walkwait=300 
   VAR x,y,dir=5 
   VAR key=37 ; LeftArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 

#============================================================== 
#  WalkN(X,Y,Serial) - char is walking by dX and dY step 
#                sub using Home, End, PgUp, PgDown keys 
#                d'not rebind this key from default action! 
#     walkwait - delay after keypress 
#-------------------------------------------------------------- 
sub WalkN(x,y,Target) 
   VAR i 
   VAR dx,dy,Exit=0 
    
   While Exit<>1    
      If Target<>"" Then 
         dx=UO.GetX(Target)-UO.GetX() 
         dy=UO.GetY(Target)-UO.GetY() 
;         UO.Print("Target locked!") 
         If UO.GetDistance(Target)<2 Then 
            Exit=1 
         Endif 
      Else 
         dx=x-UO.GetX() 
         dy=y-UO.GetY() 
         If dx==0 AND dy==0 Then 
            Exit=1 
         Endif 

      Endif 
    
      If dx<>0 AND dy<>0 Then 
         If dx>0 AND dy>0 Then 
            GoSE() 
         Endif 

         If dx>0 AND dy<0 Then 
            GoNE() 
         Endif 

         If dx<0 AND dy>0 Then 
            GoSW() 
         Endif 

         If dx<0 AND dy<0 Then 
            GoWN() 
         Endif 

      Endif 
    
      If dx<>0 AND dy==0 Then 
         If dx>0 Then 
            GoE() 
         Endif 
          
         If dx<0 Then 
            GoW() 
         Endif 
      Endif 


      If dx==0 AND dy<>0 Then 
         If dy>0 Then 
            GoS() 
         Endif 
          
         If dy<0 Then 
            GoN() 
         Endif 
      Endif 
   Wend 
end sub 

sub Reconnector() 
var ReconnectTime, RFlag 
ReconnectTime = '0' 
RFlag = 1 
Repeat 
While (UO.ObjAtLayer('Bpack') == '') 
if RFlag Then 
ReconnectTime = MakeTime() 
RFlag = 0 
endif 
Wait(20000) # WorldSave Protection 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.LDblClick(357,164) 
UO.LClick(616,459) 
Wait(3000) 
WEnd 
Wait(3000) 
if (RFlag == 0) and (ReconnectTime <> '0') Then 
UO.Exec('terminate mine')  #сюда похоже нужно писать название другого скрипта, который нужно перезапустить после реконекта (для прокачки) 
wait(1000) 
UO.Exec('exec mine') 
UO.TextOpen() 
UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime) 
RFlag = 1 
ReconnectTime = '0' 
endif 
Until false 
end sub 

sub MakeTime() 
VAR D, T, Ret, i 
Ret = STR(UO.Time()) 
T = "" 
For i = 0 To Len(Ret) 
T = Ret[Len(Ret)-i] + T 
If (I == 2) OR (I == 4) Then 
T = ":" + T 
EndIf 
Next 
Ret = STR(UO.Date()) 
D = "" 
For i = 0 To Len(Ret) 
D = Ret[Len(Ret)-i] + D 
If (I == 2) OR (I == 4) Then 
D = "." + D 
EndIf 
Next 
Ret = T + " @ " + D 
RETURN Ret 
end sub 
justme
Posts: 36
Joined: 2009-08-11 19:49:55

Re: DRW Vip mining

Post by justme »

justme wrote:

Code: Select all

############################################################### 
#===---====----===---===---= Mining =---=-=-=-=-=--=-=-=-=-=-=# 
#    Single char mining for VIP Mine. DRW Shard www.drw.ru    # 
#           Scripted by Savage (c) 2005 ICQ:33336141          # 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
# To start script use ",exec mine" command from client window # 
############################################################### 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
;==================== Main mining script ====================== 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
sub mine() 
UO.Exec('terminate Reconnector') 
wait(1000) 
uo.exec('exec Reconnector') 
   VAR DigDistance, TileNum, KillElemental 
   VAR ElemSignal, LastTimer 
   DIM BaseX[2], BaseY[2] 
   VAR BaseZ, WayPoint, WayPoints 
   VAR MaxWeight 

   VAR i,j,TileY,TileX,DirX,DirY 
   VAR Delta,BeginX,EndX,BeginY,EndY 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; TileNum='Num' - Use ",infotile" command on the floor 
; Номер тайла в котором можно копать ,потыкайте командой 
; ",infotile" по разнвм тайлам и посмотрите не отличаются ли их 
; номера. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   TileNum='1339' 
    

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Максимальный вес, который может поднять чар. Ставьте его 
; немного меньше реального. То есть если чар поднимает 760, то 
; ставим 730. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   MaxWeight=380

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; DigDistance=4 - Distance from tile where pickaxe targeting 
; Радиус круга по которому будет копать чар, то есть расстояние 
; до клетки куда можно дотянуться киркой. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   DigDistance=4 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; KillElemental='Yes'/'No' - Use 'Yes' if char skilled to morph 
;                            in daemon and wrestling > 50 
; Если чар достаточно прокачен чтоб бить элемов, ставьте 'Yes' 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   KillElemental='Yes' 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; ElemSignal='Off'/'On' - Play sound when elemental is digged 
; Оповешать при появлении элема 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   ElemSignal='Off' 


;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Здесь указываем координаты точек копания. Нужно встать на 
; позицию и посмотреть координаты в инжекте. Их и нужно 
; подставить вместо моих. Чара ставьте на 4 клетки от стен. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   BaseX[0]=5775	 
   BaseY[0]=1053 
   BaseZ=0 

   BaseX[1]=5781 
   BaseY[1]=1053 

   BaseX[2]=5787 
   BaseY[2]=1053 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Указываем количество точек копания 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   WayPoints=3 


   CheckLag() 
   UO.UseObject('Sunduk') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("Podoydi k sunduku i tkni v nego pricelom!") 
      UO.AddObject('Sunduk') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
      UO.UseObject('Sunduk') 
   Else 
;      UO.Say("Ok! Viju sunduk.") 
   Endif 


   CheckLag() 
   UO.UseObject('IronBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' Iron Ore") 
      UO.AddObject('IronBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya Iron Ore viju") 
   Endif 


   CheckLag() 
   UO.UseObject('OtherBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' rudu?") 
      UO.AddObject('OtherBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya rudy viju.") 
   Endif 


   CheckLag() 
   UO.UseObject('BestBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' vihu?") 
      UO.AddObject('BestBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya vihi viju.") 
   Endif 

   While NOT UO.Dead() 
    
      For WayPoint=0 to WayPoints-1 
         walkn(BaseX[WayPoint],BaseY[WayPoint],"") 
         digitstay(MaxWeight,DigDistance,KillElemental,ElemSignal,BaseX[WayPoint],BaseY[WayPoint]) 
      Next 
   wend 
               If UO.InJournal('Elemental') then 
               UO.TextPrint('Elemental founded '+MakeTime()) 
end sub 


; Проверка нужности руды. Закоментировать то что нужно копать. 
sub CheckOre() 
   VAR Cont=1, i=0, Exit=0 
   VAR Count=0   ; Сколько элементов в массиве. 
   DIM Ores[15]    

;   Ores[0]="Rusty" 
;   Ores[1]="Old Copper" 
;   Ores[2]="Dull Copper" 
;   Ores[3]="Copper" 
;   Ores[4]="Bronze" 
;   Ores[5]="Silver" 
;   Ores[6]="Iron" 
;   Ores[7]="Shadow" 
;   Ores[8]="Rose" 
;   Ores[9]="Gold" 
;   Ores[10]="Agapite" 
;   Ores[11]="Blood Rock" 
;   Ores[12]="Verite" 
;   Ores[13]="Valorite" 
;   Ores[14]="Mytheril" 

   While i<Count AND Exit==0 
      If UO.InJournal(Ores[i]) Then 
         Cont=0 
         Exit=1 
      Endif 
;      UO.Print(STR(i)) 
;      UO.Print(Ores[i]) 
      i=i+1 
   Wend 
    
   return Cont 
end sub 


;-------------------- Try to mine under self ------------------ 
sub digitstay(MaxWeight,MaxDistance,KillElemental,ElemSignal,BaseX,BaseY) 
   VAR x,y,z='0',TileNum='1339' 
   VAR Last=0,LastTimer, ContFlag=1 
   VAR MaxTimer=110 

   For x=-MaxDistance to MaxDistance 
      For y=-MaxDistance to MaxDistance 
         Repeat 
            CheckLag() ; deleting journal 
            ToHide() 
              
            UO.WaitTargetTile(TileNum,STR(UO.GetX()+x),STR(UO.GetY()+Y),z) 
            UO.UseType('0x0E85') 

            LastTimer=UO.Timer() 

            Repeat 
               wait(500) 
            until UO.InJournal("Try mining") OR UO.InJournal("You put") OR UO.InJournal("You loosen") OR UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("OOPS") OR UO.InJournal("attacking you") OR LastTimer+200<UO.Timer() 

            If NOT UO.InJournal('There is no') then 
               ContFlag=CheckOre() 
            Endif 

            If UO.InJournal('You loosen') then 
               repeat 
                  wait(300) 
               until UO.InJournal("You put") OR LastTimer+MaxTimer<UO.Timer() 
            Endif 

            If UO.InJournal('something with ore') OR UO.InJournal("attacking you") then 
               If ElemSignal=='On' Then 
                  Gong(2) 
               Endif 

               If KillElemental=='Yes' Then 
                  KillElem() 
                  walkn(BaseX,BaseY,"") 
               Else 
; any user defined command when char digget elemental 

               Endif 
            Endif 
              
            If UO.InJournal("attacking you") then 
               gong(3) 
            Endif 

            If UO.Weight>=MaxWeight then 
               unloadore() 
            Endif 
         Until UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("Try mining") OR ContFlag==0 
      Next 
   Next 
end sub 


;------------------------- Unload ore ------------------------- 
sub unloadore() 
   VAR TempX,TempY,i,Exit, Exit1, ConTainer, j 
   VAR SundukX=6094 
   VAR SundukY=1216 
   VAR Index=14 ; количество элементов массива 
   DIM Ore[5], Colors[20] 

   Colors[0]="0x09F0" ; Gorgan 
   Colors[1]="0x09D3" ; Steel 
   Colors[3]="0x0BA7" ; Eldar 
   Colors[4]="0x08AF" ; Plut 
   Colors[5]="0x0085" ; Dragon 
   Colors[6]="0x0060" ; Aqua 
   Colors[7]="0x09E6" ; Elvin 
   Colors[8]="0x010F" ; Krinit 
   Colors[9]="0x09DA" ; Vulkan 
   Colors[10]="0x09EC" ; Blood Crest 
   Colors[11]="0x008F" ; Sand Rock 
   Colors[12]="0x09B9" ; Acid 
   Colors[13]="0x09A4" ; Crystaline 


   TempX=UO.GetX() 
   TempY=UO.GetY() 
    
   walkn(SundukX,SundukY,"") 
   ToHide() 
   UO.UseObject("Sunduk") 

   Ore[0]=0x19B9 ; 4 and more ore 
   Ore[1]=0x19B7 ; 1 ore 
   Ore[2]=0x19BA ; 2 ore 
   Ore[3]=0x19B8 ; 3 ore 

   For i=0 to 3 
      Exit=0 
      repeat 
         UO.FindType(Ore[i]) 
          
         if UO.GetQuantity('finditem')>0 then 
            If UO.GetColor('finditem')=='0x0000' Then 
               Container=UO.GetSerial('IronBag') 
            Else 
               Container=UO.GetSerial('OtherBag') 
               Exit1=0 
               j=0 
               While j<Index AND Exit1<>1 
                  If UO.GetColor('finditem')==Colors[j] Then 
                     Container=UO.GetSerial('BestBag') 
                     Exit1=1 
                  Endif 
                  j=j+1 
               Wend 
            Endif 
            UO.MoveItem('finditem',0,Container) 
            CheckLag() 
            wait(1000) 
         Else 
            Exit=1 
         endif 
      until Exit==1 
   Next 

   walkn(TempX,TempY,"") 
   ToHide() 
end sub 

;----------- Summon Energy Vortex, kill elem and loot him ----------- 
sub killelem() 
DIM Ore[4] 
Ore[0]='0x19B7' ; 1 ore 
Ore[1]='0x19BA' ; 2 ore 
Ore[2]='0x19B8' ; 3 ore 
Ore[3]='0x19B9' ; 4 and more ore 
var i, exit,l 
UO.DeleteJournal() 
UO.UnSetReceivingContainer() 
uo.usetype('0x0f0e','0x0631') 
wait(3000) 
povtor: 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(5000) 
if uo.injournal('spell fizzles') then 
goto povtor 
endif 
wait(13000) 
uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
wait(500) 
uo.usetype('0x1f66','') 
wait(10000) 

uo.WaitTargetTile("6044", str(UO.GetX()), str(UO.GetY()), str(UO.GetZ())) 
dispel: 
uo.usetype('0x1f62','') 
wait(6000) 
if uo.injournal('fizzles') then 
  goto dispel 
endif 

For i=0 to 3 
Exit=0 
While Exit<>1 
UO.FindType(Ore[i],-1,'ground') 
If UO.GetQuantity('finditem')>0 then 
UO.Grab('all','finditem') 
CheckLag() 
Wait(1000) 
Else 
Exit=1 
Endif 
Wend 
Next 

end sub


############################################################### 
############################################################### 
; 
;                        Shared Subs 
; 
############################################################### 
############################################################### 

#============================================================== 
#  tohide() - try hidding char. When char lose HP, drink inviz 
#             potion if it found in backpack 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub tohide() 
   while NOT UO.Hidden() 
      UO.DeleteJournal() 
      UO.FindType('0x0F0E','0x0631','my') 

      if UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 then 
         UO.UseType('0x0F0E','0x0631') ; inviz potion 
         UO.Exec('warmode 0') 
         wait(2000) 
      else 
         UO.Exec('warmode 0') 
         UO.UseSkill('Stealth') 
         repeat 
            wait(50) 
         until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') 
      endif 
   wend 
end sub 


#============================================================== 
#  CheckLag() - click on backpack and awaiting "backpack" 
#               message in journal. 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub CheckLag() 
   UO.DeleteJournal() 
   UO.Click('backpack') 

   repeat 
      wait(500) 
   until UO.InJournal('backpack') 
end sub 


#============================================================== 
#  Gong(counter) - playing wav-file 'counter'-times 
#  http://www.jetta.ru/cow.wav 
#-------------------------------------------------------------- 
sub Gong(times) ; play wav-file 
   VAR i 
   for i=1 to times 
      UO.Exec("playwav C:\InformedFile.wav") 
      wait(1200) ; time to play sample at once 
   next 
end sub 


#============================================================== 
#  Alarm() - when char lose some HP, U are informed :) 
#-------------------------------------------------------------- 
sub Alarm() 
   VAR CharHP=190 
   while 1==1 
      wait(1000) 
      if UO.Life<CharHP then 
         gong(1) 
      endif        
   wend 
end sub 

;---------------- Ходилка ----------------------- 
sub GoW() 
   VAR walkwait=300 
   VAR x,y,dir=6 
   VAR key=36 ; Home key 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()+1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoN() 
   VAR walkwait=300 
   VAR x,y,dir=0 
   VAR key=33 ; PgUp 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()+1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoE() 
   VAR walkwait=300 
   VAR x,y,dir=2 
   VAR key=34 ; PgDown 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()-1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoS() 
   VAR walkwait=300 
   VAR x,y,dir=4 
   VAR key=35 ; End 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()-1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoWN() 
   VAR walkwait=300 
   VAR x,y,dir=7 
   VAR key=38 ; UpArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoNE() 
   VAR walkwait=300 
   VAR x,y,dir=1 
   VAR key=39 ; RightArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSE() 
   VAR walkwait=300 
   VAR x,y,dir=3 
   VAR key=40 ; DownArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSW() 
   VAR walkwait=300 
   VAR x,y,dir=5 
   VAR key=37 ; LeftArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 

#============================================================== 
#  WalkN(X,Y,Serial) - char is walking by dX and dY step 
#                sub using Home, End, PgUp, PgDown keys 
#                d'not rebind this key from default action! 
#     walkwait - delay after keypress 
#-------------------------------------------------------------- 
sub WalkN(x,y,Target) 
   VAR i 
   VAR dx,dy,Exit=0 
    
   While Exit<>1    
      If Target<>"" Then 
         dx=UO.GetX(Target)-UO.GetX() 
         dy=UO.GetY(Target)-UO.GetY() 
;         UO.Print("Target locked!") 
         If UO.GetDistance(Target)<2 Then 
            Exit=1 
         Endif 
      Else 
         dx=x-UO.GetX() 
         dy=y-UO.GetY() 
         If dx==0 AND dy==0 Then 
            Exit=1 
         Endif 

      Endif 
    
      If dx<>0 AND dy<>0 Then 
         If dx>0 AND dy>0 Then 
            GoSE() 
         Endif 

         If dx>0 AND dy<0 Then 
            GoNE() 
         Endif 

         If dx<0 AND dy>0 Then 
            GoSW() 
         Endif 

         If dx<0 AND dy<0 Then 
            GoWN() 
         Endif 

      Endif 
    
      If dx<>0 AND dy==0 Then 
         If dx>0 Then 
            GoE() 
         Endif 
          
         If dx<0 Then 
            GoW() 
         Endif 
      Endif 


      If dx==0 AND dy<>0 Then 
         If dy>0 Then 
            GoS() 
         Endif 
          
         If dy<0 Then 
            GoN() 
         Endif 
      Endif 
   Wend 
end sub 

sub Reconnector() 
var ReconnectTime, RFlag 
ReconnectTime = '0' 
RFlag = 1 
Repeat 
While (UO.ObjAtLayer('Bpack') == '') 
if RFlag Then 
ReconnectTime = MakeTime() 
RFlag = 0 
endif 
Wait(20000) # WorldSave Protection 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.LDblClick(357,164) 
UO.LClick(616,459) 
Wait(3000) 
WEnd 
Wait(3000) 
if (RFlag == 0) and (ReconnectTime <> '0') Then 
UO.Exec('terminate mine')  #сюда похоже нужно писать название другого скрипта, который нужно перезапустить после реконекта (для прокачки) 
wait(1000) 
UO.Exec('exec mine') 
UO.TextOpen() 
UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime) 
RFlag = 1 
ReconnectTime = '0' 
endif 
Until false 
end sub 

sub MakeTime() 
VAR D, T, Ret, i 
Ret = STR(UO.Time()) 
T = "" 
For i = 0 To Len(Ret) 
T = Ret[Len(Ret)-i] + T 
If (I == 2) OR (I == 4) Then 
T = ":" + T 
EndIf 
Next 
Ret = STR(UO.Date()) 
D = "" 
For i = 0 To Len(Ret) 
D = Ret[Len(Ret)-i] + D 
If (I == 2) OR (I == 4) Then 
D = "." + D 
EndIf 
Next 
Ret = T + " @ " + D 
RETURN Ret 
end sub 
помогите пожалусто не скидываит оры в сундук ,он просто приходит и стоит передним и кликает на бекпак 1 раз , и припишыте штоп с сундука брал мас диспел скролы инвизки и вортексов и брал фиштики и кушал пожалусто :cry:
Savage
Expert!
Posts: 1205
Joined: 2004-04-04 11:13:54
Location: Балаково, Саратовская обл.
Contact:

Re: DRW Vip mining

Post by Savage »

Извольте :D
Обращаю внимание на пару модификаций.
1. Так как шахты в основном в коллективном пользовании, то добавлен ещё 1 ящик в котором и располагаются мешки с орами, еда, ресурсы ( в данном случае скролы )
2. Подправленая килялка элемов.

Code: Select all

############################################################### 
#===---====----===---===---= Mining =---=-=-=-=-=--=-=-=-=-=-=# 
#    Single char mining for VIP Mine. DRW Shard www.drw.ru    # 
#        Scripted by Savage (c) 2005-2010 ICQ:33336141        # 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""# 
# To start script use ",exec mine" command from client window # 
############################################################### 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
;==================== Main mining script ====================== 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
sub mine() 
UO.Exec('terminate Reconnector') 
wait(1000) 
uo.exec('exec Reconnector') 
   VAR DigDistance, TileNum, KillElemental 
   VAR ElemSignal, LastTimer 
   DIM BaseX[2], BaseY[2] 
   VAR BaseZ, WayPoint, WayPoints 
   VAR MaxWeight 

   VAR i,j,TileY,TileX,DirX,DirY 
   VAR Delta,BeginX,EndX,BeginY,EndY 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; TileNum='Num' - Use ",infotile" command on the floor 
; Номер тайла в котором можно копать ,потыкайте командой 
; ",infotile" по разнвм тайлам и посмотрите не отличаются ли их 
; номера. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   TileNum='1339' 
    

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Максимальный вес, который может поднять чар. Ставьте его 
; немного меньше реального. То есть если чар поднимает 760, то 
; ставим 730. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   MaxWeight=380

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; DigDistance=4 - Distance from tile where pickaxe targeting 
; Радиус круга по которому будет копать чар, то есть расстояние 
; до клетки куда можно дотянуться киркой. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   DigDistance=3

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; KillElemental='Yes'/'No' - Use 'Yes' if char skilled to morph 
;                            in daemon and wrestling > 50 
; Если чар достаточно прокачен чтоб бить элемов, ставьте 'Yes' 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   KillElemental='Yes' 

;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; ElemSignal='Off'/'On' - Play sound when elemental is digged 
; Оповешать при появлении элема 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
   ElemSignal='Off' 


;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Здесь указываем координаты точек копания. Нужно встать на 
; позицию и посмотреть координаты в инжекте. Их и нужно 
; подставить вместо моих. Чара ставьте на 4 клетки от стен. 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   BaseX[0]=5774	 
   BaseY[0]=1053 
   BaseZ=0 

   BaseX[1]=5781 
   BaseY[1]=1053 
 

   BaseX[2]=5788 
   BaseY[2]=1053 


;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
; Указываем количество точек копания 
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 

   WayPoints=3 


   CheckLag() 
   UO.UseObject('Sunduk') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("Podoydi k sunduku i tkni v nego pricelom!") 
      UO.AddObject('Sunduk') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
      UO.UseObject('Sunduk') 
   Else 
;      UO.Say("Ok! Viju sunduk.") 
   Endif 

   CheckLag() 
   UO.UseObject('MyBox') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.Timer()>LastTimer+100 

   If UO.InJournal('see the') Then 
      UO.Say("Pokaji yashik!") 
      UO.AddObject('MyBox') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
      UO.UseObject('MyBox') 
   Else 
;      UO.Say("Ok! Viju sunduk.") 
   Endif 


   CheckLag() 
   UO.UseObject('IronBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' Iron Ore") 
      UO.AddObject('IronBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya Iron Ore viju") 
   Endif 


   CheckLag() 
   UO.UseObject('OtherBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' rudu?") 
      UO.AddObject('OtherBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya rudy viju.") 
   Endif 


   CheckLag() 
   UO.UseObject('BestBag') 
   LastTimer=UO.Timer() 
   Repeat 
      wait(500) 
   Until UO.InJournal('You can') OR UO.InJournal('What is the')OR UO.Timer()>LastTimer+100 
    
   If UO.InJournal('see the') Then 
      UO.Say("V kakoy meshok kidat' vihu?") 
      UO.AddObject('BestBag') 
      While UO.Targeting()==2 
         wait(500) 
      Wend 
      UO.SaveConfig() 
   Else 
;      UO.Say("Meshok dlya vihi viju.") 
   Endif 

   While NOT UO.Dead() 
    
      For WayPoint=0 to WayPoints-1 
         walkn(BaseX[WayPoint],BaseY[WayPoint],"") 
         digitstay(MaxWeight,DigDistance,KillElemental,ElemSignal,BaseX[WayPoint],BaseY[WayPoint]) 
      Next 
   wend 
               If UO.InJournal('Elemental') then 
               UO.TextPrint('Elemental founded '+MakeTime()) 
end sub 


; Проверка нужности руды. Закоментировать то что нужно копать. 
sub CheckOre() 
   VAR Cont=1, i=0, Exit=0 
   VAR Count=0   ; Сколько элементов в массиве. 
   DIM Ores[15]    

;   Ores[0]="Rusty" 
;   Ores[1]="Old Copper" 
;   Ores[2]="Dull Copper" 
;   Ores[3]="Copper" 
;   Ores[4]="Bronze" 
;   Ores[5]="Silver" 
;   Ores[6]="Iron" 
;   Ores[7]="Shadow" 
;   Ores[8]="Rose" 
;   Ores[9]="Gold" 
;   Ores[10]="Agapite" 
;   Ores[11]="Blood Rock" 
;   Ores[12]="Verite" 
;   Ores[13]="Valorite" 
;   Ores[14]="Mytheril" 

   While i<Count AND Exit==0 
      If UO.InJournal(Ores[i]) Then 
         Cont=0 
         Exit=1 
      Endif 
;      UO.Print(STR(i)) 
;      UO.Print(Ores[i]) 
      i=i+1 
   Wend 
    
   return Cont 
end sub 


;-------------------- Try to mine under self ------------------ 
sub digitstay(MaxWeight,MaxDistance,KillElemental,ElemSignal,BaseX,BaseY) 
   VAR x,y,z='0',TileNum='1339' 
   VAR Last=0,LastTimer, ContFlag=1 
   VAR MaxTimer=110 

   For x=-MaxDistance to MaxDistance 
      For y=-MaxDistance to MaxDistance 
         Repeat 
            CheckLag() ; deleting journal 
            ToHide() 
              
            UO.WaitTargetTile(TileNum,STR(UO.GetX()+x),STR(UO.GetY()+Y),z) 
            UO.UseType('0x0E85') 

            LastTimer=UO.Timer() 

            Repeat 
               wait(500) 
            until UO.InJournal("Try mining") OR UO.InJournal("You put") OR UO.InJournal("You loosen") OR UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("OOPS") OR UO.InJournal("attacking you") OR LastTimer+200<UO.Timer() 

            If NOT UO.InJournal('There is no') then 
               ContFlag=CheckOre() 
            Endif 

            If UO.InJournal('You loosen') then 
               repeat 
                  wait(300) 
               until UO.InJournal("You put") OR LastTimer+MaxTimer<UO.Timer() 
            Endif 

            If UO.InJournal('something with ore') OR UO.InJournal("attacking you") then 
               If ElemSignal=='On' Then 
                  Gong(2) 
               Endif 

               If KillElemental=='Yes' Then 
                  KillElem() 
                  walkn(BaseX,BaseY,"") 
               Else 
; any user defined command when char digget elemental 

               Endif 
            Endif 
              
            If UO.InJournal("attacking you") then 
               gong(3) 
            Endif 

            If UO.Weight>=MaxWeight then 
               unloadore() 
            Endif 
         Until UO.InJournal("There is no") OR UO.InJournal("That is too") OR UO.InJournal("Try mining") OR ContFlag==0 
      Next 
   Next 
end sub 


;------------------------- Unload ore ------------------------- 
sub unloadore() 
   VAR TempX,TempY,i,Exit, Exit1, ConTainer, j 
   VAR SundukX=5773 
   VAR SundukY=1056 
   VAR Index=14 ; количество элементов массива 
   DIM Ore[5], Colors[20] 

   Colors[0]="0x09F0" ; Gorgan 
   Colors[1]="0x09D3" ; Steel 
   Colors[3]="0x0BA7" ; Eldar 
   Colors[4]="0x08AF" ; Plut 
   Colors[5]="0x0085" ; Dragon 
   Colors[6]="0x0060" ; Aqua 
   Colors[7]="0x09E6" ; Elvin 
   Colors[8]="0x010F" ; Krinit 
   Colors[9]="0x09DA" ; Vulkan 
   Colors[10]="0x09EC" ; Blood Crest 
   Colors[11]="0x008F" ; Sand Rock 
   Colors[12]="0x09B9" ; Acid 
   Colors[13]="0x09A4" ; Crystaline 


   TempX=UO.GetX() 
   TempY=UO.GetY() 
    
   walkn(SundukX,SundukY,"") 
   ToHide() 
   UO.UseObject("Sunduk") 
   UO.UseObject("MyBox") 

   Ore[0]=0x19B9 ; 4 and more ore 
   Ore[1]=0x19B7 ; 1 ore 
   Ore[2]=0x19BA ; 2 ore 
   Ore[3]=0x19B8 ; 3 ore 

   For i=0 to 3 
      Exit=0 
      repeat 
         UO.FindType(Ore[i]) 
          
         if UO.GetQuantity('finditem')>0 then 
            If UO.GetColor('finditem')=='0x0000' Then 
               Container=UO.GetSerial('IronBag') 
            Else 
               Container=UO.GetSerial('OtherBag') 
               Exit1=0 
               j=0 
               While j<Index AND Exit1<>1 
                  If UO.GetColor('finditem')==Colors[j] Then 
                     Container=UO.GetSerial('BestBag') 
                     Exit1=1 
                  Endif 
                  j=j+1 
               Wend 
            Endif 
            UO.MoveItem('finditem',0,Container) 
            CheckLag() 
            wait(1000) 
         Else 
            Exit=1 
         endif 
      until Exit==1 
   Next 

	UO.FindType('0x0EED',-1,'backpack')
	wait(500)
	If UO.FindCount() Then
		UO.MoveItem('finditem','all','MyBox')
		wait(500)
		CheckLag()
	Endif

	UO.FindType('0x0F0E','0x0000','backpack')
	wait(500)
	If UO.FindCount() Then
		UO.MoveItem('finditem','all','MyBox')
		wait(500)
		CheckLag()
	Endif

	LoadRes()

   walkn(TempX,TempY,"") 
   ToHide() 
end sub 


sub LoadRes()
	VAR EdaType='0x097B'
	VAR WaitTime=300, InPack
	VAR Scrolls=10
	VAR Potions=10
	VAR VortInPack=0, MassInPack=0
	
; Eda
	UO.FindType(EdaType,-1,'MyBox')
	wait(WaitTime)
	If UO.FindCount() Then
		UO.MoveItem('finditem',100,'backpack')
		wait(WaitTime)
		CheckLag()
	Endif

	CheckLag()
	Repeat
		UO.UseType(EdaType)
		wait(1000)
	Until UO.InJournal('You can')

	UO.FindType(EdaType,-1,'backpack')
	wait(WaitTime)
	If UO.FindCount() Then
		UO.MoveItem('finditem','all','MyBox')
		wait(WaitTime)
		CheckLag()
	Endif

; Inviz
	UO.FindType('0x0F0E','0x0631','backpack')
	wait(WaitTime)
	InPack=UO.GetQuantity('finditem')
	IF InPack<Potions Then
		UO.FindType('0x0F0E','0x0631','MyBox')
		wait(WaitTime)
		If UO.FindCount() Then
			UO.MoveItem('finditem',Potions-InPack,'backpack')
			wait(WaitTime)
		Endif
	Endif

; Vortex
Vort:
	UO.IgnoreReset()
	UO.FindType('0x1F66',-1,'backpack')
	While UO.FindCount()
		VortInPack=VortInPack+UO.GetQuantity('finditem')
		wait(WaitTime)
		UO.Ignore('finditem')
		UO.FindType('0x1F66',-1,'backpack')
	Wend
	
	IF VortInPack<Scrolls Then
		UO.FindType('0x1F66',-1,'MyBox')
		wait(WaitTime)
		If UO.FindCount() Then
			UO.MoveItem('finditem',Scrolls-VortInPack,'backpack')
			wait(WaitTime)
			Goto Vort
		Endif
	Endif

; Dispell
Dispell:
	UO.IgnoreReset()
	UO.FindType('0x1F62',-1,'backpack')
	While UO.FindCount()
		MassInPack=MassInPack+UO.GetQuantity('finditem')
		wait(WaitTime)
		UO.Ignore('finditem')
		UO.FindType('0x1F62',-1,'backpack')
	Wend
	
	IF MassInPack<Scrolls Then
		UO.FindType('0x1F62',-1,'MyBox')
		wait(WaitTime)
		If UO.FindCount() Then
			UO.MoveItem('finditem',Scrolls-MassInPack,'backpack')
			wait(WaitTime)
			Goto Dispell
		Endif
	Endif
	UO.IgnoreReset()
end sub


;----------- Summon Energy Vortex, kill elem and loot him ----------- 
sub killelem() 
	var xx,yy,m
	DIM Ore[4] 
	Ore[0]='0x19B7' ; 1 ore 
	Ore[1]='0x19BA' ; 2 ore 
	Ore[2]='0x19B8' ; 3 ore 
	Ore[3]='0x19B9' ; 4 and more ore 
	var i, Exit,l 

	UO.Set('finddistance',10)

	uo.usetype('0x0f0e','0x0631') ;inviz
	wait(3000) 

;0x000D vortex

povtor: 
	UO.DeleteJournal() 

	m=UO.Mana
;	uo.cast('Energy Vortex','self')  
	UO.WaitTargetSelf()
	uo.usetype('0x1f66')
	While UO.Mana>=m
		wait(300)
	Wend
	if uo.injournal('spell fizzles') then 
		goto povtor 
	endif 
	wait(1000)
	
jdat:
	UO.FindType('0x0010',-1,'ground')
	wait(300)
	If UO.FindCount() Then
		UO.FindType('0x000D',-1,'ground')
		wait(300)
		If UO.FindCount() Then
			wait(1000)
			goto jdat
		Else
			goto povtor
		End if
	End if

dispel: 
	m=UO.Mana
	UO.DeleteJournal()
;	uo.cast('Mass Dispel','self')
	UO.WaitTargetSelf()
	UO.UseType('0x1F62')
	While UO.Mana>=m
		wait(300)
	Wend
	if uo.injournal('fizzles') then 
		goto dispel
	end if 

	xx=UO.GetX() 
	yy=UO.Gety()
	For i=0 to 3 
		UO.FindType(Ore[i],-1,'ground') 
		If UO.GetQuantity('finditem')>0 then 
			Walkn(0,0,'finditem')
			UO.Grab('all','finditem') 
			CheckLag() 
			UO.FindType('0x0EED',-1,'ground') 
			If UO.FindCount() Then
				UO.Grab('all','finditem')
			End if
		Endif 
	Next 
Walkn(xx,yy,'')
end sub 



############################################################### 
############################################################### 
; 
;                        Shared Subs 
; 
############################################################### 
############################################################### 

#============================================================== 
#  tohide() - try hidding char. When char lose HP, drink inviz 
#             potion if it found in backpack 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub tohide() 
   while NOT UO.Hidden() 
      UO.DeleteJournal() 
      UO.FindType('0x0F0E','0x0631','my') 

      if UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 then 
         UO.UseType('0x0F0E','0x0631') ; inviz potion 
         UO.Exec('warmode 0') 
         wait(2000) 
      else 
         UO.Exec('warmode 0') 
         UO.UseSkill('Stealth') 
         repeat 
            wait(50) 
         until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') 
      endif 
   wend 
end sub 


#============================================================== 
#  CheckLag() - click on backpack and awaiting "backpack" 
#               message in journal. 
# 
#  Journal has been deleted!!! 
#-------------------------------------------------------------- 
sub CheckLag() 
   UO.DeleteJournal() 
   UO.Click('backpack') 

   repeat 
      wait(500) 
   until UO.InJournal('backpack') 
end sub 


#============================================================== 
#  Gong(counter) - playing wav-file 'counter'-times 
#  http://www.jetta.ru/cow.wav 
#-------------------------------------------------------------- 
sub Gong(times) ; play wav-file 
   VAR i 
   for i=1 to times 
      UO.Exec("playwav C:\InformedFile.wav") 
      wait(1200) ; time to play sample at once 
   next 
end sub 


#============================================================== 
#  Alarm() - when char lose some HP, U are informed :) 
#-------------------------------------------------------------- 
sub Alarm() 
   VAR CharHP=190 
   while 1==1 
      wait(1000) 
      if UO.Life<CharHP then 
         gong(1) 
      endif        
   wend 
end sub 

;---------------- Ходилка ----------------------- 
sub GoW() 
   VAR walkwait=300 
   VAR x,y,dir=6 
   VAR key=36 ; Home key 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()+1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoN() 
   VAR walkwait=300 
   VAR x,y,dir=0 
   VAR key=33 ; PgUp 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()+1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoE() 
   VAR walkwait=300 
   VAR x,y,dir=2 
   VAR key=34 ; PgDown 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetX()-1==x Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoS() 
   VAR walkwait=300 
   VAR x,y,dir=4 
   VAR key=35 ; End 
   x=UO.GetX() 
   y=UO.GetY() 
   while UO.GetDir()<>dir 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   wend 
   UO.Press(key) 

   wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
    
   If UO.GetY()-1==y Then 
      return -1 
   Else 
      return 1 
   Endif 
end sub 


sub GoWN() 
   VAR walkwait=300 
   VAR x,y,dir=7 
   VAR key=38 ; UpArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoNE() 
   VAR walkwait=300 
   VAR x,y,dir=1 
   VAR key=39 ; RightArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSE() 
   VAR walkwait=300 
   VAR x,y,dir=3 
   VAR key=40 ; DownArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 


sub GoSW() 
   VAR walkwait=300 
   VAR x,y,dir=5 
   VAR key=37 ; LeftArrow 
   x=UO.GetX() 
   y=UO.GetY() 

   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 

   If UO.GetDir()==dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If x==UO.GetX() AND y==UO.GetY() Then 
         CheckLag() 
      Endif 
      If UO.GetDir()==dir Then 
         return -1 
      Else 
         return UO.GetDir() 
      Endif 
   Else 
      return UO.GetDir() 
   Endif 
end sub 

#============================================================== 
#  WalkN(X,Y,Serial) - char is walking by dX and dY step 
#                sub using Home, End, PgUp, PgDown keys 
#                d'not rebind this key from default action! 
#     walkwait - delay after keypress 
#-------------------------------------------------------------- 
sub WalkN(x,y,Target) 
   VAR i 
   VAR dx,dy,Exit=0 
    
   While Exit<>1    
      If Target<>"" Then 
         dx=UO.GetX(Target)-UO.GetX() 
         dy=UO.GetY(Target)-UO.GetY() 
;         UO.Print("Target locked!") 
         If UO.GetDistance(Target)<2 Then 
            Exit=1 
         Endif 
      Else 
         dx=x-UO.GetX() 
         dy=y-UO.GetY() 
         If dx==0 AND dy==0 Then 
            Exit=1 
         Endif 

      Endif 
    
      If dx<>0 AND dy<>0 Then 
         If dx>0 AND dy>0 Then 
            GoSE() 
         Endif 

         If dx>0 AND dy<0 Then 
            GoNE() 
         Endif 

         If dx<0 AND dy>0 Then 
            GoSW() 
         Endif 

         If dx<0 AND dy<0 Then 
            GoWN() 
         Endif 

      Endif 
    
      If dx<>0 AND dy==0 Then 
         If dx>0 Then 
            GoE() 
         Endif 
          
         If dx<0 Then 
            GoW() 
         Endif 
      Endif 


      If dx==0 AND dy<>0 Then 
         If dy>0 Then 
            GoS() 
         Endif 
          
         If dy<0 Then 
            GoN() 
         Endif 
      Endif 
   Wend 
end sub 

sub Reconnector() 
var ReconnectTime, RFlag 
ReconnectTime = '0' 
RFlag = 1 
Repeat 
While (UO.ObjAtLayer('Bpack') == '') 
if RFlag Then 
ReconnectTime = MakeTime() 
RFlag = 0 
endif 
Wait(20000) # WorldSave Protection 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.Say('') 
Wait(3000) 
UO.LDblClick(357,164) 
UO.LClick(616,459) 
Wait(3000) 
WEnd 
Wait(3000) 
if (RFlag == 0) and (ReconnectTime <> '0') Then 
UO.Exec('terminate mine')  #сюда похоже нужно писать название другого скрипта, который нужно перезапустить после реконекта (для прокачки) 
wait(1000) 
UO.Exec('exec mine') 
UO.TextOpen() 
UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime) 
RFlag = 1 
ReconnectTime = '0' 
endif 
Until false 
end sub 

sub MakeTime() 
VAR D, T, Ret, i 
Ret = STR(UO.Time()) 
T = "" 
For i = 0 To Len(Ret) 
T = Ret[Len(Ret)-i] + T 
If (I == 2) OR (I == 4) Then 
T = ":" + T 
EndIf 
Next 
Ret = STR(UO.Date()) 
D = "" 
For i = 0 To Len(Ret) 
D = Ret[Len(Ret)-i] + D 
If (I == 2) OR (I == 4) Then 
D = "." + D 
EndIf 
Next 
Ret = T + " @ " + D 
RETURN Ret 
end sub 
Savage
Expert!
Posts: 1205
Joined: 2004-04-04 11:13:54
Location: Балаково, Саратовская обл.
Contact:

Re: DRW Vip mining

Post by Savage »

Поправил первый пост со скриптом.
Mirage
Posts: 2802
Joined: 2009-05-28 09:58:28
Location: Иваново
Contact:

Re: DRW Vip mining

Post by Mirage »

UO.WaitTargetTile(TileNum,STR(UO.GetX()+x),STR(UO.GetY()+Y),z)

не лучше использовать более 1 тайла? :roll:

TileNum='1339' указан 2 раза вверху и в тексте
Savage
Expert!
Posts: 1205
Joined: 2004-04-04 11:13:54
Location: Балаково, Саратовская обл.
Contact:

Re: DRW Vip mining

Post by Savage »

Не существенно.
Post Reply