MouseGetPos

Ask gaming related questions
iHuggles
Posts: 6
Joined: 14 Nov 2017, 14:44

MouseGetPos

16 Nov 2017, 14:11

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?
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

19 Nov 2017, 07:37

Are you using MouseGetPos to try to actually move the mouse pointer?
User avatar
evilC
Posts: 4083
Joined: 27 Feb 2014, 12:30

Re: MouseGetPos

20 Nov 2017, 12:28

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?
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

14 Dec 2017, 21:10

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?
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

24 Dec 2017, 05:50

@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
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

24 Dec 2017, 08:38

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.
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

25 Dec 2017, 09:31

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.
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

25 Dec 2017, 11:55

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::.
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

26 Dec 2017, 08:50

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?
Last edited by blueeyiz702 on 26 Dec 2017, 10:55, edited 1 time in total.
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

26 Dec 2017, 10:20

Yes. Did you try it?
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

26 Dec 2017, 11:12

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
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

26 Dec 2017, 11:46

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.
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

27 Dec 2017, 04:08

i tried and its not working rite and im trying to make it shoot once it hits that color.
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

27 Dec 2017, 08:45

Did you put Suspend before Pause?
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

28 Dec 2017, 04:01

boiler wrote:Did you put Suspend before Pause?

Hmmm,no. let me try that and see what happens.
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

01 Jan 2018, 04:36

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.
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

01 Jan 2018, 09:06

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.
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

02 Jan 2018, 07:19

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
User avatar
boiler
Posts: 2369
Joined: 21 Dec 2014, 02:44

Re: MouseGetPos

02 Jan 2018, 08:49

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.
User avatar
blueeyiz702
Posts: 19
Joined: 12 Dec 2017, 20:12
Location: The Death Star,Playing PUBG with Darth.
Contact:

Re: MouseGetPos

03 Jan 2018, 09:04

it keeps doing same thing,and when i aim it point at ground or up to sky in game. ugh

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 3 guests