Jump to content

how to get script waiting?


Recommended Posts

hi...i got a little problem...don´t know how i can fix it

i got a aimbot on a window and one on another window all in one browser...and when it finds a color, it should wait until the color is away or changes...here my test:

HotKeySet("y", "MyExit")
Sleep(10000)

Func schatz()
$Coord0 = PixelSearch(690,555,766,620, 0xFFFF00)
    if Not @error Then
        Sleep(100)
        Mouseclick("left", $Coord0[0]+3, $Coord0[1]+5,1)
                Sleep(500)
            EndIf
EndFunc         
    
Func glitz()
$coord1 = PixelSearch(200,100,770,500, 0xFFD050)
    if Not @error Then
        Sleep(100)
        Mouseclick("left", $Coord1[0] , $Coord1[1],1)
                Sleep(1000)
EndFunc

;Func wait()
;   While 1
;   if not PixelGetColor($Coord0[0] , $Coord0[1]) = 0xFFFF00 Then ExitLoop
;           Sleep(100)
;   Wend        
;EndFunc
        
Func MyExit()

    Exit
EndFunc

While 1 
    schatz()
    glitz()
;wait()
WEnd

would be nice if the function glitz just starts, when func schatz found something, is it makeable?

thx in advance

Edited by MAJORSAM
Link to comment
Share on other sites

Do you mean like this?

Func wait()
    While Not PixelGetColor($Coord0[0] , $Coord0[1]) = 0xFFFF00 Then ExitLoop
        Sleep(100)
    Wend        
EndFunc
i tried that:

WARNING: $Coord0: possibly used before declaration.

While Not PixelGetColor($Coord0[0]

Link to comment
Share on other sites

This should do it:

Dim $Coord0, $coord1

HotKeySet("y", "MyExit")
; Sleep(10000);~ You don't need this

While 1
    schatz()
    glitz()
;wait()
WEnd

Func schatz()
    $Coord0 = PixelSearch(690, 555, 766, 620, 0xFFFF00)
    If Not @error Then
        Sleep(100)
        MouseClick("left", $Coord0[0] + 3, $Coord0[1] + 5, 1)
        Sleep(500)
    EndIf
EndFunc ;==>schatz

Func glitz()
    $coord1 = PixelSearch(200, 100, 770, 500, 0xFFD050)
    If Not @error Then
        Sleep(100)
        MouseClick("left", $coord1[0], $coord1[1], 1)
        Sleep(1000)
    EndIf
EndFunc ;==>glitz

Func wait()
    While Not PixelGetColor($Coord0[0], $Coord0[1]) = 0xFFFF00 Then ExitLoop
        Sleep(100)
    WEnd
EndFunc ;==>wait

Func MyExit()
    Exit
EndFunc ;==>MyExit

Wrong tag.

Edited by JamesBrooks
Link to comment
Share on other sites

This:

Dim $Coord0, $coord1

HotKeySet("y", "MyExit")
; Sleep(10000);~ You don't need this

While 1
    schatz()
    glitz()
;wait()
WEnd

Func schatz()
    $Coord0 = PixelSearch(690, 555, 766, 620, 0xFFFF00)
    If Not @error Then
        Sleep(100)
        MouseClick("left", $Coord0[0] + 3, $Coord0[1] + 5, 1)
        Sleep(500)
    EndIf
EndFunc  ;==>schatz

Func glitz()
    $coord1 = PixelSearch(200, 100, 770, 500, 0xFFD050)
    If Not @error Then
        Sleep(100)
        MouseClick("left", $coord1[0], $coord1[1], 1)
        Sleep(1000)
    EndIf
EndFunc  ;==>glitz

Func wait()
    While Not PixelGetColor($Coord0[0], $Coord0[1]) = 0xFFFF00
        ExitLoop
    WEnd
EndFunc  ;==>wait

Func MyExit()
    Exit
EndFunc  ;==>MyExit
Link to comment
Share on other sites

  • Developers

Missed that too. AutoIt doesn't understand HEX values by nature. This could work:

While Not PixelGetColor($Coord0[0], $Coord0[1]) = "FFFF00" Then
HUH? Doesn't understand Hex?

There is a THEN in that line that probably is causing the error.

Also the test looks wrong and think it should be While Not (PixelGetColor($Coord0[0], $Coord0[1]) = 0xFFFF00)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

same error :)

Do you run au3check to allow you to figure basic syntax errors out yourself because this error looks pretty obvious to me?

While Not PixelGetColor($Coord0[0], $Coord0[1]) = "FFFF00" Then
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

HUH? Doesn't understand Hex?

There is a THEN in that line that probably is causing the error.

Also the test looks wrong and think it should be While Not (PixelGetColor($Coord0[0], $Coord0[1]) = 0xFFFF00)

Jos

Well yeah, you can't say to it, "If $var = 0x000000" as far as I am aware. And I missed the Then again, for some reason, I added that back to it :S
Link to comment
Share on other sites

  • Developers

Well yeah, you can't say to it, "If $var = 0x000000" as far as I am aware. And I missed the Then again, for some reason, I added that back to it :S

Not true, but the Func returns a decimal value.

Run this script and fill in the shown hex code in the If statement. Then runn it again and you see the MsBox popping up:

$x = PixelGetColor(1, 1)
ConsoleWrite('$x = ' & $x & '  Hex: ' & Hex($x) & @crlf);### Debug Console
If PixelGetColor(1, 1) = 0x00035EE9 Then
    MsgBox(0,"Yea", "It does work")
EndIf

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

i don´t understand :) what 2 do now?

I think I asked you a simple question and when you are here just to have others do the work then you better go somewhere else.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I think I asked you a simple question and when you are here just to have others do the work then you better go somewhere else.

Jos

sry, but my english is not that good!

if i start au3check. exe i get a short black window...so short that i can´t see anything in it, thats all! and i try always before i post here, but if i have no suggestion, i post here in hope of getting help!

Link to comment
Share on other sites

  • Developers

sry, but my english is not that good!

if i start au3check. exe i get a short black window...so short that i can´t see anything in it, thats all! and i try always before i post here, but if i have no suggestion, i post here in hope of getting help!

Load the full Scite4autoit3 installer which will always run au3check before running your script with autoit3 when pressing F5.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

thats the place where i always copied the errors...or i did s.th wrong! here´s the copy:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Major\Desktop\SF-Scripts\SF\schatzglitz.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>20:24:44 Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0407 Keyboard:00000407 OS:WIN_VISTA/ CPU:X64 OS:X86)

>Running AU3Check (1.54.10.0) from:C:\Program Files\AutoIt3

C:\Users\Major\Desktop\SF-Scripts\SF\schatzglitz.au3(37,65) : ERROR: syntax error

While Not PixelGetColor($Coord0[0], $Coord0[1]) = "FFFF00" Then

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Major\Desktop\SF-Scripts\SF\schatzglitz.au3 - 1 error(s), 0 warning(s)

!>20:24:44 AU3Check ended.rc:2

+>20:24:48 AutoIt3Wrapper Finished

>Exit code: 0 Time: 3.770

Link to comment
Share on other sites

  • Developers

thats the place where i always copied the errors...or i did s.th wrong! here´s the copy:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Major\Desktop\SF-Scripts\SF\schatzglitz.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>20:24:44 Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0407 Keyboard:00000407 OS:WIN_VISTA/ CPU:X64 OS:X86)

>Running AU3Check (1.54.10.0) from:C:\Program Files\AutoIt3

C:\Users\Major\Desktop\SF-Scripts\SF\schatzglitz.au3(37,65) : ERROR: syntax error

While Not PixelGetColor($Coord0[0], $Coord0[1]) = "FFFF00" Then

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Major\Desktop\SF-Scripts\SF\schatzglitz.au3 - 1 error(s), 0 warning(s)

!>20:24:44 AU3Check ended.rc:2

+>20:24:48 AutoIt3Wrapper Finished

>Exit code: 0 Time: 3.770

Seriously: What is your question that isn't answered yet?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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