Вот у меня на ламбер такой скрипт он ходит рубит но после того как обходит все деревья которые я ему отметил перестаёт рубить и приходиться скрипт запускать по новой подскажите что делать?
Var Hatchet1='0x0F43'
Var Hatchet2='0x0F44'
Var MoveDelay=300
Var MoveNumber=2
Var Ep=0.172
Var FileName='D:\in\lamder1.dat'
Sub Main()
while 1
UO.DeleteJournal()
Lumb()
wait(3000)
wend
EndSub
Sub Lumb()
Var Tl,T,X,Y,Z
UO.SetGlobal('process','yes')
Var F=File(FileName)
F.Open()
Beg:
DeleteJournal('no logs')
DeleteJournal('immune to your')
Tl=safecall F.Readln()
Tl=Trim(Tl)
If Tl=='File read error' Then
GoTo Ext
EndIf
T=GetNumb(Tl,0)
X=GetNumb(Tl,1)
Y=GetNumb(Tl,2)
Z=GetNumb(Tl,3)
UO.Print('Chop hext tree')
UO.Print('Tile '+Tl)
GoToTile(X,Y,1,False)
Repeat
DeleteJournal('logs in your pack')
DeleteJournal('fail to produce')
EquipHatchet()
UO.WaitTargetTile(Str(T),Str(X),Str(Y),Str(Z))
UO.UseObject(UO.ObjAtLayer('Lhand'))
While not (UO.InJournal('logs in your pack') or UO.InJournal('fail to produce') or UO.InJournal('no logs') or UO.InJournal('heavy') or UO.InJournal('immune to your') or UO.InJournal('foliage yields'))
Wait(100)
Wend
UO.Print('There are '+Str(UO.Count('0x1BDD'))+' logs in the pack')
Until UO.InJournal('no logs') or UO.InJournal('heavy') or UO.InJournal('immune to your') or UO.InJournal('foliage yields')
If UO.InJournal('no logs') or UO.InJournal('immune to your') or UO.InJournal('foliage yields') Then
UO.Print('There are no logs here to chop')
GoTo Beg
EndIf
Ext:
F.Close()
UO.SetGlobal('process','no')
EndSub
Sub GetNumb(C,I)
var J,T,K
J=0
K=1
While K>0
J=J+1
If (Mid(C,J,1)==' ') Or (J>=Len(C)-1) Then
If I==0 Then
T=Val(Left(C,J))
Else
T=GetNumb(Right(C,Len(C)-J-1),I-1)
EndIf
K=0
EndIf
wend
UO.Print(T)
return T
endsub
Sub EquipHatchet()
Var E=UO.ObjAtLayer('Lhand')
E=UO.GetGraphic(E)
Var J=True
If (E<>Hatchet1) and (E<>Hatchet2) Then
If UO.Count(Hatchet1)>0 Then
UO.FindType(Hatchet1,'-1','backpack')
Else
If UO.Count(Hatchet2)>0 Then
UO.FindType(Hatchet2,'-1','backpack')
Else
UO.SetGlobal('process','no')
J=False
EndIf
EndIf
UO.UseObject('finditem')
EndIf
Wait(3200)
RETURN J
EndSub
Sub Perp(Dir)
Var D
D=Dir
If Dir==1 Then
D=3
EndIf
If Dir==2 Then
D=4
EndIf
If Dir==3 Then
D=-1
EndIf
If Dir==4 Then
D=-2
EndIf
If Dir==-1 Then
D=-3
EndIf
If Dir==-2 Then
D=-4
EndIf
If Dir==-3 Then
D=1
EndIf
If Dir==-4 Then
D=2
EndIf
RETURN D
EndSub
Sub MoveOnce(Dir,Del,Rev)
Var Num
If Rev Then
Num=MoveNumber+1
Else
Num=MoveNumber
EndIf
If (Num>0) and (Dir<>0) Then
If Dir==1 Then
UO.Press(38,Num,Del)
EndIf
If Dir==2 Then
UO.Press(33,Num,Del)
EndIf
If Dir==3 Then
UO.Press(39,Num,Del)
EndIf
If Dir==4 Then
UO.Press(34,Num,Del)
EndIf
If Dir==-1 Then
UO.Press(40,Num-1,Del)
EndIf
If Dir==-2 Then
UO.Press(35,Num,Del)
EndIf
If Dir==-3 Then
UO.Press(37,Num,Del)
EndIf
If Dir==-4 Then
UO.Press(36,Num,Del)
EndIf
If Rev Then
If Dir<>-1 Then
UO.Press(40,1,Del)
EndIf
EndIf
EndIf
EndSub
Sub GetQDir(x,y)
Var J=0
If X==0 Then
J=1
Else
If (Y/X)<ep Then
J=3
Else
If (X/Y)<ep Then
J=1
Else
J=2
EndIf
EndIf
EndIf
RETURN J
EndSub
sub GetDir(myx,myy,ox,oy)
Var I,J
J=0
Var X=ox-myx
Var Y=oy-myy
I=GetQDir(Abs(X),Abs(Y))
If X>=0 Then
If Y>=0 Then
If I==1 Then
J=-2
Else
If I==2 Then
J=-1
Else
If I==3 Then
J=4
EndIf
EndIf
EndIf
Else
If I==1 Then
J=2
Else
If I==2 Then
J=3
Else
If I==3 Then
J=4
EndIf
EndIf
EndIf
EndIf
Else
If Y>=0 Then
If I==1 Then
J=-2
Else
If I==2 Then
J=-3
Else
If I==3 Then
J=-4
EndIf
EndIf
EndIf
Else
If I==1 Then
J=2
Else
If I==2 Then
J=1
Else
If I==3 Then
J=-4
EndIf
EndIf
EndIf
EndIf
EndIf
RETURN J
endsub
sub abs(a)
Var b
If a<0 Then
b=-a
Else
b=a
endif
return b
endsub
Sub PermResend()
Var Mn=9
Repeat
UO.Resend()
Wait(MoveDelay*Mn)
Until (1>2)
EndSub
sub max(A,B)
Var C
If A>B Then
C=A
Else
C=B
EndIf
Return C
EndSub
sub GetDistance(X,Y)
return max(abs(X-uo.getx()),abs(Y-uo.gety()))
endsub
sub GoToTile(OX,OY,N,S)
var myx, myy, MD, J
var Lx1 ,Ly1
var Lx2 ,Ly2
var Sx ,Sy
var T
var Des=N
J=1
MD=MoveDelay*1.5
myx=uo.getx()
myy=uo.gety()
MoveOnce(GetDir(uo.getx(),uo.gety(),ox,oy),MD,False)
Sx=0
Sy=0
Lx1=uo.getx()/2
Ly1=uo.gety()/2
Lx2=Lx1/2
Ly2=Ly1/2
T=UO.Timer()
If (GetDistance(ox,oy)<>N) or ((not S) and GetDistance(ox,oy)>N) Then
UO.Exec('exec PermResend')
EndIf
While ((GetDistance(ox,oy)<>N) or ((not S) and GetDistance(ox,oy)>N)) and (OX>=0) and (OY>=0)
If ((UO.Timer()-T)*15>MoveDelay) Then
T=UO.Timer()
# UO.Print(Str(uo.getx())+' '+Str(uo.gety())+' '+Str(ox)+' '+Str(oy)+' '+Str(GetDir(uo.getx(),uo.gety(),ox,oy))+' '+Str(T))
Lx2=Lx1
Ly2=Ly1
Lx1=myx
Ly1=myy
myx=uo.getx()
myy=uo.gety()
endIf
MD=MoveDelay
If ((OX-uo.getx())*(OX-uo.getx())+(OY-uo.gety())*(OY-uo.gety())>0) Then
MD=MD*3/GetDistance(ox,oy)
EndIf
wait(MD)
If GetDistance(OX,OY)>Des Then
MoveOnce(GetDir(uo.GetX(),uo.GetY(),ox,oy),MD,False)
Else
If S Then
If GetDistance(OX,OY)<Des Then
If GetDistance(OX,OY)<>0 Then
MoveOnce(GetDir(ox,oy,uo.GetX(),uo.GetY()),MD,False)
Else
MoveOnce(GetDir(uo.GetX(),uo.GetY(),Lx2,Ly2),MD,False)
EndIf
EndIf
EndIf
EndIf
If GetDistance(OX,OY)<>Des Then
If (Lx2==uo.getx()) and (Ly2==uo.gety()) Then
If (Sx<>uo.getx()) or (Sy<>uo.gety()) Then
J=1
EndIf
J=J+1
UO.Resend()
Sx = uo.getx()
Sy = uo.gety()
Stun(ox,oy,J)
EndIf
EndIf
Wend
UO.Exec('terminate PermResend')
endsub
Sub Stun(X,Y,N)
Var I
Var myx
Var myy
myx = uo.getx()
myy = uo.gety()
For I=1 to N
MoveOnce(perp(GetDir(myx,myy,x,y)),MoveDelay,False)
Next
Wait(MoveDelay)
UO.Resend()
If (myx==uo.getx()) and (myy==uo.gety()) Then
For I=1 to N
MoveOnce(-perp(GetDir(myx,myy,x,y)),MoveDelay,False)
Next
Wait(MoveDelay)
UO.Resend()
EndIf
If (myx==uo.getx()) and (myy==uo.gety()) Then
For I=1 to N
MoveOnce(-GetDir(myx,myy,x,y),MoveDelay,False)
Next
Wait(MoveDelay)
Stun(x,y,N)
EndIf
EndSub
Sub DeleteJournal(What)
Var T,J
J=False
If UO.InJournal(What) Then
J=True
UO.DeleteJournal()
EndIf
RETURN J
EndSub
Помогите со скриптом!
Moderators: Murderator+, Murderator