ИСПРАВТЕ ПЛИЗ СКРИПТ НА ЛУМБЕР
Posted: 2005-04-06 17:24:37
ПОМОГИТЕ КТОНИБУДЬ Я НЕЗНАЮ КАК ЗДЕЛАТЬ СКРИПТ НА ЛУМБЕР ИСПРАВТЕ ЕСЛИ ЧТО НЕ ТАК ППППЛИИИЗЗЗЗ
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=324,TopY=65
dim TreeX[500], TreeY[500],TreeT[500]
dim TreeTile[10]
var flag=0,treeCount=0,clicks=0,flag2=0
var f=file("C:\uo\inj\trees3")
var Area=4
var TryHiding=0
var TryRecall=0
var GetFromFile=0
TreeTile[0]=3283
TreeTile[1]=3277
TreeTile[2]=3293
TreeTile[3]=3296
TreeTile[4]=3302
TreeTile[5]=3299
TreeTile[6]=3290
TreeTile[7]=3288
TreeTile[8]=3286
TreeTile[9]=3280
uo.exec("filterspeech on")
uo.exec("filterspeech add 'Where do you want to use the pickaxe?'")
uo.print('Âûáåðè òîïîð: ')
uo.exec('addobject axe')
while uo.targeting()
wait(100)
wend
if TryRecall==1 then
uo.print
uo.exec
while uo.targeting()
wait(100)
wend
end if
if GetFromFile==1 then
uo.print
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()
else
uo.exec('addobject Pickaxe')
while uo.targeting()
wait(100)
wend
uo.print
for q=1 to Area
if q==2 then
gotoxy(uo.getx()+20,uo.gety()-10)
end if
if q==3 then
gotoxy(uo.getx(),uo.gety()+20)
end if
if q==4 then
gotoxy(uo.getx()-20,uo.gety())
end if
for r=0 to 3
if r==1 then
gotoxy(uo.getx()+10,uo.gety())
end if
if r==2 then
gotoxy(uo.getx(),uo.gety()+10)
end if
if r==3 then
gotoxy(uo.getx()-10,uo.gety())
end if
for j=0 to 8
for i=0 to 8
clicks=0
flag=0
uo.DeleteJournal()
uo.useobject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
flag=0
for k=0 to 9
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 9
if uo.LastTile(0)==TreeTile[k] then
flag=1
end if
next
end if
if flag==1 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if treeX[ii]==uo.lastTile(1) AND treeY[ii]==uo.lastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.lastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.print('Íàéäåíî äåðåâî: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
end if
end if
if flag==2 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if treeX[ii]==uo.lastTile(1) AND treeY[ii]==uo.lastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.LastTile(2)
TreeT[treeCount]=uo.LastTile(0)-1
uo.print('Íàéäåíî äåðåâî: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
end if
end if
next
next
next
next
uo.exec("filterspeech off")
uo.print(' C:\uo\inj\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.print((treeCount))
wait(2000)
while 1==1
if treeCount>0 then
for i=1 to treeCount
if TryRecall==1 AND uo.Count('ZLK')>=LogsQty then
ToRecall()
end if
uo.print
infologs()
flag=gotoxy(treex[i],treey[i])
if flag==1 then
if TryHiding==1 then
ToHide()
end if
GetTree
end if
next
end if
wend
end sub
sub GetTree(type,x,y,z)
var i
uo.print
for i=0 to 15
if uo.warmode()==1 then
return 0
end if
wait(200)
uo.deletejournal()
uo.waittargettile(type,x,y,z)
uo.useobject('axe')
if WaitForChange()==1 then
return 1
end if
next
return 0
end sub
sub WaitForChange()
var Text1=uo.getname()+': 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 mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
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
end if
wait(50)
next
return 0
end sub
sub WaitForTryRock()
var Text1="That is too far away."
var Text2="Try mining in rock."
var Text3="There is no ore here to mine."
var Text4="You have no line of sight to that location"
var Text5="You can't see the target"
for var i=0 to 50
if uo.Journal(0)==Text1 OR uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 OR uo.Journal(0)==Text4 OR uo.Journal(0)==Text5 then
return 1
end if
wait(200)
next
return 0
end sub
sub WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub
sub WaitForChangeXY(myX,myY,lastX,lastY)
for var i=1 to 50
if lastX<>myX OR lastY<>myY then
return 1
end if
wait(200)
next
return 0
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 abs(x-myX)<=1 AND abs(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 abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub
sub SaveToFile(TreeCount,TreeX,TreeY,TreeT)
var f=file("C:\uo\inj\trees3.dat")
var s=0,i=0
f.open()
f.create()
s=safe call f.writeln(TreeCount)
for i=1 to TreeCount
s=safe call f.writeln
next
f.close()
end sub
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=324,TopY=65
dim TreeX[500], TreeY[500],TreeT[500]
dim TreeTile[10]
var flag=0,treeCount=0,clicks=0,flag2=0
var f=file("C:\uo\inj\trees3")
var Area=4
var TryHiding=0
var TryRecall=0
var GetFromFile=0
TreeTile[0]=3283
TreeTile[1]=3277
TreeTile[2]=3293
TreeTile[3]=3296
TreeTile[4]=3302
TreeTile[5]=3299
TreeTile[6]=3290
TreeTile[7]=3288
TreeTile[8]=3286
TreeTile[9]=3280
uo.exec("filterspeech on")
uo.exec("filterspeech add 'Where do you want to use the pickaxe?'")
uo.print('Âûáåðè òîïîð: ')
uo.exec('addobject axe')
while uo.targeting()
wait(100)
wend
if TryRecall==1 then
uo.print
uo.exec
while uo.targeting()
wait(100)
wend
end if
if GetFromFile==1 then
uo.print
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()
else
uo.exec('addobject Pickaxe')
while uo.targeting()
wait(100)
wend
uo.print
for q=1 to Area
if q==2 then
gotoxy(uo.getx()+20,uo.gety()-10)
end if
if q==3 then
gotoxy(uo.getx(),uo.gety()+20)
end if
if q==4 then
gotoxy(uo.getx()-20,uo.gety())
end if
for r=0 to 3
if r==1 then
gotoxy(uo.getx()+10,uo.gety())
end if
if r==2 then
gotoxy(uo.getx(),uo.gety()+10)
end if
if r==3 then
gotoxy(uo.getx()-10,uo.gety())
end if
for j=0 to 8
for i=0 to 8
clicks=0
flag=0
uo.DeleteJournal()
uo.useobject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
flag=0
for k=0 to 9
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 9
if uo.LastTile(0)==TreeTile[k] then
flag=1
end if
next
end if
if flag==1 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if treeX[ii]==uo.lastTile(1) AND treeY[ii]==uo.lastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.lastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.print('Íàéäåíî äåðåâî: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
end if
end if
if flag==2 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if treeX[ii]==uo.lastTile(1) AND treeY[ii]==uo.lastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
treeY[treeCount]=uo.LastTile(2)
TreeT[treeCount]=uo.LastTile(0)-1
uo.print('Íàéäåíî äåðåâî: x='+str(uo.lasttile(1))+' y='+str(uo.lastTile(2)))
end if
end if
next
next
next
next
uo.exec("filterspeech off")
uo.print(' C:\uo\inj\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.print((treeCount))
wait(2000)
while 1==1
if treeCount>0 then
for i=1 to treeCount
if TryRecall==1 AND uo.Count('ZLK')>=LogsQty then
ToRecall()
end if
uo.print
infologs()
flag=gotoxy(treex[i],treey[i])
if flag==1 then
if TryHiding==1 then
ToHide()
end if
GetTree
end if
next
end if
wend
end sub
sub GetTree(type,x,y,z)
var i
uo.print
for i=0 to 15
if uo.warmode()==1 then
return 0
end if
wait(200)
uo.deletejournal()
uo.waittargettile(type,x,y,z)
uo.useobject('axe')
if WaitForChange()==1 then
return 1
end if
next
return 0
end sub
sub WaitForChange()
var Text1=uo.getname()+': 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 mess
for var i=0 to 200
mess=uo.journal(0)
if uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
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
end if
wait(50)
next
return 0
end sub
sub WaitForTryRock()
var Text1="That is too far away."
var Text2="Try mining in rock."
var Text3="There is no ore here to mine."
var Text4="You have no line of sight to that location"
var Text5="You can't see the target"
for var i=0 to 50
if uo.Journal(0)==Text1 OR uo.Journal(0)==Text2 OR uo.Journal(0)==Text3 OR uo.Journal(0)==Text4 OR uo.Journal(0)==Text5 then
return 1
end if
wait(200)
next
return 0
end sub
sub WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub
sub WaitForChangeXY(myX,myY,lastX,lastY)
for var i=1 to 50
if lastX<>myX OR lastY<>myY then
return 1
end if
wait(200)
next
return 0
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 abs(x-myX)<=1 AND abs(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 abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub
sub SaveToFile(TreeCount,TreeX,TreeY,TreeT)
var f=file("C:\uo\inj\trees3.dat")
var s=0,i=0
f.open()
f.create()
s=safe call f.writeln(TreeCount)
for i=1 to TreeCount
s=safe call f.writeln
next
f.close()
end sub