Мининг на точках

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
TpABKa
Posts: 2
Joined: 2006-07-27 20:48:24
Contact:

Мининг на точках

Post by TpABKa »

Уважаемый народ ! :)
Прошу вас помочь со скриптом на мининг
Суть такова: Нужно что бы чар ходил по точкам которые брал из файла (тем самым в фаил их заношу я (.set))
Заранее спасибо!
Ex-Brodyaga
Junior Expert
Posts: 150
Joined: 2004-04-12 20:26:41

Post by Ex-Brodyaga »

Code: Select all

###########################################################
#   Main Mining Function! Conf. Needed (look above)
############################################################
sub go_mining()
   var cycle=1 # 1 - çàöèêëèðîâàòü, 0 - íåò
   var path="9k5ki9o3oi9k3ki9o2oi9kk9l8o5n" # âñå â êàâû÷êàõ î÷èñòèòü âíà÷àëå ñêðèïòà
   var test=0
   var i=0
   var j
   #UO.SetCatchBag("oresBag")
   UO.DeleteJournal()   

   While i<LEN(path)
      if VAL(path[i]) then
         j=VAL(path[i])
         i=i+1
      else
         j=1
      endif

      Repeat
         if test<>1 then
            UO.DeleteJournal()
            mine_spot()
         end if       

         UO.Print("New Location!")
         if not make_step(path[i]) then
            UO.Print("Probably Stuck!")
            UO.Print("Hope it is a Worldsave")
         endif
         j=j-1
      Until j==0
       
      i = i + 1
      if cycle && i==LEN(path) then
         i=0
      endif
   Wend
end sub

############################################################
#   Auxilliar Function. Little mod needed (look above)
############################################################
sub mine_spot()
UO.DeleteJournal()
   var maxMineTime=7000
   var times=0
   var timeout=0
   var try=0
   ToHide()
   While (UO.InJournal("There is no")OR UO.InJournal("Try mining") OR UO.InJournal("Òóò íå îñòàëîñü") or try>6)==0
    try=try+1
    UO.Print("Try = "+str(try))
   	UO.Print("Mining time!")
   	UO.DeleteJournal()
   	UO.WaitTargetTile("1339",STR(UO.GetX()),STR(UO.GetY()),"0")
   	UO.UseType("0x0E85")
   	timeout=0
   	times = times +1
   	if times>20 then
    	wait(maxMineTime)
   		 times = 0
   	endif
   		Repeat
   		   timeout=timeout+1000
  		   Wait(1000)
      		#UO.Print("Waiting...")
    	Until UO.InJournal("You put") OR UO.InJournal("There is no ore") OR UO.InJournal("Try mining") OR UO.InJournal("You loosen")OR UO.InJournal("Òóò íå îñòàëîñü") OR timeout>maxMineTime
   Wend
   return 0
end sub

############################################################
#   Main Path-Recording function!
############################################################
sub record_path()
   var x
   var y
   var path=""
   UO.DeleteJournal()
   Repeat
      x=UO.GetX()
      y=UO.GetY()
      if waitNewPos(x,y) then
         path=path+extract_dir(x,y,UO.GetX(),UO.GetY())
      endif
   Until UO.InJournal("stop")
   path = compressPath(path)
   UO.TextClear()
   UO.TextOpen()
   UO.TextPrint("Your path is:")
   UO.TextPrint(path)
end sub

############################################################
#   Auxilliar sub.
############################################################
sub send_step(keycode,dir)
   var x = UO.GetX()
   var y = UO.GetY()
   var timeout = 0
   if UO.GetDir()<>dir then
      UO.Press(keycode)
      Repeat
         wait(50)
      Until UO.GetDir()==dir
   endif
   UO.Press(keycode)
   Repeat
      timeout=timeout+50
      wait(50)
   Until x<>UO.GetX() || y<>UO.GetY() || timeout>2000
   if timeout>2000 then
      return 0
   endif
   return 1
end sub

############################################################
#   Bunch of auxilliar subs. No need to change anything!
############################################################
sub waitNewPos(x,y)
   while x==UO.GetX() && y==UO.GetY()
      if UO.InJournal("stop") then
         return 0
      endif
   wend
   return 1
end sub

sub compressPath(path)
   Var i=0
   Var j=0
   Var newPath=""
   while i<LEN(path)
      j=1
      while path[i]==path[i+1] AND j<9
         i=i+1
         j=j+1
      wend
      if j==1 then
         newPath=newPath+path[i]
      else
         newPath=newPath+STR(j)+path[i]
      endif
      i=i+1
   wend
   return newPath
end sub

sub extract_dir(x,y,a,b)
   if x>a then
      if y==b then
         return "i"
      else
         if y>b then
            return "n"
         else
            return "w"
         endif
      endif
   else
      if x<a then
         if y==b then
            return "l"
         else
            if y>b then
               return "e"
            else
               return "s"
            endif
         endif
      else
         if y>b then
            return "o"
         else
            return "k"
         endif
      endif
   endif
end sub

sub make_step(dir)
   if dir=="e" then
      send_step(39,1)
      return 1
   endif
   if dir=="l" then
      send_step(34,2)
      return 1
   endif
   if dir=="s" then
      send_step(40,3)
      return 1
   endif
   if dir=="k" then
      send_step(35,4)
      return 1
   endif
   if dir=="w" then
      send_step(37,5)
      return 1
   endif
   if dir=="i" then
      send_step(36,6)
      return 1
   endif
   if dir=="n" then
      send_step(38,7)
      return 1
   endif
   if dir=="o" then
      send_step(33,0)
      return 1
   endif
   if dir=="d" then
      While UO.Count("0x19b9")
         UO.Drop("0x19b9")
         wait(1000)
      Wend
      wait(200)
      return 1
   endif
   UO.Print("Recall Time!")
   return 0
end sub 

sub ToHide()
while not uo.Hidden()
uo.Print('Hidding...')
uo.DeleteJournal()
uo.UseSkill('Stealth')
wait(6000)
wend
wait(100)
end sub
врубаешь record_path и ходишь по своему маршруту, а когда прошёл говоришь чаром stop появится окно со стокой, её втавляй в скрипт в строке где path и включай go_mining и будет тебе счастье ;)
TpABKa
Posts: 2
Joined: 2006-07-27 20:48:24
Contact:

Post by TpABKa »

вроде пробывал а он не хо4ет ходить -(
XpyCmuK
Posts: 62
Joined: 2004-10-20 06:04:42

Post by XpyCmuK »

Code: Select all

var path="9k5ki9o3oi9k3ki9o2oi9kk9l8o5n"
Значение свое поставил??
Lord
Posts: 56
Joined: 2005-01-14 20:05:16
Contact:

Post by Lord »

У меня очень странная ошибка, обошел всю шахту строку земенил. Включил go_mining, скрипт использует кирку, сервак спрашивает где копать, но прицел никуда не направляется, после 7 таких пустых попыток, чар идет дальше и так во всей шахте. Помогите разобраться.
Dominator
Posts: 124
Joined: 2005-04-06 05:53:47

Post by Dominator »

Вообщем вот скрипт,тама ты только тайлы поменяй на свои (за смотри все внимательно обьснять я недумаю что надо тама слишком просто всё)

Code: Select all

sub Na4alokopki()
while gotoxy(3669,2175,0)
Mining()
GoToHome()
GoToMine()
gotoxy(3665,2175,0)
Mining()
GoToHome()
GoToMine()
gotoxy(3661,2175,0)
Mining()
GoToHome()
GoToMine()
gotoxy(3657,2175,0)
Mining()
GoToHome()
GoToMine()
gotoxy(3653,2175,0)
Mining()
GoToHome()
GoToMine()
gotoxy(3649,2175,0)
Mining()
GoToHome()
GoToMine()
gotoxy(3645,2175,0)
Mining()
GoToHome()
GoToMine()
gotoxy(3641,2175,0)
Mining()
GoToHome()
GoToMine()
wend
end sub

sub GoToHome()
gotoxy(3662,2175,0)
gotoxy(3662,2193,0)
gotoxy(3655,2193,0)
gotoxy(3655,2207,0)
gotoxy(3637,2207,0)
gotoxy(3637,2207,0)
gotoxy(3637,2211,0)
loot()
end sub

sub GoToMine()
gotoxy(3637,2209,0)
gotoxy(3655,2207,0)
gotoxy(3655,2193,0)
gotoxy(3662,2193,0)
gotoxy(3662,2175,0)
gotoxy(3669,2175,0)
end sub


sub Mining()
     var x,y,z, n 
     VAR LastTimer 
  UO.Set('finddistance','2') 
    n=0 
    z=UO.GetZ("self") 
       for x=-2 to 2 
       for y=-2 to 2 
      UO.Print(str(x)+" "+str(y)) 
           Repeat 
              if UO.InJournal('TORMOZ') then 
                pause() 
              endif 
              UO.DeleteJournal()              
              UO.Warmode("0") 
              UO.WaitTargetTile("1341",STR(UO.GetX()+x),STR(UO.GetY()+Y),str(z)) 
              UO.UseType('0x0E85') 
              LastTimer=UO.Timer() 
              Repeat 
                 wait(500) 
              Until UO.InJournal("You put") or UO.InJournal("can't see") or UO.InJournal("heavy") or UO.InJournal("stop") or UO.InJournal("location") or UO.InJournal("no ore") or UO.InJournal("but fail") or UO.InJournal("far away") or UO.InJournal("in rock") or UO.InJournal("must wait") or UO.InJournal("nothing") or UO.InJournal("elsewhere") or UO.InJournal("where it") OR UO.Timer()>LastTimer+200 
              if UO.InJournal("You put") then 
                  n=0 
              else 
                 n=n+1 
              endif 
           Until UO.InJournal("nothing") or UO.InJournal("elsewhere") or UO.InJournal("no ore here") or UO.InJournal("location") or UO.InJournal("far away") or UO.InJournal("in rock") or UO.InJournal("where it") or n>=5 
        next 
     next 
end sub

sub loot()    ; 
begin:
if uo.waiting() then 
uo.canceltarget() 
endif 
VAR a,Exit 
VAR UnloadCont='0x400115BA' ; ID sunduka  
DIM Ore[5] 
Ore[0]=0x19B9 ; 4 and more ore 
Ore[1]=0x19B7 ; 1 ore 
Ore[2]=0x19BA ; 2 ore 
Ore[3]=0x19B8 ; 3 ore 
UO.SetReceivingContainer(UnloadCont) 
wait(500) 
For a=0 to 3 
Exit=0 
repeat 
UO.FindType(Ore[a]) 
if UO.GetQuantity('finditem')>0 then 
UO.Grab('0','finditem') 
wait(1500) 
Else 
Exit=1 
endif 
until Exit==1 
Next 
UO.UnSetReceivingContainer() 
end sub 



sub gotoxy(x,y,prec) 
var ld=0,ldc=0 
var dx,dy 
var mx,my 
var ox,oy,mk,k 
#uo.print(">") 
#uo.track("1",str(x),str(y)) 
start: 
mx=UO.GetX() 
my=UO.GetY() 
dx=mx-x 
if dx<0 then 
dx=0-dx 
endif 
dy=my-y 
if dy<0 then 
dy=0-dy 
endif 
if dy>dx then 
dx=dy 
end if 
if dx<=prec then 
return 
end if 
if not ldc then 
uo.print(STR(dx)) 
end if 
if dx<3 then 
mk=70 
else 
mk=15 
end if 
ox=mx 
oy=my 
for k=1 to mk 
mx=UO.GetX() 
my=UO.GetY() 
if mx<>ox or my<>oy then 
goto sdidapl 
end if 
wait(10) 
next 
sdidapl: 
mx=UO.GetX() 
my=UO.GetY() 
dx=mx-x 
if dx<0 then 
dx=0-dx 
endif 
dy=my-y 
if dy<0 then 
dy=0-dy 
endif 
if dy>dx then 
dx=dy 
end if 
if dx<=prec then 
return 
end if 
if ld==dx then 
ldc=ldc+1 
if ldc>100 then 
uo.print("Can not reach location!") 
return 
end if 
else 
ld=dx 
end if 
if mx==x then 
if my==y then 
return 
endif 
if my>y then 
#UO.Print("UR") 
UO.Press(33) 
goto start 
endif 
#UO.Print("DL") 
UO.Press(35) 
goto start 
end if 
if mx<x then 
if my>y then 
#UO.Print("R") 
UO.Press(39) 
goto start 
endif 
if my==y then 
#UO.Print("DR") 
UO.Press(34) 
goto start 
endif 
#UO.Print("D") 
UO.Press(40) 
goto start 
end if 
if my<y then 
#UO.Print("L") 
UO.Press(37) 
goto start 
endif 
if my==y then 
#UO.Print("LU") 
UO.Press(36) 
goto start 
endif 
#UO.Print("U") 
UO.Press(38) 
goto start 
end sub
=== ? Como es tas ? ===
CHECK
Posts: 6
Joined: 2005-09-08 22:37:56

Post by CHECK »

да не человек имел ввиду
что он хочет такой скрипт
чтобы как ламбер сначало типо деревья задаешь потом он их рубит
вот и мининг такой необходим
типо каумшки по лесу забиндил и фигаршь капаешь )))
вот
CHECK
Posts: 6
Joined: 2005-09-08 22:37:56

Post by CHECK »

XpyCmuK wrote:

Code: Select all

var path="9k5ki9o3oi9k3ki9o2oi9kk9l8o5n"
Значение свое поставил??
эм а че тама за значение ?
Dominator
Posts: 124
Joined: 2005-04-06 05:53:47

Post by Dominator »

CHECK wrote:да не человек имел ввиду
что он хочет такой скрипт
чтобы как ламбер сначало типо деревья задаешь потом он их рубит
вот и мининг такой необходим
типо каумшки по лесу забиндил и фигаршь капаешь )))
вот
Ясно,я прост непонял сразу. а потипу ламбера я сделать немогу ыыы
я ламбер никогда некачал
=== ? Como es tas ? ===
rtyr
Posts: 3
Joined: 2006-02-13 21:03:18
Contact:

Post by rtyr »

Ex-Brodyaga wrote:

Code: Select all

###########################################################
#   Main Mining Function! Conf. Needed (look above)
############################################################
sub go_mining()
   var cycle=1 # 1 - çàöèêëèðîâàòü, 0 - íåò
   var path="9k5ki9o3oi9k3ki9o2oi9kk9l8o5n" # âñå â êàâû÷êàõ î÷èñòèòü âíà÷àëå ñêðèïòà[/quote]

а можно на русском
Post Reply