Code: Var Ep=0.172 Var FileName='C:\file.txt' Var LogCount=0
Sub Main() UO.DeleteJournal() UO.Exec('exec Lumb') EndSub
Sub Lumb() Var Tl,T,X,Y,Z UO.SetGlobal('process','yes') Var F=File(FileName) F.Open() Beg: 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('Tile '+Tl) GoToTile(X,Y,1,False) Repeat UO.DeleteJournal() EquipHatchet() UO.WaitTargetTile(Str(T),Str(X),Str(Y),Str(Z)) UO.UseObject(UO.ObjAtLayer('Lhand')) While not (UO.InJournal('It appears immune to your blow') or UO.InJournal('You decide not to chop wood for now.') or UO.InJournal('You hack at the tree') or UO.InJournal('You put the') or UO.InJournal('There is nothing here to chop') or UO.InJournal('Âû íå ñìîãëè') or UO.InJournal('You hack at the tree for a while, but fail to produce any useable wood.') or UO.InJournal('You decide not to chop wood for now')) Wait(100) Wend Until UO.InJournal('It appears immune to your blow') or UO.InJournal('There is nothing here to chop.')or UO.InJournal('You decide not to chop wood for now') If UO.InJournal('There is nothing here to chop.') or UO.InJournal('You hack at the tree for a while, but fail to produce any useable wood.') or UO.InJournal('You decide not to chop wood for now') If UO.InJournal('There is nothing here to chop.') or UO.InJournal('You hack at the tree for a while, but fail to produce any useable wood.') or UO.InJournal('You decide not to chop wood for now')Then if uo.Weight>250 then GoToTile(3473,2197,0,False) #- sundyk uo.exec("setreceivingcontainer 0x4007AA25") #- syndyk while uo.count("0x1bdd") > 0 uo.exec("findtype 0x1bdd") uo.exec("grab 500 finditem") wait(1000) wend uo.exec("unsetreceivingcontainer") uo.exec("findtype 0x0000 0x0E7D 0x4007AA25") #syndyk Type Colour ID LogCount=uo.GetQuantity("finditem") endif GoTo Beg EndIf Ext: F.Close() UO.SetGlobal('process','no') Main() 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 return T endsub
Sub EquipHatchet() if UO.ObjAtLayer('Lhand')=='' then UO.Exec("equipt Lhand 0x0F48") #- topor endif Wait(200) RETURN True 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=1 #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)*500>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
Что не так? не запускается и все.....
|