Jump to content

Do..Until how do i put it in in this script?


 Share

Recommended Posts

Dim $stop = 0
HotKeySet("{F4}", "toggel")
HotKeySet("{F5}", "off")

$password=Iniread(@ScriptDir&"\settings.ini","Settings","Password","Notfound")
$delay=IniRead(@ScriptDir&"\settings.ini","Settings","Delay",5000)

While 1
    If $stop = 1 Then
    If PixelGetColor(167, 86) = 0xFFF052 Then  ; Press B to enter bnet
    Send ("B")
    Sleep (5000)
EndIf
    If PixelGetColor(260, 361) = 0x111111 Then ; Type password to enter game
    Send ($password) ;Password
    Send ("{ENTER}")
    Sleep (10000)
EndIf
    If PixelGetColor(209, 629) = 0xDD9C03 Then ; See if its ingame!
    Sleep ($delay)
    Send ("!Q")
EndIf
    If PixelGetColor(671, 295) = 0x111111 Then Send ("{ENTER}") ; If wrong password screen come up it press enter
    If PixelGetColor(28, 157) = 0x5C594D Then Send ("!Q") ; Sends search game if it is in ..channel
    If PixelGetColor(346, 393) = 0xEAB2ED Then Send ("Q"); Makes it leave if it get quitscreen
    If PixelGetColor(482, 238) = 0x161605 Then Send ("!Q"); Makes it leave if it get defeat screen!
    If PixelGetColor(1009, 67) = 0x182018 Then Send ("{ENTER}"); Makes it press enter if it get scorescreen
    If PixelGetColor(346, 317) = 0x85744A Then Send ("!Q"); Makes it leave if it get victory screen!
EndIf
WEnd

Func toggel()
    If $stop = 0 Then
        $stop = 1
    Else
        $stop = 0
    EndIf
EndFunc

Func off()
    Exit
EndFunc

How do i put in this:

In the script above?

Do
    $color = PixelGetColor(1, 1) ;Waits for (1, 1) to be 0xFF0000
Until $color = OxFF0000
Sleep(300000) ;Sleeps for 300000ms when $color = 0xFF0000
If PixelGetColor(1, 1) = 0xFF0000 Then Send ("X") ;After the sleep it checks to see if (1, 1) is 0xFF0000. If it is it sends X and if it isn't the script closes.
Exit
Edited by Xoriaz
Link to comment
Share on other sites

Difficult to guess without knowing what you want it to do and an what point in your script.

Probavbly after your inireads and before your while loop

Also, I dont think you need the EndIf with having the Then on the same line as your If

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

... Also, I dont think you need the EndIf with having the Then on the same line as your If

The OP did not "Tidy" up before posting. That EndIf is paired with the If $stop... line.

Dim $stop = 0
HotKeySet("{F4}", "toggel")
HotKeySet("{F5}", "off")

$password = IniRead(@ScriptDir & "\settings.ini", "Settings", "Password", "Notfound")
$delay = IniRead(@ScriptDir & "\settings.ini", "Settings", "Delay", 5000)

While 1
    If $stop = 1 Then
    If PixelGetColor(167, 86) = 0xFFF052 Then ; Press B to enter bnet
    Send("B")
    Sleep(5000)
    EndIf
    If PixelGetColor(260, 361) = 0x111111 Then ; Type password to enter game
    Send($password) ;Password
    Send("{ENTER}")
    Sleep(10000)
    EndIf
    If PixelGetColor(209, 629) = 0xDD9C03 Then ; See if its ingame!
    Sleep($delay)
    Send("!Q")
    EndIf
    If PixelGetColor(671, 295) = 0x111111 Then Send("{ENTER}") ; If wrong password screen come up it press enter
    If PixelGetColor(28, 157) = 0x5C594D Then Send("!Q") ; Sends search game if it is in ..channel
    If PixelGetColor(346, 393) = 0xEAB2ED Then Send("Q"); Makes it leave if it get quitscreen
    If PixelGetColor(482, 238) = 0x161605 Then Send("!Q"); Makes it leave if it get defeat screen!
    If PixelGetColor(1009, 67) = 0x182018 Then Send("{ENTER}"); Makes it press enter if it get scorescreen
    If PixelGetColor(346, 317) = 0x85744A Then Send("!Q"); Makes it leave if it get victory screen!
    EndIf
WEnd

Func toggel()
    If $stop = 0 Then
    $stop = 1
    Else
    $stop = 0
    EndIf
EndFunc ;==>toggel

Func off()
    Exit
EndFunc ;==>off
"toggel" :-) Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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