Jump to content

Recommended Posts

Posted

Okay, This is a script, for a game, where theres a ball, and you click it, and it stays up. The point is, to keep it off the ground as long as possible. Except, the response time is good, But, Just wondering if theres a way to give it a faster response?

#Include <Misc.au3>
Opt("MouseCoOrdMode", 0)
Opt("PixelCoOrdMode", 0)
HotKeySet("{F2}", "_Ball")

While 1
WEnd

Func _Ball()
    Do
    $Ball = PixelSearch(7, 200, 448, 353, 0x00CCFF, 25)
    If Not @Error Then
        MouseClick("Left", $Ball[0], $Ball[1], 1, 1)
    EndIf
    Until _IsPressed("72")
EndFunc
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
  • Moderators
Posted

Search a smaller area?

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.

Posted (edited)

Yeah, Ive already reduced it as much as I can, Any other way?

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Posted (edited)

#Include <Misc.au3>
Opt("MouseCoOrdMode", 0)
Opt("PixelCoOrdMode", 0)
HotKeySet("{F2}", "_Ball")

While 1
WEnd

Func _Ball1()
    AdlibEnable ( "_Ball2", 1 )
    Do
    $Ball = PixelSearch(7, 200, 448, 253, 0x00CCFF, 25)
    If Not @Error Then
        MouseClick("Left", $Ball[0], $Ball[1], 1, 1)
    EndIf
    Until _IsPressed("72")
EndFunc
 
Func _Ball2()
    Do
    $Ball = PixelSearch(7, 254, 448, 353, 0x00CCFF, 25)
    If Not @Error Then
        MouseClick("Left", $Ball[0], $Ball[1], 1, 1)
    EndIf
    Until _IsPressed("72")
    AdlibDisable ( )
EndFunc

i don't know how well it works since I don't have the actual game to test it on

basically, it just splits the search area in half and does the two halves at the same time

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

  • Moderators
Posted (edited)

You could use a While/WEnd loop instead of Do/Until ... seems to be a tad faster

Local $iCount1, $iCount2, $iTimer
Sleep(500)
$iTimer = TimerInit()
While TimerDiff($iTimer) / 1000 < 3
    $iCount1 += 1
WEnd
$iTimer = ''
Sleep(500)
$iTimer = TimerInit()
Do
    $iCount2 += 1
Until TimerDiff($iTimer) / 1000 > 2
MsgBox(64, 'Info', 'While loop counts = ' & $iCount1 & @CR & _
    'Do loop counts = ' & $iCount2)oÝ÷ Øey«-y²µë-×hzÁÛajÛ^²×hzÉ÷öÙh¢Jâm)äØ­Øº(ÉbàèýIíY¢[yö¬µêÈv÷öÙ'£-j»bhrߺǦÊÇ¥}÷Ý«­¢+Ù1½°ÀÌØí¥
½Õ¹ÐİÀÌØí¥
½Õ¹ÐȰÀÌØí¥Q¥µÈ°ÀÌØí¥¥Ä°ÀÌØí¥¥È)M±À ÔÀÀ¤(ÀÌØí¥Q¥µÈôQ¥µÉ%¹¥Ð ¤)¼($ÀÌØí¥
½Õ¹ÐĬôÄ($ÀÌØí¥¥ÄôQ¥µÉ¥ ÀÌØí¥Q¥µÈ¤¼ÄÀÀÀ)U¹Ñ¥°ÀÌØí¥¥ÄÐìôÈ(ÀÌØí¥Q¥µÈôÌäìÌäì)M±À ÔÀÀ¤(ÀÌØí¥Q¥µÈôQ¥µÉ%¹¥Ð ¤)]¡¥±ÀÌØí¥¥È±ÐìôÀÌØí¥¥Ä($ÀÌØí¥
½Õ¹ÐȬôÄ($ÀÌØí¥¥ÈôQ¥µÉ¥ ÀÌØí¥Q¥µÈ¤¼ÄÀÀÀ)]¹)5Í   ½à ØÐ°Ìäí%¹¼Ìäì°Ìäí]¡¥±±½½À½Õ¹ÑÌôÌäìµÀìÀÌØí¥
½Õ¹ÐȵÀì
HµÀì|($Ìäí¼±½½À½Õ¹ÑÌôÌäìµÀìÀÌØí¥
½Õ¹ÐÄ

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.

  • Moderators
Posted

@Xenogis, I think Adlib* actually pauses the rest of the functions to perform it's function... I might be wrong, but that seems to be the case when I use it. So I would think that would actually be slower.

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.

Posted

Dang, it does pause the script. I thought it didn't.

The adlib function should be kept simple as it is executed often and during this time the main script is paused

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

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
×
×
  • Create New...