Thread Rating:
  • 25 Vote(s) - 2.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My choco racing loop AHK
#1
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
Reply
#2
Thanks for this. Can you explain the colors and positions and what they do?
Reply
#3
Can you also explains how this works for lamebrains like myself
Reply
#4
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?
Reply
#5
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.
Reply
#6
You got it, thanks brooklynbase.
Reply
#7
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.
Reply
#8
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.
Reply
#9
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.
Reply
#10
(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
Reply
 


Forum Jump:


Users browsing this thread: 9 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products