Вот мой Ламберт + луки делать или + карпентри !
Code:
#При работе должна быть "отжата" кнопка NumLock ,infotile
Var Hatchet1='0x0f43' # Типы
Var Hatchet2='0x0F43' # топоров
Var MoveDelay=100 # Промежуток между шагами
Var MoveNumber=1 # Количество шагов при смене дислокации
Var Ep=0.172 # Значение ширины угла хождения при определении направления. Если на пути встречаются сложные и широкие препятствия - увеличить. 0.172 - сбаланчированный.
Var FileName='f:\Ultima Online\injection-bin-0.3.30.4\5.txt' # В каждой строке файла тайл дерева
var max=350 #макс вес сумки
var minlog=10 #мин количество дерева в сумке, т.е. сколько на лук идет
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)
#temp:
F.Open()
Beg:
DeleteJournal('no logs')
DeleteJournal('immune to your')
#Stealth()
if UO.Weight>=max then
#bow()
UO.FindType('0x1BDD', '0x0000', 'my') # ischem derevo log
if UO.findcount() > 0 then
UO.MoveItem("finditem", "-1", "ground")# skladiwaem na zemly
wait(500)
endif
UO.FindType('0x1BDD', '0x0488', 'my') # ischem oak log
if UO.findcount() > 0 then
UO.MoveItem("finditem", "-1", "ground")# skladiwaem na zemly
wait(500)
endif
#while uo.Count('0x1BDD','0x0000')>minlog
#uo.canceltarget()
#uo.usetype('0x097B')
#UO.Exec ("waitmenu 'Carpentry''Weapons & Tools''Weapons & Tools''Fishing Pole'")
#UO.usetype('0x1035')
#Wait(5000)
#wend
endif
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.canceltarget()
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(1000)
Wend
#UO.Print('There are '+Str(UO.Count('0x1BDD'))+' logs in the pack')
infologs()
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()
#goto temp
uo.exec('exec restartscr')
UO.SetGlobal('process','no')
EndSub
sub restartscr()
wait(6666)
uo.exec('exec 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
UO.Print(T)
return T
endsub
Sub EquipHatchet()
#Stealth()
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(4000)
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
sub bow()
while uo.Count('0x1BDD','0x0000')>minlog
uo.canceltarget()
uo.usetype('0x097B')
UO.Exec ("waitmenu 'What do you want to carve the wo''Bows & Crossbow''Bows''Crossbow'")
UO.waittargettype('0x1BDD','0x0000')
UO.usetype('0x0F51')
Wait(2000)
#if uo.Count('0x1BDD','0x0000')<minlog or UO.InJournal('anything') then
#return
#endif
wend
endsub
sub Camp()
while uo.Count('0x1BDD','0x0000')>minlog
uo.canceltarget()
uo.usetype('0x097B')
UO.Exec ("waitmenu 'Carpentry''Weapons & Tools''Weapons & Tools''Fishing Pole'")
#UO.waittargettype('0x1BDD','0x0000')
UO.usetype('0x1035')
Wait(2000)
#if uo.Count('0x1BDD','0x0000')<minlog or UO.InJournal('anything') then
#return
#endif
wend
endsub
sub Stealth()
if uo.hidden()< 1 then
uo.useskill('Stealth')
wait(3000)
endif
endsub
sub infologs()
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0000'))+' logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0488'))+' oak logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0481'))+' Frozen logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0514'))+' Solar logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0497'))+' Sandwood logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0482'))+' Ghostwood logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0487'))+' Elven logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x07EC'))+' Amarant logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x0480'))+' Ice logs in the pack')
UO.Print('There are '+Str(UO.Count('0x1BDD','0x049F'))+' Mouldy logs in the pack')
endsub
sub bank()
UO.Exec("cast Recall 0x4000A8AE")
end sub
sub home()
UO.Exec("cast Recall 0x40017CF4")
end sub
sub guarder()
uo.deletejournal()
while not uo.dead()
if UO.InJournal("attacking you") or UO.InJournal("hit to your") or UO.InJournal("hits your") or UO.InJournal("a blow") or UO.Life < UO.STR then
#UO.Exec ("terminate fish")
UO.Exec ("terminate Lamb")
wait(100)
UO.Exec ("terminate Lamb")
agen:
UO.Exec ("exec bank")
UO.DeleteJournal()
wait(4000)
if uo.injournal("The spell fizzles.") then
goto agen
end if
endif
wait (500)
wend
end sub
sub test()
UO.FindType('0x1BDD', '0x0000', 'my') # ischem derevo log
if UO.findcount() > 0 then
UO.MoveItem("finditem", "-1", "ground")# skladiwaem na zemly
wait(500)
endif
UO.FindType('0x1BDD', '0x0488', 'my') # ischem oak log
if UO.findcount() > 0 then
UO.MoveItem("finditem", "-1", "ground")# skladiwaem na zemly
wait(500)
endif
end sub
покраней мере зацикливаеться и работает !! за 6 дней ГМ ламбер + Бовкрафт ГМ и Карпентри ГМ !