Jump to content

If color... :)


Recommended Posts

Very beginning of everything I did to get to my Do/Until Loop :P and Do/Until also :lmao: this part:

Run("C:\Program Files\Silkroad\Silkroad.exe")
    WinWaitActive("Silkroad Online Launcher"); wait 3 seconds for the window to exist
    Sleep(10000)
    MouseClick("left", 756, 510, 1, 1)
    WinWaitActive("SRO_Client")
    Sleep(15000)
    Send("{ENTER}")
    Sleep (1000)
    Send("user")
    Send("{TAB}")
    Sleep(500)
    Send("pass")
    Send("{ENTER}")
    Sleep(10000)
    Do; will do the pixelgetcolor every 5 seconds until it = 0x674023
        MouseMove(512, 428)
        If PixelGetColor( 512, 428) == 0x9C4A31 Then
            MouseClick("left", 512, 428, 1, 1); added a 1 for 1 click, and 1 for speed
Edited by kazhkaz
Link to comment
Share on other sites

  • Moderators

Well I'm starting to get my ownself confused... try this:

; how did you get your coords from the autoinfo tool, are they screen coords / window coords / or client coords
; the below OPT's will use window coords as an example the 0 indentifies window in the OPT's I'm using
Opt("MouseCoordMode", 0); read the help to see if you need to change that to a 1 or 2 if it's 1, I suggest your reget your coords with window or client
Opt("PixelCoordMode", 0)
Opt("WinTitleMatchMode", 2); Just in case... let's make sure that if we don't have the whole title, that it finds the window all the same
Dim $EndIt = ''
While 1; starting of an infinite loop
    If Not ProcessExists('Silkroad.exe') Then
        Run("C:\Program Files\Silkroad\Silkroad.exe")
    EndIf
    WinWait("Silkroad Online Launcher") 
    If Not WinActive("SilkRoad Online Launcher") Then
        WinActivate("SilkRoad Online Launcher"); activate if not active once window exists.. this ensures that if the window was blocked by somthing else that it will get activated
    EndIf
    Sleep(10000)
    MouseClick("left", 756, 510, 1, 1)
    WinWaitActive("SRO_Client")
    Sleep(10000)
    Send("{ENTER}")
    Sleep (1000)
    Send("user", 3)
    Send("{TAB}")
    Sleep(500)
    Send("pass")
    Send("{ENTER}")
    Sleep(10000)
    Do; will do the pixelgetcolor every 5 seconds until it = 0x674023
        If PixelGetColor( 512, 428) == 0x9C4A31 Then
            MouseClick("left", 512, 428, 1, 1); added a 1 for 1 click, and 1 for speed
        Else
            Send("{ENTER}")
            ExitLoop
        EndIF
        Sleep(5000)
        If PixelGetColor(279, 207) == 0x674023 Then $EndIt = 1
    Until $EndIt = 1
    If $EndIt = 1 Then ExitLoop
WEnd;going back to the beginning of While 1
MouseClick("left", 332, 372, 1, 1)
MouseClick("left", 861, 704, 1, 1)
Exit

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.

Link to comment
Share on other sites

  • Moderators

Until $EndIt = 1
If $EndIt = 1 Then ExitLoop
Sleep(5000)

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.

Link to comment
Share on other sites

:) smth is wrong :P becose everything is working fine but when it comes to Do/Until it starts the script from beggining :S i dont know why but i removed ExitLoop :lmao: then it didnt start the script when if condition was true :lmao: the problem is i think that ExitLoop must be in another place :( i think u didnt understand were i wanted to start the script from beggiing :) i will to explain u once more :king:

If PixelGetColor( 512, 428) == 0x9C4A31 Then
            MouseClick("left", 512, 428, 1, 1

thats the condition after wich the script has to start from beggining ad if its false then it has to do this till condition is true or PixelGetColor(279, 207) == 0x674023 :

Else
            Send("{ENTER}")

i hope now u will understand :P

Edited by kazhkaz
Link to comment
Share on other sites

  • Moderators

Can you put your script up there, and then use the semicolon ';' to put comments on where you want it to start over and what you'd like to do where?

I made the code as you asked, so it must be a miscommunication. By the way... who is smth?

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.

Link to comment
Share on other sites

Opt("MouseCoordMode", 1)
Opt("PixelCoordMode", 1)
Opt("WinTitleMatchMode", 2)
Dim $EndIt = ''
While 1
    If Not ProcessExists('Silkroad.exe') Then
        Run("C:\Program Files\Silkroad\Silkroad.exe")
    EndIf
    WinWait("Silkroad Online Launcher") 
    If Not WinActive("SilkRoad Online Launcher") Then
        WinActivate("SilkRoad Online Launcher")
    EndIf
    Sleep(10000)
    MouseClick("left", 756, 510, 1, 1)
    WinWaitActive("SRO_Client")
    Sleep(10000)
    Send("{ENTER}")
    Sleep (1000)
    Send("user")
    Send("{TAB}")
    Sleep(500)
    Send("pass")
    Send("{ENTER}")
    Sleep(10000)
    Do
        MouseMove(512, 428)
        If PixelGetColor( 512, 428) == 0x9C4A31 Then
            MouseClick("left", 512, 428, 1, 1); after this script has to begin from the beggining
        
        Else
            Send("{ENTER}"); this must be going till  PixelGetColor( 512, 428) == 0x9C4A31 or PixelGetColor(493, 752) = 0x000000
        ExitLoop
           
        EndIF
        Sleep(5000)
        
        If PixelGetColor(493, 752) = 0x000000 Then $EndIt = 1
        Until $EndIt = 1
        Sleep(1000)
    If $EndIt = 1 Then ExitLoop
        
WEnd
MouseClick("left", 332, 372, 1, 1)
Sleep  (3000)
MouseClick("left", 766, 704, 1, 1); thats the end, it has to stop scirpt after this is done :)
Exit

thats how i want :P

P.S. smth = something if u asked that :)

Edit: i saw one thing :lmao: that it presses Enter 3 times with a pause about 5s (<---- thats all right) but then starts script from beggining :( (<----- thats not it shoul be :))

Edited by kazhkaz
Link to comment
Share on other sites

  • Moderators

Do
        If PixelGetColor( 512, 428) == 0x9C4A31 Then
            MouseClick("left", 512, 428, 1, 1); after this script has to begin from the beggining
            ExitLoop
        Else
            Send("{ENTER}"); this must be going till  PixelGetColor( 512, 428) == 0x9C4A31 or PixelGetColor(493, 752) = 0x000000
        EndIF
        Sleep(5000)
        
        If PixelGetColor(493, 752) == 0x000000 Then $EndIt = 1
        Until $EndIt = 1

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.

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