# Can anyone explain me what I'm doing wrong ?

## Recommended Posts

There is a my script. What it is suppose to do is move the mouse to point a or b and then go to the final mouse position. I don't know what i did wrong with my code ... It is possibly the mathematic solution wich is bad... Anyway could anyone try to explain me what i'm not doing right ??

#cs

|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯a¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
|                   |                   |
|                   |                   |
x ------------------------------------- y
|                   |                   |
|                   |                   |
|___________________b___________________|

a = H ==> ( 1/4 X to Y)   L ==> ( 1/2 X to Y)
b = H ==> (-1/4 X to Y)   L ==> ( 1/2 X to Y)

#ce

HotKeySet("x", "End")

Global \$XtoY, \$a, \$b

Func _Specialmove(\$startx, \$starty, \$endx, \$endy)

;==Start shit==
\$pos = MouseGetPos()
MouseMove(\$pos[0], \$pos[1], 0)
MouseMove(\$startx, \$starty)

;==Declare Variables==
\$XtoY[0] = (0.5*(\$endx - \$startx))
\$XtoY[1] = (0.5*(\$endy - \$starty))

\$a[0] =  0.25 * (\$XtoY[0])
\$a[1] =  0.5  * (\$XtoY[1])

\$b[0] = -0.25 * (\$XtoY[0])
\$b[1] =  0.5  * (\$XtoY[1])

;==Final Move==
MouseMove(\$a[0], \$a[1])
MouseMove(\$endx, \$endy)

EndFunc

I wish you understand what i mean

Sorry for bad english

##### Share on other sites

Opt("GUIOnEventMode", 1) ; maybe not needed ...

HotKeySet("x", "End")

While 1
_Specialmove(0, 0, 100, 50)
Sleep(100)
WEnd

Func _Specialmove(\$startx, \$starty, \$endx, \$endy)
Local \$XtoY, \$a, \$b

;==Start shit==
\$pos = MouseGetPos()
;    MouseMove(\$pos[0], \$pos[1], 0) --> not needed
MouseMove(\$startx, \$starty)

;==Declare Variables==
\$XtoY[0] = (0.5*(\$endx - \$startx))
\$XtoY[1] = (0.5*(\$endy - \$starty))

\$a[0] =  0.25 * (\$XtoY[0])
\$a[1] =  0.5  * (\$XtoY[1])

\$b[0] = -0.25 * (\$XtoY[0])
\$b[1] =  0.5  * (\$XtoY[1])

;==Final Move==
MouseMove(\$a[0], \$a[1])
MouseMove(\$endx, \$endy)
EndFunc

Func End()
Exit
EndFunc
Edited by Zedna

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

×

• Wiki

• Back

• Git