MMOMinion

Full Version: My choco racing loop AHK
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
You'll have to adjust for your UI and colors/positions and such. I borrowed a few things from around the gold saucer post to help me with this, so thank you for your input users! This has run flawlessly for me.

Semicoloned lines for different things you might want to do depending on your choco rating.
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

; Control S to Start
^S::
looping=true
Loop
{
Queue:
    if looping=false
    break
    tooltip, `nCurrent Race # : %A_Index%`n, 0, 0
; Create Window Tool Tip to show # of Races
           sleep 1200
           ControlSend,,{Numpad0}, ahk_id %programid1%
           Sleep 1200
        ControlSend,,{Numpad0}, ahk_id %programid1%
           Sleep 1200
        ControlSend,,{Numpad0}, ahk_id %programid1%
           Sleep 1200
        ControlSend,,{Numpad0}, ahk_id %programid1%
           Sleep 1200
;    ControlSend,,{Numpad2}, ahk_id %programid1%
;    Sleep 1200
        ControlSend,,{Numpad0}, ahk_id %programid1%
          Sleep 1200
;    ControlSend,,{Numpad2}, ahk_id %programid1%
;    Sleep 1200
;    ControlSend,,{Numpad2}, ahk_id %programid1%
;    Sleep 1200
        ControlSend,,{Numpad0}, ahk_id %programid1%
           Sleep 1200
        ControlSend,,{Numpad4}, ahk_id %programid1%
           Sleep 1000
        ControlSend,,{Numpad0}, ahk_id %programid1%
        loop
    {
        sleep 1000
            PixelGetColor, color, 2931, 971
               if color = 0xd1dbde
        {
                    Sleep 5000
                       ControlSend,,{Numpad0}, ahk_id %programid1%
                   break
            }
               else    
               {
                   Sleep 500
                    continue
        }
    }
; Race Joined Wait to Skip Cutscene
    sleep, 15000
    ControlSend, , {Esc}, ahk_id %programid1%
    sleep, 2000
    ControlSend, , {Numpad0}, ahk_id %programid1%
    sleep, 18000
; Cutscene Skipped
; Wait to see Stamina Bar
    loop
    {
        PixelGetColor, color, 2030, 1124
        if color = 0x67dfff
        {
; Take the left lane if thats the fastest, else add semicolons
            ControlSend,,{a down}, ahk_id %programid1%
            sleep 3000
            ControlSend,,{a up}, ahk_id %programid1%
            break
        }
        else
        {
            continue
        }
    }
; Sprint until 10 percent and break in case stamina stays above 10% at race end
    loop
    {
        PixelGetColor, color, 2030, 1124
        if (color = 0x0b110b or color = 0x000000)
        {
            ControlSend,,{w up}, ahk_id %programid1%
            break
        }
        else
        {
            sleep 2000
            ControlSend,,{w down}, ahk_id %programid1%
            ControlSend,,{1}, ahk_id %programid1%
            continue
        }
    }
; Wait for race results screen to pop
    loop
    {
        PixelGetColor, color, 571, 359
        if (color = 0xd1dbdd or color = 0x000000)
        {
            Sleep 10000
            ControlSend,,{Numpad0}, ahk_id %programid1%
            Sleep 500
            ControlSend,,{Numpad0}, ahk_id %programid1%
            Sleep 10000
            break
        }
        else    
        {
            Sleep 1500
            continue
        }
    }
}

; ALT S to STOP
!s::
looping=false
Thanks for this. Can you explain the colors and positions and what they do?
Can you also explains how this works for lamebrains like myself
For the first colour 0xd1dbde (the "race ready" window colour popup), it's saying to only press Numpad 0 if that colour is present at that specified coordinate in the game window (2931, 971). I had to change mine to match my screen coords and also my colour is slightly different (use WindowSpy to check these).

I just don't know what the 2nd colour 0x67dfff is. It's bright blue and I think it's saying if the mouse coordinate is resting on that blue colour, to go to the left lane. But what is the blue and why go left only when it's blue? The same goes for the next colours which are black or near black and why they are needed?
Nevermind I've figured it out, and it does indeed work flawlessly.

I got the colours mixed up, it targets yellow not blue. So the coordinates are targeting the yellow in the stamina bar, around the 10-15% mark. So the script is saying as long as the coords matches the yellow colour, hold down the W key. Otherwise when it's black, let go of W (when stamina is around 10-15%).

Just gotta use WindowSpy since everyone uses different resolutions and have different colour settings on their monitors.
You got it, thanks brooklynbase.
Should it exit the race after it's over or does it just allow it to tic down and force you out of the race?

I have everything working fine except for that, can't figure it out. It technically works for me fine, loops it all like normal and goes from race to race, just have that added time waiting for it to boot me.
When the race results window pops up, the script should locate a pixel (coordinate) on that window, then tell it to press numpad 0 twice to exit.
I also had all of them working fine until the last one. tried a bunch of different coords on that window but could not get it working. the other ones worked perfectly fine.
(03-20-2015, 11:19 AM)smils Wrote: [ -> ]I also had all of them working fine until the last one. tried a bunch of different coords on that window but could not get it working. the other ones worked perfectly fine.

Yeah I actually wasn't able to get the running left and the exit leaving properly. The running left I just added the ; to exclude but no matter what I do I can not get that exit to leave
Pages: 1 2 3 4 5 6