Yoko

All sides of Injection
It is currently 2026-01-24 17:06:52

All times are UTC+02:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 2008-07-10 16:05:34 
Offline

Joined: 2007-12-19 12:51:42
Posts: 83
нашол сдесь скипт Destructiona autolumber с ходилкой ! впринципе робатает хорошо но пропускает очень много деревьев - просто проходит мимо когда они рядом ! если кто знает как подправить буду блогадарен !

#Lumbjacking n aaoiiieneii aa?aaee (c) Destruction, v1.0
var hatchet = "0x0F47"
Sub searchTree()
var i, x, y, t, max_distance = 24
for i = 1 to -1
for x = -i to i
for y = -i to i
if NOT uo.getGlobal( 't:' + str( uo.getX() + x ) + "," + str( uo.getY() + y ) ) == "empty" then
t = IsTreeTile( uo.getX() + x, uo.getY() + y )
if not t == false then
uo.setGlobal( "tree_x", str( uo.getX() + x ) )
uo.setGlobal( "tree_y", str( uo.getY() + y ) )
uo.setGlobal( "tree_t", str( t ) )
x = i
y = i
i = -1
endif
endif
next
next
if i == max_distance then
i = -1
endif
next
endsub

sub autoLumber()
searchTree()
doMineTree()
endsub

Sub doMineTree()
var x, y, t
var end = "appears immune|nothing here|reach this"
var try = "You put|fail"
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" )
uo.exec( "exec searchTree" )
Walker( x, y, 1 )
repeat
if uo.waiting() then
uo.canceltarget()
endif
deljournal( try + "|" + end )
uo.waittargettile( str( t ), str( x ), str( y ), str( uo.getZ() ) )
uo.usetype( hatchet )
repeat
wait( 100 )
until uo.injournal( try + "|" + end )
until uo.injournal( end )
while uo.getGlobal( "tree_x" ) == str( x ) && uo.getGlobal( "tree_y" ) == str( y )
wait( 100 )
wend
until false
endsub

Sub deljournal( msg )
while uo.injournal( msg )
uo.setjournalline( uo.injournal( msg ) -1, '' )
wend
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
########################################## OIAEEEA 3 ##########################
#var Prec=3 # Eae aeecei neaaoao iiaieoe e oaee (Precision)
#var MaxTraceDistance=15 # Iaeneiaeuiay aeeia iaoiaa. ?aeaoaeuii noaaeou n ?an?aoa aicii?iuo i?aiyonaee. Anee noaaeou i?aiu #aieuoea ?enea, eiaeeea ii?ao iieoe a iaoia iie ie?a ?oiau aieoe e ninaaiaio aa?aao.
#var Speed=2 # Aeeia oaaa. Neieuei oaaia aaeaou ca ?ac. Auoa 3 noaaeou niunea iao. Oianou ooiia oiii?aiea oaaia. Aey eaiaa?a #eaaaeuii 3, aey iaeieiaa - 1.
#var StepTimeOut=400 # Anee oia?eenu a iaiiiciaiiue iauaeo, neieuei inae ?aaou naaeaa n ianoa. Anee ii i?inoiio - oaeiaoo #oaaa. Anee iinoaaeou neeuii iaeaiueea, oiaeeea ia?iao o?anne?iaaou ionoua ianoa.
#UO.SetGlobal("Logging","1") # - iieacuaaou ioeaai?iua niiauaiey.
#UO.SetGlobal("BlindWalk","0") # - ia eniieuciaaou i?iaa?eo oaeeia, a eniieuciaaou oiauao iaiuoiu. Aey iaeieiaa IA?CAOAEUII #AEE??EOU.
#A ooieoee IsPass, niaa??eouny nienie i?ioiaeiuo oaeeia.

#Walker(X,Y,Prec) - eaai e oaee n eii?aeiaoaie X,Y. Ie?aai ia aica?auaao.
#Tracer(StartDir,Direction) - o?anne?iaea 1 oaaa. Aica?auaao iai?aaeaiea ii eioi?iio iieo?eeinu naaeioouny n ianoa. StartDir #- iai?aaeaiea iineaaiaai aae?aiey, Direction (-1 eee +1) iai?aaeaiea iaoiaa. -1 - ii ?aniaie no?aeea, +1 i?ioea ?aniaie #no?aeee. Iai?aaeaiey ne?eio eniieucoao ee?iiai oi?iaoa:
#1 - aeaai aiec
#2 - aiec
#3 - ai?aai aiec
#4 - ai?aai
#5 - ai?aai aaa?o
#6 - aaa?o
#7 - aeaai aaa?o
#8 - aeaai
#Tracer(StartDir,Direction) - eaaaeuii iiaoiaeo aey ?uaaeee aaieu aa?aaa oae eae iia aoaao iaoiaeou aa?aa aaneiia?ii (1 #caione ooieoee = 1 oaa iaoiaa).
#####################################################
# WW W WW AA LL Kk KK EE EE RRR #
# WW W WW AA A LL Kk K EEE R R #
# WW W WW AA A LL KKK EEEEE R R #
# WW WW WW AAAA LL KKK EEE RRR #
# WWW WWW AA A LLLL KK Kk EE EE R RR #
####################################################
#var Prec=0
var MaxTraceDistance=10
var Speed=2
var StepTimeOut=300

Sub Walker(GoX,GoY,Prec)
UO.SetGlobal("Logging","0")
UO.SetGlobal("BlindWalk","0")
var LastDir
UO.SetGlobal("GlobalGoX",str(GoX))
UO.SetGlobal("GlobalGoY",str(GoY))
while not IsEnd(GoX,GoY,Prec)
LogInfo('Just walking')
LastDir=GoUntilHit(GoX,GoY,Prec)
if not IsEnd(GoX,GoY,Prec) then
LogInfo('Tracing')
FullAroundTrace(LastDir,GoX,GoY,Prec)
end if
wend
end sub

Sub FullAroundTrace(StartDir,GoX,GoY,Prec)
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
endif
if MovesDone>0 and PrevMoveCross(GetDirToDir(UO.GetDir(),Prec),LineX,LineY,GoX,GoY,StartX,StartY,Prec) then
return
end if
MovesDone=MovesDone+1
CurDir=AddToDir(CurDir,-Direction,Prec)
until MovesDone>MaxTraceDistance
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
GoDir(Dir,Prec)
repeat
EndDir=GetDirToDir(UO.GetDir(),Prec)
wait(100)
Counter=Counter+1
until StartDir<>EndDir or StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=8
if Counter>=8 then
return 0
end if
if StartY<>UO.GetY() or StartX<>UO.GetX() then
return Dir
else
GoDir(Dir,Prec)
repeat
wait(100)
Counter=Counter+1
until StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/100
if Counter>=StepTimeOut/100 then
LogInfo('Step timeout reached')
return 0
else
return Dir
end if
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 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


Top
   
 Post subject:
PostPosted: 2008-07-10 21:33:06 
Offline
User avatar

Joined: 2006-09-08 04:46:12
Posts: 62
viewtopic.php?t=13653

тут смари


Top
   
 Post subject:
PostPosted: 2008-07-10 21:52:06 
Offline

Joined: 2007-12-19 12:51:42
Posts: 83
так там другой скрипт ! етот на автопоиск деревьев


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited