Page 1 of 1

Ходилка

Posted: 2005-08-27 22:31:04
by Toolmate
Что нужно сделать чтоб в ниже приведенном скрипте чар ходил по указанным координатам? Или накрайняк напишите свой скрипт.

Code: Select all

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

Posted: 2005-08-28 00:59:10
by Dron D.

Code: Select all

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


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

Posted: 2005-08-28 11:09:01
by Toolmate
и куда это вставлять

Posted: 2005-08-28 11:37:15
by Leo
Всё это в один скрипт и запускай функцию test() :wink:

Code: Select all

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

Posted: 2005-08-28 13:36:29
by Toolmate
а вот допустим он идет по этим координатам в шахту покопал там, а назад он как пойдет?

Posted: 2005-08-28 13:40:57
by Leo
Координаты другие поставь :wink:

Posted: 2005-08-28 13:43:44
by Toolmate
в одном скрипте чтоб это было.
идет туда и оттуда

Posted: 2005-08-28 13:46:38
by Leo

Code: Select all

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