прошу добавить в скрипт на Mining....

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
kexwer
Posts: 159
Joined: 2005-06-19 19:21:28

прошу добавить в скрипт на Mining....

Post by kexwer »

Чтобы докапывал кочку до конца, а то копнёт 1 раз и сразу к другой уходит, и можно ли сделать рекол домой сложить в сундук и обратно в шахту... Очень прошу помочь...
Заранее благодарю!!!

А вот скрипт :

Code: Select all

var OreLimit=400
var q, w, p 
var f=file("C:\uo\Injection\mineShahta.txt") 

################################################
sub main()
UO.DeleteJournal()
var Minepoints, Mine1
var i 
dim PX[50], PY[50] 
uo.Print('Loading from file...') 
f.open() 
Mine1=safe call f.ReadNumber() 
Minepoints=1
for i=1 to 30 
    PX[i]=safe call f.ReadNumber() 
    PY[i]=safe call f.ReadNumber() 
next 
f.close() 
uo.Print('Загружено точек... '+str(i)) 
wait(300) 
	while not UO.Dead()
		for p=1 to 30 
			  uo.concolor(0x0003)
  			  uo.Print('X- '+str(PX[p])+' Y- '+str(PY[p])) 
  			  uo.Print('Иду к точке...'+str(p))
  			  WalkN(PX[p],PY[p],'')
  			  uo.Print('Начинаю копать в точке... '+str(p)) 
 			  UO.Warmode("0") 
   			  mine(PX,PY) 
   			  wait(300)
		next 
	wend
end sub 
################################################
sub Mark() 
dim PX[50], PY[50] 
var Minepoints=0 
var i 
uo.Print('Начинаю марчить...') 
for i=1 to 50 
  UO.DeleteJournal() 
  uo.Print('Set point '+ str(i)) 
  repeat 
     wait(500) 
     if UO.InJournal('stop')then 
        SaveToFile(i-1,PX,PY) 
        return 
     endif 
  until UO.InJournal('set') 
    PX[i] = UO.GetX("self") 
    PY[i] = UO.GetY("self") 
    uo.Print('Point '+str(i)+' X- '+str(PX[i])+' Y- '+str(PY[i])+' есть') 
next 
end sub 
############################# 
sub SaveToFile(mp,PX,PY) 
var s=0,k=0 
f.open() 
f.create() 
uo.Print('points = '+ str(mp)) 
   s=safe call f.writeln(mp) 
for k=1 to mp 
   s=safe call f.writeln(str(PX[k])+' '+str(PY[k])) 
next 
f.close() 
end sub 
################################## 
sub mine(PX,PY) 
   var x,y,z,kz,jz,summ,art
   art=0
   Dim Ores[4]
   Dim Ruda[9]
   Dim Cvet[9]
   Ores[1]=0x19B9 ; 4 and more ore 
   Ores[2]=0x19B7 ; 1 ore 
   Ores[3]=0x19BA ; 2 ore 
   Ores[4]=0x19B8 ; 3 ore 
   Cvet[1]=0x04FD
   Cvet[2]=0x0817
   Cvet[3]=0x0498
   Cvet[4]=0x05B7
   Cvet[5]=0x04A1
   Cvet[6]=0x049C
   Cvet[7]=0x0000
   Cvet[8]=0x04EA
   Cvet[9]=0x062D
   VAR LastTimer 
   UO.Set('finddistance','2') 
   z=UO.GetZ("self") 
   uo.concolor(0x19B9)
      for x=-2 to 2 
         for y=-2 to 2 
         UO.Print("Копаю в ("+str(x)+" "+str(y)+")  Точка - "+str(p)) 
            repeat
			   UO.DeleteJournal() 
			   uo.print('Удаляю журнал майне')
			   Summ=0
  	 	       for kz=1 to 4
					Summ=Summ+uo.Count(Ores[kz])
			next
				for kz=1 to 9
					Ruda[kz]=0
						for jz=1 to 4
							Ruda[kz]=Ruda[kz]+uo.Count(Ores[jz],Cvet[kz])
						next
				next
			 uo.Print('У вас всего '+str(Summ)+' ингов - ') 
			 uo.Print(str(Ruda[1])+' титан, ' +str(Ruda[2])+' раптор, '+str(Ruda[3])+' стил')
            		 uo.Print(str(Ruda[4])+' блекрок, ' +str(Ruda[5])+' мифрил, '+str(Ruda[6])+' ацид')
            		 uo.Print(str(Ruda[8])+' дайм-д, ' +str(Ruda[9])+' валор, '+str(Ruda[7])+' ирона')
			 uo.exec('warmode 0')
			 UO.WaitTargetTile("1341",STR(UO.GetX()+x),STR(UO.GetY()+Y),str(z)) 
             UO.UseType('0x0E85') 
             LastTimer=UO.Timer() 
                Repeat 
             	  	wait(300) 
             	Until UO.InJournal("You put") or UO.InJournal("Opps") or UO.InJournal("can't see") or UO.InJournal("must wait") or UO.InJournal("elsewhere") or UO.InJournal("where it")or UO.InJournal("nothing") or UO.InJournal("no ore") or UO.InJournal("location") or UO.InJournal("far away") or UO.InJournal("in rock") or uo.Timer()>LastTimer+100 or UO.InJournal("fail")
             	  	if UO.InJournal("fail") then
             	  		art=art+1
             	  	end if
             	  	if art==4 then
    	         	  	 UO.DeleteJournal() 
     	         	  	wait(7000)
				art=0
             	  	end if
           Until UO.InJournal("You put") or UO.InJournal("Opps") or UO.InJournal("can't see") or UO.InJournal("must wait") or UO.InJournal("elsewhere") or UO.InJournal("where it")or UO.InJournal("nothing") or UO.InJournal("no ore") or UO.InJournal("location") or UO.InJournal("far away") or UO.InJournal("in rock") or uo.Timer()>LastTimer+100 and not UO.InJournal("fail")
               if UO.Weight>OreLimit-20 then
        
        	end if
           next 

      next 
end sub 
####################################
sub Sell() 
UO.Say(".sell") 
UO.Waittargettype('0x1008',0x0000) 
wait(1000) 
UO.LClick(341,315)   #клик по Ок 
wait(300)
end sub 
######################################### 
sub CheckLag()
if uo.Waiting()>0 then 
uo.Exec('canceltarget') 
end if 
uo.Click('backpack') 
repeat 
wait(50) 
until uo.InJournal('backpack') 
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 
 
################################## 
#============================================================== 
#  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! 
#       serial - Serial of target or "" - string 
#     walkwait - delay after keypress 
#     Example: 
#     WalkN(2080,2113,'') - go to coordinates 
#     WalkN(0,0,'0x12345678') - go to target position 
#-------------------------------------------------------------- 
sub WalkN(x,y,Target) 
   VAR i,StepSucess 
   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 
            StepSucess=Go(3,40,0) ;SE - DownArrow 
            If StepSucess==-1 Then 
               StepSucess=Go(7,38,0) ;WN - UpArrow 
               StepSucess=Go(1,39,0) ;NE - RightArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(5,37,0) ;SW - LeftArrow 
               Endif 
            Endif 
         Endif 

         If dx>0 AND dy<0 Then 
            StepSucess=Go(1,39,0) ;NE - RightArrow 
            If StepSucess==-1 Then 
               StepSucess=Go(5,37,0) ;SW - LeftArrow 
               StepSucess=Go(3,40,0) ;SE - DownArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(7,38,0) ;WN - UpArrow 
               Endif 
            Endif 
         Endif 

         If dx<0 AND dy>0 Then 
            StepSucess=Go(5,37,0) ;SW - LeftArrow 
            If StepSucess==-1 Then 
               StepSucess=Go(1,39,0) ;NE - RightArrow 
               StepSucess=Go(7,38,0) ;WN - UpArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(3,40,0) ;SE - DownArrow 
               Endif 
            Endif 
         Endif 

         If dx<0 AND dy<0 Then 
            StepSucess=Go(7,38,0) ;WN - UpArrow 
            If StepSucess==-1 Then 
               StepSucess=Go(3,40,0) ;SE - DownArrow 
               StepSucess=Go(5,37,0) ;SW - LeftArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(1,39,0) ;NE - RightArrow 
               Endif 
            Endif 
         Endif 

      Endif 
    
      If dx<>0 AND dy==0 Then 
         If dx>0 Then 
            StepSucess=Go(2,34,0) ;E - PgDown 
            If StepSucess==-1 Then 
               StepSucess=Go(3,40,0) ;SE - DownArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(1,39,0) ;NE - RightArrow 
               Endif 
               StepSucess=Go(2,34,0) ;E - PgDown 
            Endif 
         Endif 
          
         If dx<0 Then 
            StepSucess=Go(6,36,0) ;W - Home 
            If StepSucess==-1 Then 
               StepSucess=Go(7,38,0) ;WN - UpArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(5,37,0) ;SW - LeftArrow 
               Endif 
               StepSucess=Go(6,36,0) ;W - Home 
            Endif 
         Endif 
      Endif 

      If dx==0 AND dy<>0 Then 
         If dy>0 Then 
            StepSucess=Go(4,35,0) ;S - End 
            If StepSucess==-1 Then 
               StepSucess=Go(3,40,0) ;SE - DownArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(5,37,0) ;SW - LeftArrow 
               Endif 
               StepSucess=Go(4,35,0) ;S - End 
            Endif 
         Endif 
          
         If dy<0 Then 
            StepSucess=Go(0,33,0) ;N - PgUp 
            If StepSucess==-1 Then 
               StepSucess=Go(1,39,0) ;NE - RightArrow 
               If StepSucess==-1 Then 
                  StepSucess=Go(7,38,0) ;WN - UpArrow 
               Endif 
               StepSucess=Go(0,33,0) ;N - PgUp 
            Endif 
         Endif 
      Endif 
   Wend 
end sub 
###############################################################
sub Go(dir,key,walkwait) 
   VAR x,y, OldDir 
   x=UO.GetX() 
   y=UO.GetY() 
   OldDir=UO.GetDir() 
   If UO.GetDir()<>dir Then 
      UO.Press(key) 
      wait(walkwait) 
      If UO.GetDir()<>dir Then 
         CheckLag() 
      Endif 
   Endif 
   UO.Press(key) 
   wait(walkwait) 
   If x==UO.GetX() AND y==UO.GetY() Then 
      CheckLag() 
   Endif 
   If x==UO.GetX() AND y==UO.GetY() AND OldDir<>UO.GetDir() Then 
      UO.Press(key) 
      wait(walkwait) 
   Endif 
   If x==UO.GetX() AND y==UO.GetY() Then 
      CheckLag() 
   Endif 
      If x==UO.GetX() AND y==UO.GetY() Then 
      UO.Print("Zasada!") 
      return -1 
   Else 
      return 1 
   Endif 
end sub
kexwer
Posts: 159
Joined: 2005-06-19 19:21:28

Post by kexwer »

Можно хотябы сделать, чтобы копал пока кочка не закончилась...
Помогите пожалуста
kexwer
Posts: 159
Joined: 2005-06-19 19:21:28

Post by kexwer »

Никто не поможет :(?
kexwer
Posts: 159
Joined: 2005-06-19 19:21:28

Post by kexwer »

Ну пожалуста.... Как сделать, чтобы до конца кочку выкапывал ?
Leo
Expert!
Posts: 791
Joined: 2005-01-15 19:15:05
Location: Dragon World
Contact:

Post by Leo »

По сообщениям в журнале. Надо удалить сообщение You put :wink:
kexwer
Posts: 159
Joined: 2005-06-19 19:21:28

Post by kexwer »

Неет... Дело в том, что он капает и когда любую руду выкопал переходит к следующей кочке!!! И получаеться,что весь метал до конца не выкапывает... :(
kexwer
Posts: 159
Joined: 2005-06-19 19:21:28

Post by kexwer »

Ну подскажите пожалуста... ОЧЕНЬ ПРОШУ
neokron111
Posts: 17
Joined: 2005-08-15 02:25:50

Post by neokron111 »

Code: Select all

sub Mining()
var mx, my, mz, i, j, z
for z = 1 to 100 
mx = UO.GetX("self")
my = UO.GetY("self")
mz = UO.GetZ("self")
UO.DeleteJournal()
hide()
for i = mx-2 to mx+2
	for j = my -2 to my +2
		UO.Print("Now Mining In: "+str(mx-i)+" "+str(my-j))
		while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("where") and not UO.InJournal("in rock") and not UO.InJournal("iron")
hide()			
UO.DeleteJournal()
			UO.Waittargettile("1341", str(i), str(j), str(mz))
			UO.Usetype("0x0e85")
			while not UO.InJournal("You put") and not UO.InJournal("location") and not UO.InJournal("no ore") and not UO.InJournal("but fail") and not UO.InJournal("where") and not UO.InJournal("no ore here") and not UO.InJournal("far away") and not UO.InJournal("in rock") 
				wait (100)
			wend
		wend
		UO.DeleteJournal()
	next
next
		UO.Press(34)
			wait(100)
		UO.Press(34)
			wait(100)
		UO.Press(34)
			wait(100)
		UO.Press(34)
			wait(100)
next
end sub

sub hide() 
 while not UO.Hidden() 
   uo.WarMode("0") 
   uo.UseSkill("Hiding") 
     wait(1500) 
 wend 
end sub
Post Reply