Jump to content

Script will not work like it should


heyhey
 Share

Recommended Posts

Hello, this is my script :

$color = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
$b8 = PixelGetColor(1087,820)
$white = 15791353
$ch = 16711680
$ch2 = 16646144
While True
    if $b8 = $white Then
        Sleep(500)
        if $color = $ch or $ch2 Then  
            MouseClick("left")
            Send("{LALT}")
            Sleep(30)
            Send("{O}")
            Sleep(270)
        EndIf
    Else
        Sleep(500)
        if $color = $ch2 Then
            Sleep(500)
            If $color = $ch or $ch2 Then
                Mouseclick("left")
                Send("{LALT}")
                Sleep(30)
                Send("{P}")
                Sleep(590)
            EndIf
        EndIf
    EndIf
WEnd

What I want it to do = when $b8 is white, I want it to check $color also, and if $color matches $ch or $ch2 , I want it to do the actions, but if $b8 is not white , I wan it to check $color again, if it matches $ch or $ch2 , I want it to do the actions (they DO differ, send P = not Send O , and Sleep times differ! )

For some reason, when I start this script, It just does the mouseclick left, send lalt, sleep 30 send O sleep 270 without the required pixels turning the color I gave it !

It would be great if any of you can help me, I'm still learning AutoIT and most of you are really helpfull and friendly, I want to thank all of you for the help you already gave and the help I will recieve on further problems, one day I will be able to help people myself :).

Edited by heyhey
Link to comment
Share on other sites

I don't know exacly what you want, but try this:

$white = 16777215 ; 15791353
$ch = 16711680
$ch2 = 16646144

While 1
    $color = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2) ; Yes, this could be out of the loop, but I kept it in here in case the resolution changes.
    $b8 = PixelGetColor(1087,820)
    
    If $b8 = $white Then
        Sleep(500)
        if $color = $ch or $ch2 Then  
            MouseClick("left")
            Send("{LALT}")
            Sleep(30)
            Send("{O}")
            Sleep(270)
            ExitLoop
        EndIf
    ElseIf $color = $ch Or $color = $ch2 Then
        Sleep(500)
        If $color = $ch or $ch2 Then
            Mouseclick("left")
            Send("{LALT}")
            Sleep(30)
            Send("{P}")
            Sleep(590)
            ExitLoop
        EndIf
    EndIf
    
    Sleep(100)
WEnd

Exit

Note!! The colour's you use are not the real colour codes. For example: 15791353 is NOT white. My script above got the right white code. I don't know what other colour's you'd like to use, so I can't correct them if needed.

I also added an ExitLoop statement so that the script will exit when the colour is detected and the menubuttons are pushed. Get rid of that line if you want the script to loop or do another action.

Edit: Mod's sorry if I disturbed the force... according to:

Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Link to comment
Share on other sites

I don't know exacly what you want, but try this:

$white = 16777215 ; 15791353
$ch = 16711680
$ch2 = 16646144

While 1
    $color = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2) ; Yes, this could be out of the loop, but I kept it in here in case the resolution changes.
    $b8 = PixelGetColor(1087,820)
    
    If $b8 = $white Then
        Sleep(500)
        if $color = $ch or $ch2 Then  
            MouseClick("left")
            Send("{LALT}")
            Sleep(30)
            Send("{O}")
            Sleep(270)
            ExitLoop
        EndIf
    ElseIf $color = $ch Or $color = $ch2 Then
        Sleep(500)
        If $color = $ch or $ch2 Then
            Mouseclick("left")
            Send("{LALT}")
            Sleep(30)
            Send("{P}")
            Sleep(590)
            ExitLoop
        EndIf
    EndIf
    
    Sleep(100)
WEnd

Exit

Note!! The colour's you use are not the real colour codes. For example: 15791353 is NOT white. My script above got the right white code. I don't know what other colour's you'd like to use, so I can't correct them if needed.

I also added an ExitLoop statement so that the script will exit when the colour is detected and the menubuttons are pushed. Get rid of that line if you want the script to loop or do another action.

Edit: Mod's sorry if I disturbed the force... according to:

I do not use the bot in-game, I have to confess I wish I could, but the game is protected (gameguard)

I am attempting to make the script though

Just saying this : $ch and $ch2 are 2 different types of red

still, it wont tell do the script if it see's b8=white and $color = $ch, (I'm testing using ingame screenshots (to point it out, yes I'm doing this on fullscreen)

I DO NOT OR CAN NOT USE THIS IN ANY GAME.

Thank you for helping, but still wondering why it doesnt work :)

Link to comment
Share on other sites

  • Developers

I do not use the bot in-game, I have to confess I wish I could, but the game is protected (gameguard)

I am attempting to make the script though

Just saying this : $ch and $ch2 are 2 different types of red

still, it wont tell do the script if it see's b8=white and $color = $ch, (I'm testing using ingame screenshots (to point it out, yes I'm doing this on fullscreen)

I DO NOT OR CAN NOT USE THIS IN ANY GAME.

Thank you for helping, but still wondering why it doesnt work :)

Go play 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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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