Page 1 of 2

MouseGetPos

Posted: 16 Nov 2017, 14:11
by iHuggles
Hello,

Im having problems with mouse movement inside a game. Im using Active Window Info to try and get the mouse position but inside the game the mouse position stays the same. I was wondering if there was any other way to accurately move to a certain position inside the game?

Re: MouseGetPos

Posted: 19 Nov 2017, 07:37
by boiler
Are you using MouseGetPos to try to actually move the mouse pointer?

Re: MouseGetPos

Posted: 20 Nov 2017, 12:28
by evilC
Are you trying to detect mouse pointer position while playing a mouse-aim FPS game?
If so, you are probably doing it wrong - most mouse-aim FPS games utterly ignore the mouse cursor. If they did use the position of the mouse cursor, then you could only turn until the pointer hit the edge of the screen.
What are you trying to do?

Re: MouseGetPos

Posted: 14 Dec 2017, 21:10
by blueeyiz702
Recoil() ;Recoil
{
Global Auto
IF Auto
{
Loop
{
IF GetKeyState("LButton", "P")
{
MouseXY(1374,561)
sleep 30
}
else
break
}
}
}
return

i'm trying to get these but when i use window spy and get posx and posy it does not work. Am i missing something?

Re: MouseGetPos

Posted: 24 Dec 2017, 05:50
by blueeyiz702
@evilC,i'm trying to get this to work?

Lbutton::

PixelSearch, Px, Py, 0, 225, 198, 53, 0xe1c699, 3, Fast
Mousemove, %px%,%py%
Send Lbutton
Sleep 200
Mousemove, %px%,%py%
Return


and this is base i had to start with,im still learning.

Lbutton::

PixelSearch, Px, Py,0,600, 800,0, 0x9d6346, 3, Fast
Mousemove, %px%,%py%
Send Lbutton
Sleep 200
Mousemove, %px%,%py%
Return

Re: MouseGetPos

Posted: 24 Dec 2017, 08:38
by boiler
One problem is that your search area coordinates are not set up right. The first pair is to be the upper left corner, and the second pair is lower right. Perhaps you mean 0, 53, 198, 225. Your "base" example is also wrong. It would need to be 0, 0, 800, 600.

Note that your color is in BGR format. If you want it to be RGB, you have to add a space and RGB after Fast.

You don't need % signs in the MouseMove command parameters. It already evaluates them as expressions.

Re: MouseGetPos

Posted: 25 Dec 2017, 09:31
by blueeyiz702
Lbutton::

PixelSearch, Px, Py, 0, 0,1080, 1920, 0xe1c699 , 3, Fast, RGB
Mousemove, px, py
Send Lbutton
Sleep 200
Mousemove, px, py
Return

f12::

Pause

Suspend

Return

@boiler,so would this be correct then? and how do i add CapsLock to toggle on/off.

Re: MouseGetPos

Posted: 25 Dec 2017, 11:55
by boiler
Well, I'm thinking that your monitor is 1920x1080, not 1080x1920, so it seems you have those backwards, although I suppose it's possible you're using it in portrait mode. If not, then you should switch those.

You cannot have a space between Fast and RGB. They are the same parameter, not separate ones. Per the documentation, if you want both, you separate them with a space.

If you mean that you want CapsLock to Pause and Suspend your script just like you have F12 doing, just add Capslock:: on the line before F12::.

Re: MouseGetPos

Posted: 26 Dec 2017, 08:50
by blueeyiz702
Lbutton::

PixelSearch, Px, Py, 0, 0,1920, 1080, 0xe1c699 , 3, Fast RGB
Mousemove, px, py
Send Lbutton
Sleep 200
Mousemove, px, py
Return


Capslock::


f12::

Pause

Suspend

Return

Like this? its strange when i activate it i cant controll my mouse it wont let me click on game?

Re: MouseGetPos

Posted: 26 Dec 2017, 10:20
by boiler
Yes. Did you try it?

Re: MouseGetPos

Posted: 26 Dec 2017, 11:12
by blueeyiz702
boiler wrote:Yes. Did you try it?
when i use it i cant click with Lbutton. pointer goes all over
i need way to turn it on and off

Re: MouseGetPos

Posted: 26 Dec 2017, 11:46
by boiler
That’s what F12 and CapsLock are supposed to do. Did you try that?

Actually, you need to put Suspend before Pause so the hotkey is exempt from being suspended.

Re: MouseGetPos

Posted: 27 Dec 2017, 04:08
by blueeyiz702
i tried and its not working rite and im trying to make it shoot once it hits that color.

Re: MouseGetPos

Posted: 27 Dec 2017, 08:45
by boiler
Did you put Suspend before Pause?

Re: MouseGetPos

Posted: 28 Dec 2017, 04:01
by blueeyiz702
boiler wrote:Did you put Suspend before Pause?
Hmmm,no. let me try that and see what happens.

Re: MouseGetPos

Posted: 01 Jan 2018, 04:36
by blueeyiz702
boiler wrote:Did you put Suspend before Pause?
i tried and can't really notice if it does or does not. Maybe i need to find the exact color?
Its supposed to be light Beige,
I'm going to try window-spy and and take screen shot in game to see if they match up.

Re: MouseGetPos

Posted: 01 Jan 2018, 09:06
by boiler
Yes, the color needs to match within the variation you defined, which is 3. But that has nothing to do with whether Suspend and Pause work or not. Also, I don't think you want to Pause because you just need to suspend the hotkey so you can click normally, so I think you should just remove the Pause.

Re: MouseGetPos

Posted: 02 Jan 2018, 07:19
by blueeyiz702
boiler wrote:Yes, the color needs to match within the variation you defined, which is 3. But that has nothing to do with whether Suspend and Pause work or not. Also, I don't think you want to Pause because you just need to suspend the hotkey so you can click normally, so I think you should just remove the Pause.

ill do that and the color is light beige,and let me ask the color code should be RGB Correct?
and whats weird when i use Caplock to pause key. it won't work. everytime i click mouse it makes key unpause then pause

Re: MouseGetPos

Posted: 02 Jan 2018, 08:49
by boiler
blueeyiz702 wrote:and the color is light beige,and let me ask the color code should be RGB Correct?
It should be RGB if that's the format you used to identify the color 0xe1c699.
blueeyiz702 wrote:and whats weird when i use Caplock to pause key. it won't work. everytime i click mouse it makes key unpause then pause
Like I said, don't use Pause. Suspend is what you want in this case.

Re: MouseGetPos

Posted: 03 Jan 2018, 09:04
by blueeyiz702
it keeps doing same thing,and when i aim it point at ground or up to sky in game. ugh