Walking using Injection / Ходьба на инжекте

Things you must know!

Moderators: Murderator+, Murderator

Post Reply
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Walking using Injection / Ходьба на инжекте

Post by Yoko »

There is no now special command to move in Injection.
Нет специальной команды для хотьбы на инжекте.

1) use EasyUO for moving http://www.easyuo.com
2) you may use this simple macro, but you must keep in mind it is primitive, not evase obstacles and lag sensitive.
(примитивный макрос для хотьбы по мировым координатам)

X,Y - world coordinates where you'd like to move, PREC is precision, how close macro must walk to be enough. 0 mean exact location, 1 - exact or nearby cell, and so on.
X,Y - мировые координаты куда нужно стать, PREC это точность, насколько близко нужно подойти. 0 означает место в точности, 1 - в точности или соседняя клетка и т.д.

Code: Select all

sub gotoxy(x,y,prec) 
var ld=0,ldc=0 
var dx,dy 
var mx,my 
var ox,oy,mk,k 
#uo.print(">") 
#uo.track("1",str(x),str(y)) 
start: 
mx=UO.GetX() 
my=UO.GetY() 
dx=mx-x 
if dx<0 then 
dx=0-dx 
endif 
dy=my-y 
if dy<0 then 
dy=0-dy 
endif 
if dy>dx then 
dx=dy 
end if 
if dx<=prec then 
return 
end if 
if not ldc then 
uo.print(STR(dx)) 
end if 
if dx<3 then 
mk=70 
else 
mk=15 
end if 

ox=mx 
oy=my 
for k=1 to mk 
mx=UO.GetX() 
my=UO.GetY() 
if mx<>ox or my<>oy then 
goto sdidapl 
end if 
wait(10) 
next 
sdidapl: 

mx=UO.GetX() 
my=UO.GetY() 
dx=mx-x 
if dx<0 then 
dx=0-dx 
endif 
dy=my-y 
if dy<0 then 
dy=0-dy 
endif 
if dy>dx then 
dx=dy 
end if 

if dx<=prec then 
return 
end if 
if ld==dx then 
ldc=ldc+1 
if ldc>100 then 
uo.print("Can not reach location!") 
return 
end if 
else 
ld=dx 
end if 

if mx==x then 
if my==y then 
return 
endif 
if my>y then 
#UO.Print("UR") 
UO.Press(33) 
goto start 
endif 
#UO.Print("DL") 
UO.Press(35) 
goto start 
end if 
if mx<x then 
if my>y then 
#UO.Print("R") 
UO.Press(39) 
goto start 
endif 
if my==y then 
#UO.Print("DR") 
UO.Press(34) 
goto start 
endif 
#UO.Print("D") 
UO.Press(40) 
goto start 
end if 
if my<y then 
#UO.Print("L") 
UO.Press(37) 
goto start 
endif 
if my==y then 
#UO.Print("LU") 
UO.Press(36) 
goto start 
endif 
#UO.Print("U") 
UO.Press(38) 
goto start 
end sub
Example to use it in your script:
Пример использования в вашем скрипте:

Code: Select all

sub main() 
...... 
var myobject=uo.getserial("laststatus") 
var goX=uo.getx(myobject) 
var goY=uo.gety(myobject) 
#go to object X:Y in 0-1 cells range 
gotoxy(goX,goY,1)  
...... 
end sub 

..... 
#somewhere / гдето 
sub gotoxy(x,y,prec) 
..... 
end sub 
Post Reply