MMOMinion

Full Version: Help with AHK Triad script?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well I just found out that unless you subscribe to a product on this site, that you cant post anywhere but here. So I'm going to ask my question here and see who can help me.

I've been tinkering with a script for Indolent Imperial for a while now. I found it over a week ago on this site and its the entire reason why I am here in the first place. That and to see if this mmo bot becomes worth getting. But, that aside, I could use a bit of a hand.

Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
WinGet, programid, List, FINAL FANTASY

CoordMode, ToolTip, Screen

;
;
;        Please read!
;        When you modify the script for you setup, be sure
;        to leave the "RGB" at the end of the PixelGetColor
;        as well as the "0x" before the RGB values
;        AHK uses BGR by default, but the Window Spy gives RGB values, so I made it easier to use
;
;        I used and modified brooklynbase's script, so huge thanks to him
;        Feedback would be appreciated @ http://www.mmominion.com/Thread-Gold-Saucer (script's posted on page 13)
;
;        Deck is: Alphinaud, Urianger, Thancred, Y'shtola, Papalymo
;
;        -ratdo
;


; Win Z to Start
#Z::

; Create Window Tool Tip to show # of Games
        sleep 2000
    ControlSend,,{Numpad0}, ahk_id %programid1%
        Sleep 2000
    ControlSend,,{Numpad0}, ahk_id %programid1%
        Sleep 2000
    ControlSend,,{Numpad0}, ahk_id %programid1%
        Sleep 2000
    ControlSend,,{Numpad0}, ahk_id %programid1%
        Sleep 2500
    ControlSend,,{Numpad0}, ahk_id %programid1%
        Sleep 2000
    ControlSend,,{Numpad0}, ahk_id %programid1%
        Sleep 2000
    ControlSend,,{Numpad0}, ahk_id %programid1%
      
Loop
{
Sleep 10500

; Game started, Alphinaud    

    {
    Sleep 2500
    PixelGetColor, color, 799, 508, RGB ; Put a color with respective coords from empty bottom right
    if color = 0xC8C9B5
        {
        Click, 165, 372 ; Pick up Alphinaud
        Sleep 12
        Click, 165, 372 ; Pick up Alphinaud
        Sleep 1
        Click, 799, 508 ; Drop Alphinaud bottom right
        }
    else
        {
        PixelGetColor, color, 657, 488, RGB ; Put a color with respective coords from empty middle bottom
        if color = 0xCECCC0
            {
            Click, 165, 372 ; Pick up Alphinaud
            Sleep 12
            Click, 165, 372 ; Pick up Alphinaud
            Sleep 3
            Click, 657, 488 ; Drop Alphinaud middle bottom
            }
        else
            {
            Click, 165, 372 ; Pick up Alphinaud
            Sleep 12
            Click, 165, 372 ; Pick up Alphinaud
            Sleep 1
            Click, 844, 658 ; Drop Alphinaud bottom left
            }
        }
    }
    
Sleep 5500 ; Imperial turn

; Our turn, Urianger

    {
    Sleep 3500
    PixelGetColor, color, 655, 357, RGB ; Put a color with respective coords from empty middle
    if color = 0x878785
        {
        Click, 280, 363 ; Pick up Urianger
        Sleep 12
        Click, 280, 363 ; Pick up Urianger
        Sleep 1
        Click, 655, 357 ; Drop Urianger middle
        }
    else
        {
        PixelGetColor, color, 795, 359, RGB ; Put a color with respective coords from empty middle right
        if color = 0xCECCC0
            {
            Click, 280, 363 ; Pick up Urianger
            Sleep 12
            Click, 280, 363 ; Pick up Urianger
            Sleep 1
            Click, 795, 359 ; Drop Urianger middle right
            }
        else
            {
            Click, 280, 363 ; Pick up Urianger
            Sleep 12
            Click, 280, 363 ; Pick up Urianger
            Sleep 1
            Click, 657, 488 ; Drop Urianger middle bottom
            }
        }
    }
    
Sleep 8000 ; Imperial turn

; Our turn, Thancred

    {
    Sleep 2500
    PixelGetColor, color, 798, 224, RGB ; Put a color with respective coords from empty top right
    if color = 0xC0C0B7
        {
        Click, 382, 373 ; Pick up Thancred
        Sleep 12
        Click, 382, 373 ; Pick up Thancred
        Sleep 1
        Click, 798, 224 ; Drop Thancred top right
        }
    else
        {
        PixelGetColor, color, 663, 221, RGB ; Put a color with respective coords from empty top middle
        if color = 0xC3BBB0
            {
            Click, 382, 373 ; Pick up Thancred
            Sleep 12
            Click, 382, 373 ; Pick up Thancred
            Sleep 1
            Click, 663, 221 ; Drop Thancred top middle        
            }
        else
            {
            Click, 382, 373 ; Pick up Thancred
            Sleep 12
            Click, 382, 373 ; Pick up Thancred
            Sleep 1
            Click, 524, 223 ; Drop Thancred top left
            }
        }
    }
    
Sleep 5500 ; Imperial turn

; Our turn, Yshtola
    
    {
    Sleep 2500
    PixelGetColor, color, 657, 488, RGB ; Put a color with respective coords from empty middle bottom
    if color = CECCC0
        {
        Click, 219, 496 ; Pick up Yshtola
        Sleep 12
        Click, 219, 496 ; Pick up Yshtola
        Sleep 1
        Click, 657, 488 ; Drop Yshtola middle bottom
        }
    else
        {
        PixelGetColor, color, 515, 489, RGB ; Put a color with respective coords from empty bottom left
        if color = 0xB9B2A7
            {
            Click, 219, 496 ; Pick up Yshtola
            Sleep 12
            Click, 219, 496 ; Pick up Yshtola
            Sleep 1
            Click, 515, 489 ; Drop Yshtola bottom left
            }
        else
            {
            PixelGetColor, color, 523, 359, RGB ; Put a color with respective coords from empty middle left
            if color = 0xD4A983
                {
                Click, 219, 496 ; Pick up Yshtola
                Sleep 12
                Click, 219, 496 ; Pick up Yshtola
                Sleep 1
                Click, 523, 359 ; Drop Yshtola middle left        
                }
            else
                {
                Click, 219, 496 ; Pick up Yshtola
                Sleep 12
                Click, 219, 496 ; Pick up Yshtola
                Sleep 1
                Click, 524, 223 ; Drop Yshtola top left
                }
            }
        }
    }
    
Sleep 8500 ; Imperial turn

; If Imperial played first, we won't be playing Papalymo, we will set up next game
; Else we will play our last Papalymo card
; Here I used the timer bar in our side to know if we have to play or not, the color & coords are from around 30% of the

bar (If it's yellow/green, then we can play, so we play. If not, we don't play)

    PixelGetColor, color, 641, 619, RGB
    if color = 0x3A5A7A
        {
        PixelGetColor, color, 515, 489, RGB ; Put a color with respective coords from empty bottom left
        if color = 0xB9B2A7
            {
            Click, 325, 503 ; Pick up Papalymo
            Sleep 12
            Click, 325, 503 ; Pick up Papalymo
            Sleep 1
            Click, 844, 659 ; Drop Papalymo bottom left
            Sleep 6000
            }
        else
            {
            PixelGetColor, color, 845, 521, RGB ; Put a color with respective coords from empty middle left
            if color = 0xD4A983
                {
                Click, 325, 503 ; Pick up Papalymo
                Sleep 12
                Click, 325, 503 ; Pick up Papalymo
                Sleep 1
                Click, 845, 521 ; Drop Papalymo middle left
                Sleep 6000        
                }
            else
                {
                PixelGetColor, color, 663, 221, RGB ; Put a color with respective coords from empty top middle
                if color = 0xC3BBB0
                    {
                    Click, 325, 503 ; Pick up Papalymo
                    Sleep 12
                    Click, 325, 503 ; Pick up Papalymo
                    Sleep 1
                    Click, 663, 221 ; Drop Papalymo top middle
                    Sleep 6000        
                    }
                else
                    {
                    PixelGetColor, color, 795, 359, RGB ; Put a color with respective coords from empty middle right
                    if color = 0xCECCC0
                        {
                        Click, 325, 503 ; Pick up Papalymo
                        Sleep 12
                        Click, 325, 503 ; Pick up Papalymo
                        Sleep 1
                        Click, 795, 359 ; Drop Papalymo middle right
                        Sleep 6000
                        }
                    else
                        {    
                        Click, 325, 503 ; Pick up Papalymo
                        Sleep 12
                        Click, 325, 503 ; Pick up Papalymo
                        Sleep 1
                        Click, 524, 223 ; Drop Papalymo top left
                        Sleep 6000
                        }
                    }
                }
            }
        }
    else
        {
        Sleep 1
        }
    PixelGetColor, color, 638, 484, RGB ; Rematch check
    if color = 0x8B8B8B
        {
        Click, 638, 484 ; Rematch button
        Sleep 3
        Click, 638, 484 ; Rematch button
        Sleep 1
        Click, 638, 484 ; Rematch button
        }
    else
        {
        Sleep 1000
        Click, 638, 484 ; Rematch button
        Sleep 3
        Click, 638, 484 ; Rematch button
        Sleep 1
        Click, 638, 484 ; Rematch button
        }
    Sleep 2500
    PixelGetColor, color, 628, 541, RGB ; Match info check
    if color = 0x0E0E0E
        {
        Click, 628, 541 ; Confirm button
        Sleep 1
        Click, 628, 541 ; Confirm button
        Sleep 1
        Click, 628, 541 ; Confirm button
        }
    else
        {
        Sleep 1000
        Click, 628, 541 ; Confirm button
        Sleep 1
        Click, 628, 541 ; Confirm button
        Sleep 1
        Click, 628, 541 ; Confirm button
        }
    Sleep 2500
    PixelGetColor, color, 690, 222, RGB ; Deck screen check
    if color = 0xF4E2E6
        {
        Click, 690, 222 ; First deck selected
        Sleep 1
        Click, 690, 222 ; First deck selected
        Sleep 1
        Click, 690, 222 ; First deck selected
        }
    else
        {
        Sleep 1000
        Click, 690, 222 ; First deck selected
        Sleep 1
        Click, 690, 222 ; First deck selected
        Sleep 1
        Click, 690, 222 ; First deck selected
        }
}

That is my script. Im running into a problem where, right out of the gate, it goes to the Else on Alp. Ive tinkered with the timers a bit but Im just not seeing whats wrong.

Aside from that, at the bottom there is a bit of script over Pal's section. The whole coords/rbg thing. And I have NO idea what goes there. The rest really seems to just be timing stuff I have been tinkering with. Im pretty sure I have all the coords right with the exception of what's floating just over the Papalymo section (Seriously, didnt wanna touch that and break everything lol.)

So, hopefully some wizard here has the magic answer lol. And HOPEFULLY I used the right insertion method for putting that script into place O.O

If not.... I PLEAD THE FIFTH!

EDIT: Oh, it also doesnt show the little black window with the number of games and whatnot played for some reason? o.O I saw that in someone's screenshot.
Just realized this script is terrible when it comes to strategy lol. I manually played out each of the recommended matches and it draws more than it wins. Interestingly enough, some hiccup in the script is now causing Y'shtola to be played in bottom left as her else command suggests instead of bottom mid, which (IF Papalymo plays AT ALL) can occasionally result in a win.

I really need some input on this from someone. I think I can rig most of my win strategies for a minfilla deck if I learn how all this works. The main thing would be reading empty spots and it prompting the script NOT to go in a certain place unless that spot was filled. I can mindlessly grind with my minfillia deck for a 100% win rate (No draws) unless I miss glance at the screen while watching TV. So if I can completely automate that, it would be perfect!