Sign in to follow this  
Followers 0
MAJORSAM

how to get script waiting?

31 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


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

Share this post


Link to post
Share on other sites

still error:

(33,64) : ERROR: syntax error

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

Share this post


Link to post
Share on other sites

still error:

(33,64) : ERROR: syntax error

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

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

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

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


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

Share this post


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

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0