Подправьте плиз скрипт

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
slonik123
Posts: 21
Joined: 2006-09-08 10:16:01

Подправьте плиз скрипт

Post by slonik123 »

Народ помогите пожалуиста со скриптом я марчу точки и когда чар проходит по ним скрипт останавливаеться немогли бы вы его подправить чтоб он с последнееи точки шел опять на первую и так по кругу чтоб ненадо было запусткать его по нескольку раз
З.Ы. заранее огромное спасибо







Code: Select all

var OreLimit=300 
var q, w, p 
var f=file("C:\mine.dat") 

################################################ 
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 
           while not UO.Hidden() 
           UO.Warmode("0") 
           uo.print("Прячемся...") 
           UO.UseSkill("Hiding") 
           wait(4000) 
           wend 
         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 
                  sell() 
           end if 
           next 

      next 
end sub 
#################################### 
sub Sell() 
UO.Say(".sell") 
UO.Waittargettype('0x19b9',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

ЗЫ:

Code: Select all

Код, кооод!
В следующий раз удалю, как рецедивиста!
GimFlex
Expert!
Posts: 766
Joined: 2005-01-07 13:22:19
Contact:

Post by GimFlex »

Code: Select all

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 
а тут все нормально скорее всего ты неправильно что то настроил
slonik123
Posts: 21
Joined: 2006-09-08 10:16:01

Post by slonik123 »

блин странно а то он мне какуюто ошибку постоянно выдает
GimFlex
Expert!
Posts: 766
Joined: 2005-01-07 13:22:19
Contact:

Post by GimFlex »

slonik123 wrote:блин странно а то он мне какуюто ошибку постоянно выдает
какую?
slonik123
Posts: 21
Joined: 2006-09-08 10:16:01

Post by slonik123 »

Line 228:Bad operation for this type of variable-DX


вот ету и все становиться
GimFlex
Expert!
Posts: 766
Joined: 2005-01-07 13:22:19
Contact:

Post by GimFlex »

slonik123 wrote:Line 228:Bad operation for this type of variable-DX


вот ету и все становиться
попробуй другую ходилку
Post Reply