Sign in to follow this  
Followers 0
DarkKai

Speed and Time

14 posts in this topic

hi, i was wondering if this could be sped up anymore? it dont send the keys fast enuff

like, if it sends 1 key and then like not even 1/3rd of a sec later it has to send another it dont..

Local $Coords7
Local $Coords5
Local $Coords3
Local $Coords4
Local $Coords6
Local $Coords1
Local $Coords2
HotKeySet("{Esc}", "MyExit")
While 1
sleep(1)    
$Coords7 = PixelSearch( 166, 472, 188, 478, 15725559)
    If @Error Then  
    Else 
     Send("{l}")
endif
$Coords5 = PixelSearch( 115, 472, 136, 478, 15725559)
    If @Error Then  
    Else 
  Send("{j}")
endif
$Coords3 = PixelSearch( 56, 472, 80, 478, 15725559)

    If @Error Then  
    Else      
     Send("{f}")
endif
   $Coords4 = PixelSearch( 84, 472, 112, 478, 16763730)
    If @Error Then  
    Else      
     Send("{space}")
endif
    $Coords1 = PixelSearch( 33, 472, 53, 480, 4380671)
    If @Error Then  
    Else      
     Send("{d}")
    EndIf
    $Coords2 = PixelSearch( 7, 472, 26, 478, 15725559, 3)
    If @Error Then  
    Else     
     Send("{s}")
endif
$Coords6 = PixelSearch( 144, 472, 161, 478, 4380671)
    If @Error Then  
    Else 
  Send("{k}")
endif
WEnd
Func MyExit()
    Exit 
EndFunc

um..its my first one so...be kind :o

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

change them to this

$Coords7 = PixelSearch( 166, 472, 188, 478, 15725559)
    If Not @Error Then Send("{l}"

8)

BTW

Welcome to Autoit

you should have a look at this

http://www.autoitscript.com/forum/index.php?showtopic=21048#

i think PixelSearch is to slow for what i need to do... :o umm is there a way to make it press a key when the color of 1 pixel has changed? sounds like PixelSearch...lol if not is there another way to speed it up?

btw thx for that tip, it was alot faster but still not fasteuff.... still misses some keys

Edited by DarkKai

Share this post


Link to post
Share on other sites

here is a script to help find a color, and if the color changes it will notify you

http://www.autoitscript.com/forum/index.php?showtopic=16789#

8)

the thing is i know the colors in advanced, i was wondering if there was a cmd for it to hit a key if the color changed...fast... i have 7 spots it has to look at...but only 3 colors... say if the pixel is black and it changed to anything other than black it would hit a key

Share this post


Link to post
Share on other sites

it was in there

While $check

$var2 = PixelGetColor( $pos[0] , $pos[1])

If $my_color <> $var2 Then

MsgBox(262208, "Color Check", " the Color has changed ")

ExitLoop

EndIf

WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

it was in there

While $check

$var2 = PixelGetColor( $pos[0] , $pos[1])

If $my_color <> $var2 Then

MsgBox(262208, "Color Check", " the Color has changed ")

ExitLoop

EndIf

WEnd

8)

i dont get alot of that lol

HotKeySet("{Esc}", "MyExit")
While 1
Sleep(1)
$Coords7 = PixelSearch( 166, 460, 188, 471, 15725559)
    If not @Error Then Send("{l}")

$Coords5 = PixelSearch( 115, 460, 136, 471, 15725559)
    If not @Error Then Send("{j}")

$Coords3 = PixelSearch( 56, 460, 80, 471, 15725559)
    If not @Error Then Send("{f}")

   $Coords4 = PixelSearch( 84, 460, 112, 471, 16763730)
    If not @Error Then Send("{space}")

    $Coords1 = PixelSearch( 33, 460, 53, 471, 4380671)
    If not @Error Then Send("{d}")

    $Coords2 = PixelSearch( 7, 460, 26, 471, 15725559, 3)
    If not @Error Then Send("{s}")

$Coords6 = PixelSearch( 144, 460, 161, 471, 4380671)
    If not @Error Then Send("{k}")

WEnd
Func MyExit()
    Exit 
EndFunc

thats what i have now... like i said its faster but still too slow for what i need...

if u can explain

While $check
        $var2 = PixelGetColor(  $pos[0] , $pos[1])
        If $my_color <> $var2 Then
            MsgBox(262208, "Color Check", " the Color has changed   ")
            ExitLoop
        EndIf
    WEnd

a little bit more :o

it hits alot of the keys but if it has to hit like the first 1 on my script and my last 1 on there it will miss...or if it has to hit the first then 2nd then first again it will miss....

Edited by DarkKai

Share this post


Link to post
Share on other sites

What might help is to undestand your goals. What is your program actually trying to do? What is the pseudocode? Without such input we can provide ideas limited by our (possibly mis-)interpretation of where you are going.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

What might help is to undestand your goals. What is your program actually trying to do? What is the pseudocode? Without such input we can provide ideas limited by our (possibly mis-)interpretation of where you are going.

I'll agree with this, between Val and him, this has gone onto a different area, and I'm confused on what the specific options your looking for are. To speed up a search, you could use the step that I'll show in my example, it will be twice as fast on the scan. I would also suggest to use the Hex '0x' numbers rather than the decimals. I also aligned them (maybe you wanted them in a specific order so you could change them) to search in order from least to greatest.

Opt('PixelCoordMode', 0); check to make sure you don't need to change the 0 to 1 or 2 in the help file
Opt('SendKeyDelay', 0)
HotKeySet("{Esc}", "MyExit")
While 1
    Sleep(10)   
    If PixelSearch(7, 472, 26, 478, 15725559, 3, 2) <> 1 Then Send("{s}")
    If PixelSearch(33, 472, 53, 480, 4380671, 0, 2) <> 1 Then Send("{d}")
    If PixelSearch(56, 472, 80, 478, 15725559, 0, 2) <> 1 Then Send("{f}")
    If PixelSearch(84, 472, 112, 478, 16763730, 0, 2) <> 1 Then Send("{space}")
    If PixelSearch(115, 472, 136, 478, 15725559, 0, 2) <> 1 Then Send("{j}")
    If PixelSearch(144, 472, 161, 478, 4380671, 0, 2) <> 1 Then Send("{k}")
    If PixelSearch(166, 472, 188, 478, 15725559, 0, 2) <> 1 Then Send("{l}")
WEnd
Func MyExit()
    Exit
EndFunc

Edit:

Or you could do it like this:

Opt('PixelCoordMode', 0); check to make sure you don't need to change the 0 to 1 or 2 in the help file
Opt('SendKeyDelay', 0)
HotKeySet("{Esc}", "MyExit")
While 1
    Sleep(10)   
    If IsArray(PixelSearch(906, 563, 906, 563, 0xFFFFFF, 3, 2)) Then Send("{s}")
    If IsArray(PixelSearch(33, 472, 53, 480, 4380671, 0, 2)) Then Send("{d}")
    If IsArray(PixelSearch(56, 472, 80, 478, 15725559, 0, 2)) Then Send("{f}")
    If IsArray(PixelSearch(84, 472, 112, 478, 16763730, 0, 2)) Then Send("{space}")
    If IsArray(PixelSearch(115, 472, 136, 478, 15725559, 0, 2)) Then Send("{j}")
    If IsArray(PixelSearch(144, 472, 161, 478, 4380671, 0, 2)) Then Send("{k}")
    If IsArray(PixelSearch(166, 472, 188, 478, 15725559, 0, 2)) Then Send("{l}")
WEnd
Func MyExit()
    Exit
EndFunc
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

What might help is to undestand your goals. What is your program actually trying to do? What is the pseudocode? Without such input we can provide ideas limited by our (possibly mis-)interpretation of where you are going.

my program is tryin to hit a key when it finds a color in the area i say, its all random and it happens fast

like, area | | and if said area turns to black than hit a key, 7 areas, and if 2 of thos areas change at once or fast in succession than it hits the key too late

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

press a key when the color of 1 pixel has changed?

maybe you could change the above code to

If PixelGetColor(7, 472) <> $yourColor Then Send("{s}")

that was the direction SmOke

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

maybe you could change the above code to

If PixelGetColor(7, 472) <> $yourColor Then Send("{s}")

that was the direction SmOke

8)

Well, it sounds like the direction I would take Val, but.. he seems to want to check an area, and if it is <> then the color he wanted then, the code given would be wrong (that I gave). Would have to put Not in front of the PixelSearch() on the first example, and Not in front of IsArray on the 2nd example.

[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

maybe you could change the above code to

If PixelGetColor(7, 472) <> $yourColor Then Send("{s}")

that was the direction SmOke

8)

well the color of the spot i need it to check switches colors... every few sec, 0xde3431 and 0xb52429 can i make it check for thos 2 at that spot and then hit if not thos 2?

Share this post


Link to post
Share on other sites

like

If PixelGetColor(7, 472) <> $yourColor Or PixelGetColor(7, 472) <> $your2ndColor Then Send("{s}")

8)


NEWHeader1.png

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