Yoko
http://forum.yoko.com.ua/

Ходилка
http://forum.yoko.com.ua/viewtopic.php?f=20&t=4975
Page 1 of 1

Author:  Toolmate [ 2005-08-27 22:31:04 ]
Post subject:  Ходилка

Что нужно сделать чтоб в ниже приведенном скрипте чар ходил по указанным координатам? Или накрайняк напишите свой скрипт.

Code:
sub GotoXY(x,y,prec) 
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 Numb(x-myX)<=1 and Numb(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 Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

Author:  Dron D. [ 2005-08-28 00:59:10 ]
Post subject: 

Code:
dig()
go(2251,434,33,0)
    go(2251,433,36,0)
end sub


------X----Y---Z-
go(2251,434,33,0)

Author:  Toolmate [ 2005-08-28 11:09:01 ]
Post subject: 

и куда это вставлять

Author:  Leo [ 2005-08-28 11:37:15 ]
Post subject: 

Всё это в один скрипт и запускай функцию test() :wink:
Code:
sub test()
GotoXY(2532,576,"") ##тут вставь координаты куда идти
endsub

sub GotoXY(x,y,prec)
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 Numb(x-myX)<=1 and Numb(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 Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

Author:  Toolmate [ 2005-08-28 13:36:29 ]
Post subject: 

а вот допустим он идет по этим координатам в шахту покопал там, а назад он как пойдет?

Author:  Leo [ 2005-08-28 13:40:57 ]
Post subject: 

Координаты другие поставь :wink:

Author:  Toolmate [ 2005-08-28 13:43:44 ]
Post subject: 

в одном скрипте чтоб это было.
идет туда и оттуда

Author:  Leo [ 2005-08-28 13:46:38 ]
Post subject: 

Code:
sub test()
GotoXY(2532,576,"") ##тут вставь координаты куда идти
...
действия
...
GotoXY(2532,576,"")
endsub

Page 1 of 1 All times are UTC+02:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/