Вопрос такой - У меня ходилка на випке ходит не в сторону сундука а в другую сторону
;---------------- Õîäèëêà -----------------------
sub GoW()
VAR walkwait=300
VAR x,y,dir=6
VAR key=36 ; Home key
x=UO.GetX()
y=UO.GetY()
while UO.GetDir()<>dir
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
wend
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetX()+1==x Then
return -1
Else
return 1
Endif
end sub
sub GoN()
VAR walkwait=300
VAR x,y,dir=0
VAR key=33 ; PgUp
x=UO.GetX()
y=UO.GetY()
while UO.GetDir()<>dir
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
wend
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetY()+1==y Then
return -1
Else
return 1
Endif
end sub
sub GoE()
VAR walkwait=300
VAR x,y,dir=2
VAR key=34 ; PgDown
x=UO.GetX()
y=UO.GetY()
while UO.GetDir()<>dir
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
wend
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetX()-1==x Then
return -1
Else
return 1
Endif
end sub
sub GoS()
VAR walkwait=300
VAR x,y,dir=4
VAR key=35 ; End
x=UO.GetX()
y=UO.GetY()
while UO.GetDir()<>dir
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
wend
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetY()-1==y Then
return -1
Else
return 1
Endif
end sub
sub GoWN()
VAR walkwait=300
VAR x,y,dir=7
VAR key=38 ; UpArrow
x=UO.GetX()
y=UO.GetY()
If UO.GetDir()<>dir Then
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
Endif
If UO.GetDir()==dir Then
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetDir()==dir Then
return -1
Else
return UO.GetDir()
Endif
Else
return UO.GetDir()
Endif
end sub
sub GoNE()
VAR walkwait=300
VAR x,y,dir=1
VAR key=39 ; RightArrow
x=UO.GetX()
y=UO.GetY()
If UO.GetDir()<>dir Then
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
Endif
If UO.GetDir()==dir Then
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetDir()==dir Then
return -1
Else
return UO.GetDir()
Endif
Else
return UO.GetDir()
Endif
end sub
sub GoSE()
VAR walkwait=300
VAR x,y,dir=3
VAR key=40 ; DownArrow
x=UO.GetX()
y=UO.GetY()
If UO.GetDir()<>dir Then
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
Endif
If UO.GetDir()==dir Then
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetDir()==dir Then
return -1
Else
return UO.GetDir()
Endif
Else
return UO.GetDir()
Endif
end sub
sub GoSW()
VAR walkwait=300
VAR x,y,dir=5
VAR key=37 ; LeftArrow
x=UO.GetX()
y=UO.GetY()
If UO.GetDir()<>dir Then
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
Endif
If UO.GetDir()==dir Then
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
Endif
If UO.GetDir()==dir Then
return -1
Else
return UO.GetDir()
Endif
Else
return UO.GetDir()
Endif
end sub
#==============================================================
# WalkN(X,Y,Serial) - char is walking by dX and dY step
# sub using Home, End, PgUp, PgDown keys
# d'not rebind this key from default action!
# walkwait - delay after keypress
#--------------------------------------------------------------
sub WalkN(x,y,Target)
VAR i
VAR dx,dy,Exit=0
While Exit<>1
If Target<>"" Then
dx=UO.GetX(Target)-UO.GetX()
dy=UO.GetY(Target)-UO.GetY()
; UO.Print("Target locked!")
If UO.GetDistance(Target)<2 Then
Exit=1
Endif
Else
dx=x-UO.GetX()
dy=y-UO.GetY()
If dx==0 AND dy==0 Then
Exit=1
Endif
Endif
If dx<>0 AND dy<>0 Then
If dx>0 AND dy>0 Then
GoSE()
Endif
If dx>0 AND dy<0 Then
GoNE()
Endif
If dx<0 AND dy>0 Then
GoSW()
Endif
If dx<0 AND dy<0 Then
GoWN()
Endif
Endif
If dx<>0 AND dy==0 Then
If dx>0 Then
GoE()
Endif
If dx<0 Then
GoW()
Endif
Endif
If dx==0 AND dy<>0 Then
If dy>0 Then
GoS()
Endif
If dy<0 Then
GoN()
Endif
Endif
Wend
end sub
/слево наискосо юг,правый верхний угол север http:**dump.ru*file*2863945 скрин *=\
Ходилка для випки,что-то не то =(
Moderators: Murderator+, Murderator
-
- Posts: 9
- Joined: 2009-06-08 10:30:25
Ходилка для випки,что-то не то =(
Last edited by Night Party on 2009-06-08 11:04:23, edited 1 time in total.
Code: Select all
sub Abs(num)
if num < 0 then
return -num
end if
return num
end sub
sub Sig(num)
if num < 0 then
return -1
else
if num == 0 then
return 0
endif
endif
return 1
end sub
sub MoveToXY(x, y, prec)
var dx, dy
dim Key[9]
Key[0]=37
Key[1]=35
Key[2]=40
Key[3]=36
Key[4]=12
Key[5]=34
Key[6]=38
Key[7]=33
Key[8]=39
dx=x-uo.GetX()
dy=-y+uo.GetY()
while (Abs(dx) > prec) or (Abs(dy) > prec)
dx=x-uo.GetX()
dy=-y+uo.GetY()
uo.Press(Key[(sig(dy)+1)*3+1+sig(dx)])
wait(10)
wend
end sub
sub MoveTo(object, prec)
var dx, dy
dim Key[9]
Key[0]=37
Key[1]=35
Key[2]=40
Key[3]=36
Key[4]=12
Key[5]=34
Key[6]=38
Key[7]=33
Key[8]=39
while uo.GetDistance(object) > prec
dx=uo.GetX(object)-uo.GetX()
dy=-uo.GetY(object)+uo.GetY()
uo.Press(Key[(sig(dy)+1)*3+1+sig(dx)])
wait(10)
wend
end sub
-
- Posts: 9
- Joined: 2009-06-08 10:30:25