Page 1 of 1

Ходим по координатам

Posted: 2007-08-01 12:06:29
by Scripts Writer
Ходилка по координатам.

Code: Select all

##################### 
# by Scripts Writer #
# 01/08/07          #
#####################
sub Step(x,y,mx,my,forstep)
  if uo.GetX('self') <> x then
    if uo.GetY('self') <> y then
      if mx<0 then
        if my<0 then
          uo.Press(40)
          wait(forstep)
        else
          uo.Press(39)
          wait(forstep)
        end if
      else
        if my<0 then
          uo.Press(37)
          wait(forstep)
        else
          uo.Press(38)
          wait(forstep)
        end if
      end if
    else
      if mx<0 then
        uo.Press(34)
        wait(forstep)
      else
        uo.Press(36)
        wait(forstep)
      end if
    end if
  else
    if my<0 then
      uo.Press(35)
      wait(forstep)
    else
      uo.Press(33)
      wait(forstep)
    end if
  end if
end sub

sub Go_To(x,y)
var mx,my,fx,fy
  var xx=x
  var yy=y
  var DistX=0
  var DistY=1
  var forstep=300
 
  repeat
    mx=uo.GetX('self')-x
    my=uo.GetY('self')-y
    fx=mx+x
    fy=my+y
    Step(xx,yy,mx,my,forstep)
  until x==fx+DistX && y==fy+DistY || x==fx-DistX && y==fy+DistY || x==fx+DistX && y==fy-DistY || x==fx-DistX && y==fy-DistY || x==fx && y==fy
end sub