Sign in to follow this  
Followers 0
HC0

Move Mouse

12 posts in this topic

Ok, what I am trying to do is make a thing for an FPS that shoots when it detecs a certain colour on the screen. I have everything working except I encounter a probelm. The crosshair is obviously stuck in the middle of the screen so when you use the move mouse command or mouseclick or anything like that, it just spins because you can't actually move the crosshair. Is there anyway around this? I'll post my code if anyone can think of something it'd be awesome!

sleep(5000)
$coord = PixelSearch( 0, 0, 800, 600, 0x150b0a, 10)
If Not @error Then
    MouseClick("left",$coord[0],$coord[1],20)
EndIf

Share this post


Link to post
Share on other sites



No one?

Share this post


Link to post
Share on other sites

Hi,

some games are protected. Try ControlClick

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Ok, I'll try be back with a response later.

Share this post


Link to post
Share on other sites

...No that's not the problem. I am able to control everything only because it is a crosshair, the crosshair is ALWAYS in the middle of the screen so if you do like "MouseClick('left",300,250") it just spins because the actual crosshair will not move even though AutoIt is trying to make it move. Any other suggestions?

Share this post


Link to post
Share on other sites

...No that's not the problem. I am able to control everything only because it is a crosshair, the crosshair is ALWAYS in the middle of the screen so if you do like "MouseClick('left",300,250") it just spins because the actual crosshair will not move even though AutoIt is trying to make it move. Any other suggestions?

Figure out how much it's moving and how much the difference would have to be and do a loop until the the Mouse is in the position you want it.

[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

To answer BuddyBoy, those are for flash games, way easier, as a matter of fact I've written for flash games before. It's different because the crosshair actually moves. Akthough there are some features in there I will add.

To answer SmOke_N, I don't really get what you mean. I could simply figure out the difference between my crosshair and the pixel just by doing a subtraction, that's simple but what after that?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

To answer BuddyBoy, those are for flash games, way easier, as a matter of fact I've written for flash games before. It's different because the crosshair actually moves. Akthough there are some features in there I will add.

To answer SmOke_N, I don't really get what you mean. I could simply figure out the difference between my crosshair and the pixel just by doing a subtraction, that's simple but what after that?

Something like this:
sleep(5000)
$coord = PixelSearch( 0, 0, 800, 600, 0x150b0a, 10)
If Not @error Then
    Local $xAdd = 0, $yAdd = 0
    MouseMove($coord[0] + $xAdd, $coord[1] + $yAdd, 1)
    Do
        $xAdd += 1
        $yAdd += 1
        MouseMove($coord[0] + $xAdd, $coord[1] + $yAdd, 1)
        $Mpos = MouseGetPos()
        Sleep(10)
    Until $Mpos[0] = $coord[0] And $Mpos[1] = $coord[1]
    MouseClick("left",$coord[0],$coord[1],20)
EndIf
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

#10 ·  Posted (edited)

I'm doing it in Wolf Enemy Territory.

The first one gives me an error, but the second gives me the same problem. If you have ET you can put this video in your /etmain/demos/" folder and watch it.

http://www.projectwasted.com/jmjl/demo0000.dm_84

If you don't have ET it's a f ree download from www.enemy-territory.com I beliee.

Edited by HC0

Share this post


Link to post
Share on other sites

I'm doing it in Wolf Enemy Territory.

The first one gives me an error, but the second gives me the same problem. If you have ET you can put this video in your /etmain/demos/" folder and watch it.

http://www.projectwasted.com/jmjl/demo0000.dm_84

If you don't have ET it's a f ree download from www.enemy-territory.com I beliee.

Yeah, sorry, I thought it might help, the first one needs Beta to work += is a beta option. As far as downloading it, I'm not going to personally do that, maybe someone would like too (Don't do online games).

[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

#12 ·  Posted (edited)

Nvm. Thought AutoIt moves the mouse until the mouses postion is over the place where it is supposed to be. (instead it checks a var, not sure how to word it)

Edited by gamerman2360

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