Code: sub Lumber() var i=0,j=0,k=0,r=0,q=0,ii,jj var TopX=324,TopY=65 dim TreeX[100], TreeY[100],TreeT[100] dim TreeTile[100] var flag=0,treeCount=0,clicks=0,flag2=0 var f=file("C: rees.dat") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; var Area=4 var TryHiding=1 var TryRecall=1 var LogsQty=500 var RecallFromScroll=0 var GetFromFile=0 TreeTile[0]=3283 TreeTile[1]=3277 TreeTile[2]=3293 TreeTile[3]=3296 TreeTile[4]=3202 TreeTile[5]=3299 TreeTile[6]=3290 TreeTile[7]=3288 TreeTile[8]=3286 TreeTile[9]=3280 uo.exec uo.exec("filterspeech on") uo.exec("filterspeech add 'Where do you want to use the pickaxe?'")
uo.addobject("a key ring", 0x400866CE) uo.addobject("spellbook", 0x4019FFB0) uo.addobject("runebook", 0x400C617E) uo.addobject("runebook2", 0x40080646) uo.addobject("pestik", 0x4008610D) uo.print uo.exec wait uo.print uo.exec wait if TryRecall==1 then uo.print uo.exec wait uo.print uo.exec wait if RecallFromScroll==1 then uo.print uo.exec wait end if 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.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.usetype('0x0E86') waitForTarget() uo.DeleteJournal() uo.LClick(TopX+i*21-j*21,TopY+i*21+j*21) 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 uo.print rees.dat') SaveToFile end if uo.print 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 flag=gotoxy 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( 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 ToRecall RecallToHome wait uo.press wait(500) uo.press wait repeat wait gotoxy) uo.exec wait uo.setreceivingcontainer wait uo.grab wait uo.grab wait uo.grab uo.grab wait uo.grab wait uo.grab uo.grab wait uo.grab wait
RecallToLumber end sub
sub RecallToHome var i uo.printfor i=1 to 10 uo.deletejournal() uo.waittargetobject if FromScroll==0 then uo.cast else uo.useobject end if if WaitForRecall()==1 then return 1 end if next return 0 end sub
sub RecallToLumber var i uo.print for i=1 to 10 uo.deletejournal() uo.waittargetobject if FromScroll==0 then uo.cast else uo.useobject end if if waitForRecall()==1 then return 1 end if next return 0 end sub
sub ToHide() var i uo.print for i=1 to 15 uo.deletejournal() uo.useskill if WaitForHide()==1 then return 1 end if next return 0 end sub
sub WaitForRecall() var Text1=uo.getname()+": The spell fizzles." var mess='',lastX=uo.getX(),lastY=uo.getY() for var i=0 to 200 mess=uo.journal(0) if uo.Journal(0)==Text1 then return 0 end if if uo.getX()<>lastX OR uo.getY()<>LastY then return 1 end if wait(50) next return 0 end sub
sub WaitForHide() var Text1=uo.getname()+": You have hidden yourself well" var Text2=uo.getname()+": You can't seem to hide here." var mess for var i=0 to 200 mess=uo.journal(0) if uo.Journal(0)==Text1 then return 1 end if if uo.Journal(0)==Text2 then return 0 end if wait 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 next return 0 end sub
sub WaitForTryRock() var Text1 var Text2 var Text3 var Text4 var Text5 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 next return 0 end sub
sub WaitForTarget() for var i=0 to 50 if uo.Targeting()==1 then return 1 end if wait 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 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(3 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(3 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: rees.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(str(TreeT[i])+' '+str(treeX[i])+' '+str(TreeY[i])) next f.close() end sub
sub main() Lumber() end sub
|