Подправьте плиз скрипт на мининг.
Moderators: Murderator+, Murderator
-
- Posts: 247
- Joined: 2008-09-12 05:07:34
-
- Posts: 247
- Joined: 2008-09-12 05:07:34
356 1461 вход
357 1438 примерно середина дальше поворот на право
389 1436 конец
Милер и еще, когда я вокруг себя копал иногда поподались предметы рядом он пробовал их копать (чернату в шахте, декоротивные камни и тп) так вот когда он 1 раз это дерьмо капнет скрипт слетает(надо запускать заного, он думает как буд-то он все выкапал)
357 1438 примерно середина дальше поворот на право
389 1436 конец
Милер и еще, когда я вокруг себя копал иногда поподались предметы рядом он пробовал их копать (чернату в шахте, декоротивные камни и тп) так вот когда он 1 раз это дерьмо капнет скрипт слетает(надо запускать заного, он думает как буд-то он все выкапал)
Last edited by Jekaaa on 2009-03-15 19:51:35, edited 1 time in total.
-
- Posts: 247
- Joined: 2008-09-12 05:07:34
Code: Select all
sub Mining_Carve()
var i
dim x[3],y[3]
x[0]=356
y[0]=1461
x[1]=357
y[1]=1438
x[2]=389
y[2]=1436
repeat
for i=0 to 2
walkn(x[i],y[i],' ')
mining()
next
until uo.weight>=uo.str*4
endsub
sub Mining()
var x,y
for x=-2 to 2
for y=-2 to 2
if x==0 and y==0 then
wait(500)
else
uo.deletejournal()
uo.waittargettile('0',str(uo.getx('self')+x),str(uo.gety('self')+y),'0')
uo.usetype('NPF')
repeat
wait(300)
until uo.injournal('far away|no more|nothing here')
endif
next
next
endsub
##############################
# WalkN(X,Y,Serial) - char is walking by dX and dY step
# sub using Home, End, PgUp, PgDown keys
# d'not rebind this key from default action!
# serial - Serial of target or "" - string
# walkwait - delay after keypress
# Example:
# WalkN(2080,2113,'') - go to coordinates
# WalkN(0,0,'0x12345678') - go to target position
#--------------------------------------------------------------
sub WalkN(x,y,Target)
VAR i,StepSucess
VAR dx,dy,Exit=0
While Exit<>1
If Target<>"" Then
dx=UO.GetX(Target)-UO.GetX()
dy=UO.GetY(Target)-UO.GetY()
If UO.GetDistance(Target)<2 Then
Exit=1
Endif
Else
dx=x-UO.GetX()
dy=y-UO.GetY()
If dx==0 AND dy==0 Then
Exit=1
Endif
Endif
if Target<>"" AND uo.GetDistance(Target)<=3 then
Exit=1
endif
If dx<>0 AND dy<>0 Then
If dx>0 AND dy>0 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
Endif
Endif
If dx>0 AND dy<0 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
Endif
Endif
Endif
If dx<0 AND dy>0 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
Endif
Endif
Endif
If dx<0 AND dy<0 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
StepSucess=Go(5,37,300) ;SW - LeftArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
Endif
Endif
Endif
If dx<>0 AND dy==0 Then
If dx>0 Then
StepSucess=Go(2,34,300) ;E - PgDown
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
StepSucess=Go(2,34,300) ;E - PgDown
Endif
Endif
If dx<0 Then
StepSucess=Go(6,36,300) ;W - Home
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
StepSucess=Go(6,36,300) ;W - Home
Endif
Endif
Endif
If dx==0 AND dy<>0 Then
If dy>0 Then
StepSucess=Go(4,35,300) ;S - End
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
StepSucess=Go(4,35,300) ;S - End
Endif
Endif
If dy<0 Then
StepSucess=Go(0,33,300) ;N - PgUp
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
Endif
StepSucess=Go(0,33,300) ;N - PgUp
Endif
Endif
Endif
Wend
end sub
sub Go(dir,key,walkwait)
VAR x,y, OldDir
x=UO.GetX()
y=UO.GetY()
OldDir=UO.GetDir()
If UO.GetDir()<>dir Then
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
Endif
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If x==UO.GetX() AND y==UO.GetY() AND OldDir<>UO.GetDir() Then
UO.Press(key)
wait(walkwait)
Endif
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If x==UO.GetX() AND y==UO.GetY() Then
UO.Print("Zasada!")
return -1
Else
return 1
Endif
end sub
Sub Checklag()
deljournal('a backpack')
uo.click('backpack')
repeat
wait(50)
until uo.injournal('a backpack')
endsub
Sub deljournal(msg)
while uo.injournal(msg)
uo.setjournalline(uo.injournal(msg)-1,"")
wend
endsub
-
- Posts: 247
- Joined: 2008-09-12 05:07:34
-
- Posts: 247
- Joined: 2008-09-12 05:07:34
-
- Posts: 247
- Joined: 2008-09-12 05:07:34
Code: Select all
sub Mining_Carve()
var i
dim x[3],y[3] #если массивы увеличиваешь на 1,то будет уже x[4],y[4]
x[0]=356
y[0]=1461
x[1]=357
y[1]=1438
x[2]=389
y[2]=1436
x[3]= #и сюда вбиваешь х и у ещё одной точки, понятно?
y[3]=
repeat
for i=0 to 2 #и тут цикл уже будет for i=0 to 3
smartwalk(x[i],y[i])
mining()
next
until uo.weight>=uo.str*4
endsub
sub Mining()
var x,y
for x=-2 to 2
for y=-2 to 2
if x==0 and y==0 then
wait(500)
else
uo.deletejournal()
uo.waittargettile('0',str(uo.getx('self')+x),str(uo.gety('self')+y),'0')
uo.usetype('NPF')
repeat
wait(300)
until uo.injournal('far away|no more|nothing here|in rock')
endif
next
next
endsub
Sub Checklag()
deljournal('a backpack')
uo.click('backpack')
repeat
wait(50)
until uo.injournal('a backpack')
endsub
Sub deljournal(msg)
while uo.injournal(msg)
uo.setjournalline(uo.injournal(msg)-1,"")
wend
endsub
Sub st(x,y,stepdelay)
var xn=uo.getx('self'),yn=uo.gety('self'),xp,yp
if uo.getdir('self')<>x then
uo.press(y)
wait(100)
checklag()
endif
uo.press(y)
wait(stepdelay)
checklag()
xp=uo.getx('self')
yp=uo.gety('self')
if xn==xp and yn==yp then
uo.press(y)
wait(stepdelay)
checklag()
xp=uo.getx('self')
yp=uo.gety('self')
endif
if xn==xp and yn==yp then
uo.press(y)
wait(stepdelay)
checklag()
xp=uo.getx('self')
yp=uo.gety('self')
endif
if xn==xp and yn==yp then
return 0
else
return uo.getdir('self')+1
endif
endsub
#Millerbeer 2009
#моя ходилка типа с зачатками интеллекта :-)
Sub SmartWalk(xk,yk)
var xn,yn,stepdelay,gon,tempx,tempy,i,z,q,m,count='z',flag=0,prec=1;prec-точность с какой надо подходить к клетке
dim sx[4], sy[4], px[100], py[100]
repeat
xn=uo.getx('self')
yn=uo.gety('self')
stepdelay=200
if xn>xk && yn>yk then
gon=st(7,38,stepdelay)
endif
if xn>xk && yn==yk then
gon=st(6,36,stepdelay)
endif
if xn>xk && yn<yk then
gon=st(5,37,stepdelay)
endif
if xn<xk && yn>yk then
gon=st(1,39,stepdelay)
endif
if xn<xk && yn==yk then
gon=st(2,34,stepdelay)
endif
if xn<xk && yn<yk then
gon=st(3,40,stepdelay)
endif
if xn==xk && yn>yk then
gon=st(0,33,stepdelay)
endif
if xn==xk && yn<yk then
gon=st(4,35,stepdelay)
endif
if xn==xk && yn==yk then
uo.print('Шеф, я на месте!!!')
return
endif
if gon==0 && dist(xn,yn,xk,yk)==1 then
uo.print('Сорри, шеф, малость недошёл!!!')
return
endif
if gon==0 && dist(xn,yn,xk,yk)>1 then
repeat
if count=='z' then
count=0
px[count]=uo.getx('self')
py[count]=uo.gety('self')
endif
if count>=0 then
z=0
for i=0 to count
if uo.getx('self')==px[i] && uo.gety('self')==py[i] then
z=1
endif
next
if z==0 then
count=count+1
if count==101 then
count=0
endif
px[count]=uo.getx('self')
py[count]=uo.gety('self')
endif
endif
sx[0]=uo.getx('self')
sy[0]=uo.gety('self')-1
sx[1]=uo.getx('self')+1
sy[1]=uo.gety('self')
sx[2]=uo.getx('self')
sy[2]=uo.gety('self')+1
sx[3]=uo.getx('self')-1
sy[3]=uo.gety('self')
for i=0 to 2
for z=0 to 2
if dist(sx[z],sy[z],xk,yk) > dist(sx[z+1],sy[z+1],xk,yk) then
tempx=sx[z+1]
tempy=sy[z+1]
sx[z+1]=sx[z]
sy[z+1]=sy[z]
sx[z]=tempx
sy[z]=tempy
endif
next
next
if count>=0 then
i=0
q=0
repeat
for z=0 to count
if sx[i]==px[z] && sy[i]==py[z] then
tempx=sx[i]
tempy=sy[i]
for m=i to 2
sx[m]=sx[m+1]
sy[m]=sy[m+1]
next
sx[3]=tempx
sy[3]=tempy
q=q+1
flag=1
endif
next
if flag==0 then
i=i+1
else
flag=0
endif
until i>=3 || q>=3
endif
i=0
repeat
tempx=uo.getx('self')
tempy=uo.gety('self')
if tempx>sx[i] && tempy==sy[i] then
gon=st(6,36,stepdelay)
else
if tempx<sx[i] && tempy==sy[i] then
gon=st(2,34,stepdelay)
else
if tempx==sx[i] && tempy>sy[i] then
gon=st(0,33,stepdelay)
else
if tempx==sx[i] && tempy<sy[i] then
gon=st(4,35,stepdelay)
else
if tempx==xk && tempy==yk then
uo.print('Шеф, я на месте!!!')
return
else
if gon==0 && dist(sx[i],sy[i],xk,yk)==1 then
uo.print('Сорри, шеф, недошёл!!!')
return
endif
endif
endif
endif
endif
endif
i=i+1
until gon || i>3
until dist(uo.getx('self'),uo.gety('self'),xk,yk)<=1
endif
until dist(uo.getx('self'),uo.gety('self'),xk,yk)<=prec
endsub
Sub Dist(x1,y1,x2,y2)
var dx,dy
if x1-x2 > 0 then
dx=x1-x2
else
if x1-x2 < 0 then
dx=x2-x1
else
dx=0
endif
endif
if y1-y2 > 0 then
dy=y1-y2
else
if y1-y2 < 0 then
dy=y2-y1
else
dy=0
endif
endif
if dx>=dy then
return dx
else
return dy
endif
endsub
Last edited by Millerbeer on 2009-03-16 20:42:23, edited 2 times in total.
-
- Posts: 247
- Joined: 2008-09-12 05:07:34
-
- Posts: 247
- Joined: 2008-09-12 05:07:34