Sign in to follow this  
Followers 0
DarkAngelBGE

Really simple mousecoord problem

8 posts in this topic

#1 ·  Posted (edited)

Hi guys, I am building a little script for a game where I want to hit one button at a location and then mouseclick again on another.

I have tracked the mouse positions for both locations using mousegetPos(). Now when I use these coordinates in Windows all is fine, but in the game the mouse jumps from the left top to the right bottom. Can someone please help?

AutoItSetOption("MouseCoordMode",0)

HotKeySet("{pause}","pausel")
HotKeySet("{esc}","stop")
HotKeySet("x","start")

func pausel()
    while 1
        sleep(100)
    WEnd
EndFunc

func stop()
    Exit
endfunc

sleep(8000)
start()
;track_mousepos()

func start()
    while 1
        sleep(2000)
        mouseclick("left",339,130,10)
        sleep(2000)
        mouseclick("left",643,1006,10)
    WEnd
endfunc

Thanks in advance"

Edited by DarkAngelBGE

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hmm, I don't see anything there that would cause sporadic behavior ... What game are you playing?

P.S.

This is the Examples forum, if you need to ask a support question, you do it in the support forum, I'm sure they'll move it for you ... so don't start another thread.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Okay thanks about the forum's topic.

Well it's Battlefield 2...in commander mode I simply want to to auto-launch an UAV (dunno if that tells you anything). Is the coordemode wrong maybe?

Share this post


Link to post
Share on other sites

Okay thanks about the forum's topic.

Well it's Battlefield 2...in commander mode I simply want to to auto-launch an UAV (dunno if that tells you anything). Is the coordemode wrong maybe?

I wouldn't know that answer... 1. I don't play the game, 2. I don't know how you got your coords (how you had them set up in AutoInfo.exe that is).

If you look at the AutoInfo.exe display you'll see what coord mode you are in, to change it go to Options >> Coord Mode >> and change it to the desired setting (I usually use Client coords, so for the Opts it would be Opt('MouseCoordMode', 2) and Opt('PixelCoordMode', 2) (if you are using pixel functions).


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Doesn't AutoItSetOption("MouseCoordMode",0) do the job either? Look at the first line in my script.

Share this post


Link to post
Share on other sites

Doesn't AutoItSetOption("MouseCoordMode",0) do the job either? Look at the first line in my script.

I didn't state it didn't do "your" job, to be honest, how can we tell if it does... 0 stands for window coords, how do we know that you got window coords, I mean... AutoInfo.exe defaults to screen coords if you haven't changed them, and that's a default 1 for that AutoItSetOption()? You left it open for assumption for us/me because you haven't provided enough information to help you past the point I have (for me personally for not having the means to help with the "game" itself).

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Okay tracked them using AutoInfo.exe. Also made it in screenmode and added Opt('MouseCoordMode', 1) to be in screen mode. When not in the game the program works just fine. Just in the game itself it goes from the left top to the right bottom.

I mean in screen mode the resolution of the game plays no role right? Because it is absolute screen?

Share this post


Link to post
Share on other sites

Okay Window mode won't work either. Always pushing from top left to right bottom...

Share this post


Link to post
Share on other sites

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

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0