Не проверял.
Code:
sub katorga()
var f=file("C:\trees3.dat")
var TreeCount=0,i
dim TreeX[500],TreeY[500],TreeT[500]
uo.print('Topor... ')
uo.exec('addobject axe')
while uo.targeting()
wait(100)
wend
uo.print('load file...')
f.open()
TreeCount=safe call f.readNumber()
for i=1 to TreeCount
TreeT[i]=safe call f.ReadNumber()
TreeX[i]=safe call f.ReadNumber()
TreeY[i]=safe call f.ReadNumber()
next
f.close()
while not uo.dead()
for i=1 to TreeCount
GotoXY(treex[i],treey[i])
GetTree(str(treeT[i]),str(treeX[i]),str(TreeY[i]),str(uo.getz()))
next
DropLogs()
wend
endsub
Sub GetTree(type,x,y,z)
wait(200)
repeat
uo.deletejournal()
uo.waittargettile(type,x,y,z)
uo.useobject('axe')
until WaitForChange()==1
end sub
Sub WaitForChange()
var Text1='You hack at the tree for a while, but fail to produce any useable wood.'
var Text2='There are no logs here to chop.'
var Text3="You can't reach this."
var Text4="That is too far away."
var Text5="You can't do much in your current state."
var Text6='There is no wood left to harvest.'
var Text7='World is saving now...'
var mess
for var i=0 to 100
mess=uo.Journal(0)
if uo.Journal(0)==Text2 and uo.journalserial(uo.Journal(0))=='0x00000000' or uo.Journal(0)==Text3 and uo.journalserial(uo.Journal(0))=='0x00000000' or uo.Journal(0)==Text4 and uo.journalserial(uo.Journal(0))=='0x00000000' OR uo.Journal(0)==Text6 and uo.journalserial(uo.Journal(0))=='0x00000000' then
return 1
endif
if uo.Journal(0)==Text1 and uo.journalserial(uo.Journal(0))=='0x00000000' then
return 0
endif
if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' and mess[4]=='p' and mess[5]=='u' and mess[6]=='t' then
return 0
endif
if uo.Journal(0)==Text7 then
repeat
wait(1000)
until uo.Journal(0)<>Text7
endif
wait(100)
next
return 0
end sub
Sub DropLogs()
GotoXY(1318,949)
wait(1000)
uo.useobject('0x401258E1')
wait(1000)
end sub
Sub GotoXY(x,y)
var myX,myY,lastX=0,lastY=0,i,halt=0,z,r=0
for i=1 to 60
myX=uo.getX();
myY=uo.getY();
if LastX==myX and LastY==myY then
halt=halt+1
else
halt=0
end if
if halt>=10 then
if uo.GetDir()==1 then
for z=0 to 8
uo.Press(40)
next
end if
if uo.GetDir()==3 then
for z=0 to 8
uo.Press(37)
next
end if
if uo.GetDir()==5 then
for z=0 to 8
uo.Press(38)
next
end if
if uo.GetDir()==7 then
for z=0 to 8
uo.Press(39)
next
end if
halt=15
end if
if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
return 1
end if
if x<=myX then
if y<=myY then
for z=0 to 3
uo.Press(38)
next
else
for z=0 to 3
uo.Press(37)
next
end if
else
if y<=myY then
for z=0 to 3
uo.Press(39)
next
else
for z=0 to 3
uo.Press(40)
next
end if
end if
lastX=myX
lastY=myY
wait(200)
next
return 0
end sub
Sub Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub
Sub CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
repeat
wait(50)
until UO.InJournal('backpack')
end sub