Im using one that is working fine:
Code: sub autolumber() Uo.Recall('runebook','2') Wait (8000) searchTree() doMineTree() endsub
Sub searchTree() If Uo.weight>=120 then uo.say(",terminate autolumber") Wait (1000) uo.say(",exec Guardarlogs") Wait (1000) Else goto st Endif st: var i, x, y, t, stp, max_search = 24; var cx = uo.getX() var cy = uo.getY() for i = 1 to max_search for x =-i to i stp = 1 if not i == abs( x ) then stp = abs( i ) * 2 endif for y = -i to i step stp if NOT uo.getGlobal( 't:' + str( x + cx ) + "," + str( y + cy ) ) == "empty" then t = IsTreeTile( x + cx, y + cy ) if not t == false then uo.setGlobal( "tree_x", str( x + cx ) ) uo.setGlobal( "tree_y", str( y + cy ) ) uo.setGlobal( "tree_t", str( t ) ) return false else uo.setGlobal( 't:' + str( x + cx ) + "," + str( y + cy ), 'empty' ) endif endif next next next uo.exec( "terminate autolumber" ) return false endsub
Sub doMineTree() var x, y, t, try=0 repeat x = val( uo.getGlobal( "tree_x" ) ) y = val( uo.getGlobal( "tree_y" ) ) t = val( uo.getGlobal( "tree_t" ) ) uo.setGlobal( 't:' + str( x ) + "," + str( y ), "empty" ) Walker( x, y, 1 ) uo.exec( "exec searchTree" ) repeat denovo: if uo.waiting() then uo.canceltarget() endif UO.DeleteJournal() uo.waittargettile( str( t ), str( x ), str( y ), str( uo.getZ() ) ) uo.usetype('0x0F43') repeat wait( 100 ) until uo.injournal("Nao ha madeiras|Voce pos|Voce nao conseguiu") if uo.injournal("Voce nao conseguiu") then if (try < 2) then try=try+1 goto denovo endif else try=0 endif until uo.injournal("Voce nao conseguiu|Nao ha madeiras") try=0 while uo.getGlobal( "tree_x" ) == str( x ) && uo.getGlobal( "tree_y" ) == str( y ) wait( 100 ) wend until false endsub
Sub IsTreeTile( x, y ) var i, tree_count = 20 DIM tree[ val( str( tree_count ) ) ] tree[0] = 3274 tree[1] = 3275 tree[2] = 3276 tree[3] = 3277 tree[4] = 3280 tree[5] = 3283 tree[6] = 3286 tree[7] = 3289 tree[8] = 3291 tree[9] = 3292 tree[10] = 3294 tree[11] = 3295 tree[12] = 3296 tree[13] = 3299 tree[14] = 3302 tree[15] = 3394 tree[16] = 3395 tree[17] = 3417 tree[18] = 3440 tree[19] = 3461 for i = 0 to tree_count -1 if uo.privategettile( x, y, -1, tree[i], tree[i] ) then return tree[i] endif next return false endsub
Sub Guardarlogs() uo.exec( "terminate autolumber" ) Wait (4000) Uo.Recall('runebook','3') Wait (8200) Uo.msg('Bank') Wait (1000) UO.UseObject('CONTAINER') Wait (1000) repeat uo.findtype('0x1BDD','-1','backpack') wait (1600) UO.moveitem('finditem','-1','CONTAINER') Until Uo.Count ('0x1BDD')==0 uo.Say( ",exec autolumber" ) end sub
sub abs(a) Var b If a<0 Then b=-a Else b=a endif return b endsub
var MaxTraceDistance=10 var TraceLoopIncrease=5 var LimitTrace=20 var Speed=1 var StepTimeOut=500 var CheckCnt=2 var DynamicPause=30
Sub guards() denovo: uo.msg('guards') wait(4200) goto denovo end sub
Sub Walker(GoX,GoY,Prec) UO.SetGlobal("Logging","0") UO.SetGlobal("BlindWalk","0") var LastDir var MoveRes var TracerCnt UO.SetGlobal("GlobalGoX",str(GoX)) UO.SetGlobal("GlobalGoY",str(GoY)) while not IsEnd(GoX,GoY,Prec) TracerCnt = MaxTraceDistance repeat LogInfo('Just walking') LastDir=GoUntilHit(GoX,GoY,Prec)
if IsEnd(GoX,GoY,Prec) then return 1 end if
LogInfo('Tracing') MoveRes = FullAroundTrace(LastDir,GoX,GoY,Prec,TracerCnt) if TracerCnt > LimitTrace then return 0 endif TracerCnt = TracerCnt + TraceLoopIncrease until MoveRes == 1 wend return 1 end sub
Sub FullAroundTrace(StartDir,GoX,GoY,Prec,MaxTrace) var LineX=UO.GetX() var LineY=UO.GetY() var CurDir=StartDir var Direction=CountDirection(GoX,GoY,CurDir,Prec) var StartX,StartY var MovesDone=0 repeat StartX=UO.GetX() StartY=UO.GetY() CurDir=Tracer(CurDir,Direction,Prec) if (CurDir==GetDir(GoX,GoY,Prec)) then return 1 endif if MovesDone>0 and PrevMoveCross(GetDirToDir(UO.GetDir(),Prec),LineX,LineY,GoX,GoY,StartX,StartY,Prec) then return 1 end if MovesDone=MovesDone+1 CurDir=AddToDir(CurDir,-Direction,Prec) until MovesDone>MaxTrace return 0 end sub
Sub CountDirection(GoX,GoY,StartDir,Prec) var GoDir=GetDir(GoX,GoY,Prec) var MyX=UO.GetX() var MyY=UO.GetY() if GoDir<StartDir then return -1 end if if GoDir>StartDir then return 1 end if if Abs(MyX-GoX)>Abs(MyY-GoY) then if (GoDir==3 and GoY>MyY) OR (GoDir==7 and GoY<MyY) then return -1 else return 1 end if else if (GoDir==1 and GoX<MyX) or (GoDir==5 and GoX>MyX) then return -1 else return 1 end if end if end sub
Sub PrevMoveCross(Dir,x1,y1,x2,y2,StartX,StartY,Prec) var x3,y3,x4,y4 x3=StartX y3=StartY x4=StartX+(XFromDir(Dir)-StartX)*Speed y4=StartY+(YFromDir(Dir)-StartY)*Speed return LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec) end sub
Sub LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec) if x1==x3 and y1==y3 then return false end if var z1=(x3-x1)*(y2-y1)-(y3-y1)*(x2-x1) var z2=(x4-x1)*(y2-y1)-(y4-y1)*(x2-x1) if z1*z2>0 then return false else LogInfo('Vector info:') LogInfo('x1= '+str(x1)) LogInfo('y1= '+str(y1)) LogInfo('x2= '+str(x2)) LogInfo('y2= '+str(y2)) LogInfo('x3= '+str(x3)) LogInfo('y3= '+str(y3)) LogInfo('x4= '+str(x4)) LogInfo('y4= '+str(y4)) return true end if end sub
Sub IsDiap(X,X0,X1,Prec) if X<=X0+Prec and X>=X1-Prec OR X>=X0-Prec and X<=X1+Prec then return true end if return false end sub
Sub GoUntilHit(GoX,GoY,Prec) var LastDir LastDir=GetDir(GoX,GoY,Prec) var CouldMove repeat LastDir=GetDir(GoX,GoY,Prec) if LastDir<>0 and not IsEnd(GoX,GoY,Prec) then CouldMove=TryDir(LastDir,Prec) end if until LastDir==0 or IsEnd(GoX,GoY,Prec) or not CouldMove return LastDir end sub
Sub IsEnd(GoX,GoY,Prec) if Abs(UO.GetX()-GoX)<=Prec and Abs(UO.GetY()-GoY)<=Prec then LogInfo('END FOUND') return true else return false end if end sub
Sub GetDir(GoX,GoY,Prec) var MyX=UO.GetX() var MyY=UO.GetY() var DiffX=Abs(UO.GetX()-GoX) var DiffY=Abs(UO.GetY()-GoY) var GoDir=0 if (DiffX/(DiffY+0.1))>=2 then if (MyX>GoX) then GoDir=7 else GoDir=3 end if else
if (DiffY/(DiffX+0.1))>=2 then if (MyY>GoY) then GoDir=5 else GoDir=1 end if else
if (MyX>GoX) and (MyY>GoY) then GoDir=6 else if (MyX>GoX) and (MyY<GoY) then GoDir=8 else if (MyX<GoX) and (MyY>GoY) then GoDir=4 else if (MyX<GoX) and (MyY<GoY) then GoDir=2 end if end if end if end if end if end if return GoDir end sub
Sub Tracer(StartDir,Direction,Prec) var CurDir=StartDir var Result repeat Result=TryDir(CurDir,Prec) if not Result then CurDir=AddToDir(CurDir,Direction,Prec) end if until Result return Result end sub
Sub AddToDir(Dir,Cnt,Prec) var NewDir=Dir NewDir=NewDir+Cnt while NewDir>8 NewDir=NewDir-8 wend while NewDir<1 NewDir=NewDir+8 wend return NewDir end sub
Sub TryDir(Dir,Prec) var BegX=UO.GetX() # Ia?aeuiia O var BegY=UO.GetY() # Ia?aeuiia Y var Counter=0 var GoX=BegX var GoY=BegY GoX=XFromDir(Dir) GoY=YFromDir(Dir) if not IsPass(GoX,GoY) then LogInfo(str(GoX)+':'+str(GoY)+' is not passable') return false end if return TurnAndGoDir(Dir,Prec) end sub
Sub XFromDir(Dir) if Dir==2 OR Dir==3 Or Dir==4 then return (UO.GetX()+1) end if if Dir==6 OR Dir==7 Or Dir==8 then return (UO.GetX()-1) end if return (UO.GetX()) end sub
Sub YFromDir(Dir) if Dir==8 OR Dir==1 Or Dir==2 then return (UO.GetY()+1) end if if Dir==4 OR Dir==5 Or Dir==6 then return (UO.GetY()-1) end if return (UO.GetY()) end sub
Sub TurnAndGoDir(Dir,Prec) var StartDir=GetDirToDir(UO.GetDir(),Prec) var StartX=UO.GetX() var StartY=UO.GetY() var EndDir var Counter=0 var TestCounter=CheckCnt
#Direction Test repeat Counter = 0 LogInfo('Dir: '+str(StartDir)+' Counter: '+str(Counter)) PressDir(Dir) repeat EndDir=GetDirToDir(UO.GetDir(),Prec) wait(DynamicPause) Counter=Counter+1 until StartDir<>EndDir or StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause TestCounter = TestCounter - 1 LogInfo('Dir: '+str(EndDir)+' Counter: '+str(Counter)) until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause
if Counter>=StepTimeOut/DynamicPause then LogInfo('Direction timeout reached') return 0 end if #End direction Test
if StartY<>UO.GetY() or StartX<>UO.GetX() then return Dir end if
#Start Primary test TestCounter=CheckCnt repeat GoDir(Dir,Prec) Counter=0 repeat wait(DynamicPause) Counter=Counter+1 until StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause TestCounter = TestCounter - 1 until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause #End primary test
if Counter>=StepTimeOut/DynamicPause then LogInfo('Step timeout reached') return 0 else return Dir end if end sub
Sub GetDirToDir(GotDir,Prec) var ChangedDir=-GotDir ChangedDir=AddToDir(ChangedDir,5,Prec) return ChangedDir end sub
Sub DirToInj(Dir) dim Dirs[9] Dirs[1]=1 Dirs[2]=2 Dirs[3]=3 Dirs[4]=6 Dirs[5]=9 Dirs[6]=8 Dirs[7]=7 Dirs[8]=4
return (Dirs[Dir]) end sub
Sub PressDir(Dir) dim Dirs[9] Dirs[1]=35 Dirs[2]=40 Dirs[3]=34 Dirs[4]=39 Dirs[5]=33 Dirs[6]=38 Dirs[7]=36 Dirs[8]=37
UO.Press(Dirs[Dir],1) end sub
Sub GoDir(Dir,Prec) dim Dirs[9] Dirs[1]=35 Dirs[2]=40 Dirs[3]=34 Dirs[4]=39 Dirs[5]=33 Dirs[6]=38 Dirs[7]=36 Dirs[8]=37
var DistanceX=Abs(UO.GetX()-val(UO.GetGlobal("GlobalGoX"))) var DistanceY=Abs(UO.GetY()-val(UO.GetGlobal("GlobalGoY"))) var GoDistance if (DistanceX-Prec)<Speed then GoDistance=DistanceX-Prec else if (DistanceY-Prec)<Speed then GoDistance=DistanceY-Prec else GoDistance=Speed endif endif
UO.Press(Dirs[Dir],GoDistance) end sub
Sub IsPass(X,Y) if UO.GetGlobal("BlindWalk") then return true endif
dim Types[60] Types[1]=3 Types[2]=25 Types[3]=51 Types[4]=63 Types[5]=113 Types[6]=140 Types[7]=172 Types[8]=219 Types[9]=232 Types[10]=235 Types[11]=239 Types[12]=243 Types[13]=248 Types[14]=251 Types[15]=264 Types[16]=267 Types[17]=282 Types[18]=289 Types[19]=321 Types[20]=379 Types[21]=420 Types[22]=440 Types[23]=476 Types[24]=499 Types[25]=513 Types[26]=542 Types[27]=578 Types[28]=586 Types[29]=622 Types[30]=700 Types[31]=804 Types[32]=1740 Types[33]=1758 Types[34]=1770 Types[35]=1779 Types[36]=1779 Types[37]=1881 Types[38]=1886 Types[39]=1801 Types[40]=1805 Types[41]=1813 Types[42]=1820 Types[43]=1831 Types[44]=1833 Types[45]=1843 Types[46]=1850 Types[47]=1873 Types[48]=1876 Types[49]=1885 Types[50]=1888 Types[51]=1946 Types[52]=1969 Types[53]=2500 Types[54]=2539
for var i=1 TO 53 STEP 2 if UO.PrivateGetTile(X,Y,-1,Types[i],Types[i+1]) then return true end if next return false end sub
Sub LogInfo(Line) if not UO.GetGlobal("Logging")=="0" then UO.TextOpen() UO.TextPrint(str(UO.GetX())+":"+str(UO.GetY())+" - "+Line); end if end sub
Sub Abs(X) if X>0 then return X else return (-X) end if end sub
At your topic i didnt find all the script
this one i taked from an brazilian forum, but i hate just copy and execute without understand how it work, thats why i wanted to do one from the start.
i been able to edit somethings on that one... The bad thing is the big script used to walk... thats why i want to use EasyUO, to walk...
and Injection to umber, call guards, put logs on bank, recall and etc..
i dont think if i change the DLL will fix that problem, cuz if this scripts is working right the other must work right to!there is something worng.. Why isnt working???? heheh
and Thank You man!
|