Jump to content

Why would this click twice?


Recommended Posts

  • Moderators

Ok, I'm using a script I wrote a long time ago that worked flawlessly. Last night while playing my game, I couldn't stop the bloody thing from clicking the same action twice.

It looked like the action was being called twice by the client, but I inserted a Message Box to see, and it wasn't.

Well, I did my standard, once a week virus scan and found 3 trojans (ugh!!). I've deleted them, and the action is still happening (thought maybe they had something to do with them... don't ask me the names... I already forgot it was late)

So here's the script I always use:

Global = $Game = "Game Title"

While WinExist($Game)
      Sleep(100)

      $Action = ControlGetText("Game Console", "Action", 1211)
      If $Action = "Action" Then
         Sleep(Random(1000, 7000))
         If Not Winactive($Game) Then WinActivate($Game)
         MouseClick("left", Random(425, 514), Random(528, 555), 1, 1)
      EndIf
Wend

This is the one that went batty on m: It waits the same exact Sleep(Random) time as it did for the initial MouseClick

Yet my old compiled one that is the same as code above still works the same as it did??

Tried this:

Global = $Game = "Game Title"

While WinExist($Game)
      Sleep(100)

      $Action = ControlGetText("Game Console", "Action", 1211)
      If $Action = "Action" Then
         Sleep(Random(1000, 7000))
         If Not Winactive($Game) Then WinActivate($Game)
         MsgBox(0, "", $Action, 1)
      EndIf
Wend

Message Box never came back up twice like MouseClick did.

And this:

Global = $Game = "Game Title"

While WinExist($Game)
      Sleep(100)

      $Action = ControlGetText("Game Console", "Action", 1211)
      If $Action = "Action" Then
         Sleep(Random(1000, 7000))
         If Not Winactive($Game) Then WinActivate($Game)
         MsgBox(0, "", $Action, 1)
         MouseClick("left", Random(425, 514), Random(528, 555), 1, 1)
      EndIf
Wend

With this it only mouse clicked once. I dunno... I'm baffled (Think a reformat is comming :) )

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

I think the system is fast and once you have entered the If $Action =

it will enter twice before the screen can change

try changing this to a longer sleep

While WinExist($Game)

>>>> Sleep(100)

(just a guess)

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

  • Moderators

Sleep(100)

Holy Cow, I must of looked at this a million times. I did change that from Sleep[500] . Sometimes it takes someone looking in.

Great observation Valuater... Thanks!!

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

Sleep(100)

Holy Cow, I must of looked at this a million times.  I did change that from Sleep[500] .  Sometimes it takes someone looking in.

Great observation Valuater... Thanks!!

<{POST_SNAPBACK}>

That was a wild guess.... i was thinking..

??? maybe that was a dumb post i made??? ..lol

Glad it helped

8)

NEWHeader1.png

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