Untitled
unknown
plain_text
2 years ago
4.3 kB
6
Indexable
igalinti:=0
dalis:=360/8
dalispuse:=dalis/2
; Nustatykite slenkstį pelės judesiui
threshold := 3
dalis:=360/8
dalispuse:=dalis/2
; Nustatykite klavišų pasikartojimo delsą ir greitį
SetKeyDelay, 0, 50
; Sekite dabartinę pelės poziciją
MouseGetPos, currentX, currentY, R
; Ciklas be galo
Loop
{
; Gaukite naują pelės poziciją
MouseGetPos, newX, newY, R
; Apskaičiuokite skirtumą tarp pelės pozicijų
deltaX := newX - currentX
deltaY := newY - currentY
; Patikrinkite ar pelė pasislinko daugiau nei slenkstis
p:=-1
if (!deltaX=0 or !deltaY=0)
p:=kampas(newX, newY, currentX, currentY)
if (GetKeyState("Left") and deltaX)>-threshold
SendInput {Left up}
if (GetKeyState("Right") and deltaX)<threshold
SendInput {Right up}
if (GetKeyState("Up") and deltaY)>-threshold
SendInput {Up up}
if (GetKeyState("Down") and deltaY)<threshold
SendInput {Down up}
if (p<=dalispuse and p>-1)
{
if GetKeyState("Left")
SendInput {Left up}
if GetKeyState("Up")
SendInput {Up up}
if GetKeyState("Down")
SendInput {Down up}
if (deltaX>=threshold and !GetKeyState("Right"))
SendInput {Right down}
}
if (p>=180-dalispuse)
{
if GetKeyState("Right")
SendInput {Right up}
if GetKeyState("Up")
SendInput {Up up}
if GetKeyState("Down")
SendInput {Down up}
if (deltaX<=-threshold and !GetKeyState("Left"))
SendInput {Left down}
}
if (p>=90-dalispuse and p<=90+dalispuse)
{
if GetKeyState("Left")
SendInput {Left up}
if GetKeyState("Right")
SendInput {Right up}
if (deltaY<=-threshold)
{
if GetKeyState("Down")
SendInput {Down up}
if !GetKeyState("Up")
SendInput {Up down}
}
if (deltaY>=threshold)
{
if GetKeyState("Up")
SendInput {Up up}
if !GetKeyState("Down")
SendInput {Down down}
}
}
if (p<180-dalispuse and p>90+dalispuse)
{
if (deltaY<=-threshold)
{
if GetKeyState("Right")
SendInput {Right up}
if GetKeyState("Down")
SendInput {Down up}
if (deltaX<=-threshold and !GetKeyState("Left"))
SendInput {Left down}
}
if (deltaY>=threshold)
{
if GetKeyState("Right")
SendInput {Right up}
if GetKeyState("Up")
SendInput {Up up}
if (deltaX<=-threshold and !GetKeyState("Left"))
SendInput {Left down}
}
}
if (p>dalispuse and p<90-dalispuse)
{
if (deltaY<=-threshold)
{
if GetKeyState("Left")
SendInput {Left up}
if GetKeyState("Down")
SendInput {Down up}
if (deltaX>=threshold and !GetKeyState("Right"))
SendInput {Right down}
}
if (deltaY>=threshold)
{
if GetKeyState("Left")
SendInput {Left up}
if GetKeyState("Up")
SendInput {Up up}
if (deltaX>=threshold and !GetKeyState("Right"))
SendInput {Right down}
}
}
; Atnaujinkite dabartinę pelės poziciją
currentX := newX
currentY := newY
WinGetTitle, Title, A
; Patikrinkite ar pelė pasiekė žaidimo lango kraštą ir perkelti ją į žaidimo lango vidurį
WinGetPos, X, Y, Width, Height, %Title%
if (currentX <= 0 or currentX >= Width-threshold or currentY <= 0 or currentY >= Height-threshold)
{
currentX := Width / 2
currentY := Height / 2
MouseMove, currentX, currentY
; Išjunkite rodyklių klavišus kai pelė yra perkelta į ekrano vidurį
;SendInput {Right up}
;SendInput {Left up}
;SendInput {Down up}
;SendInput {Up up}
}
; Miegokite trumpam laikui sumažinti CPU naudojimą
Sleep 10
}
; Išleiskite visus klavišus kai script'as išeina
OnExit:
SendInput {Right up}
SendInput {Left up}
SendInput {Down up}
SendInput {Up up}
ExitApp
kampas(x2, y2, vidurysx, vidurysy)
{
pi:=4*ATan(1)
x1:=vidurysx
y1:=0
x2:=x2-vidurysx
y2:=vidurysy-y2
m:=Acos((x1*x2+y1*y2)/(Sqrt(x1*x1+y1*y1)*Sqrt(x2*x2+y2*y2)))*180/pi
return m
}
Editor is loading...