Ходилка

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Toolmate
Posts: 104
Joined: 2005-08-18 09:09:18
Location: RUSSIA

Ходилка

Post 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
Dron D.
Posts: 190
Joined: 2004-12-13 01:27:00

Post 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)
Toolmate
Posts: 104
Joined: 2005-08-18 09:09:18
Location: RUSSIA

Post by Toolmate »

и куда это вставлять
Leo
Expert!
Posts: 791
Joined: 2005-01-15 19:15:05
Location: Dragon World
Contact:

Post 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
Toolmate
Posts: 104
Joined: 2005-08-18 09:09:18
Location: RUSSIA

Post by Toolmate »

а вот допустим он идет по этим координатам в шахту покопал там, а назад он как пойдет?
Leo
Expert!
Posts: 791
Joined: 2005-01-15 19:15:05
Location: Dragon World
Contact:

Post by Leo »

Координаты другие поставь :wink:
Toolmate
Posts: 104
Joined: 2005-08-18 09:09:18
Location: RUSSIA

Post by Toolmate »

в одном скрипте чтоб это было.
идет туда и оттуда
Leo
Expert!
Posts: 791
Joined: 2005-01-15 19:15:05
Location: Dragon World
Contact:

Post by Leo »

Code: Select all

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