Jump to content

Move Mouse


Recommended Posts

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
Link to comment
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

Link to comment
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?

Link to comment
Share on other sites

  • Moderators

...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.

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.

Link to comment
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?

Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
Share on other sites

  • Moderators

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).

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...