Thread Rating:
  • 25 Vote(s) - 2.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My choco racing loop AHK
#11
It will end the sprint loop when stamina reaches below 10%, depending on where you locate your stamina bar. If you happen to have a race where your stamina bar does not go below 10% though, it will wait for the timer to tick down and see the black screen as you zone back to your character. It checks every 'sleep 2000' so for my computer it will always see the black zoning screen and break loop to finish race.
Reply
#12
I just realized that I'm not stopping sprinting at 10% like I thought I was, that's probably my problem.

I'll just have to toy with that part to see if it fixes the end. Thanks so much for the help!
Reply
#13
Blah having another problem now, working fine on one computer but on another whenever the race ends it still is spamming 1 and holding down w.

Can't figure out why, driving me nuts
Reply
#14
getpixelcolor in that loop is looking for the stamina bar depleted color, or it won't break.
Reply
#15
cant get this to accept the pop up. it queues for the race jsut fine. but when the pop up comes up it doesnt do anything. I changed the coords to where my pop up is. but nothing.
Reply
#16
Might need to change a color too, it does look for shades I think. There is still a lot of variance in the cream color it looks for in that pop up window.

I'd just window spy your own color and coord for that loop that checks for popup. Or just move the pop up windows around slightly while its looking.
Reply
#17
i did. window spy and did the color and i still just sits there. and location
Reply
#18
Maybe you moved the mouse while waiting for the popup? If you do it requires two Numpad0 because the first just puts the cursor back down.

I added a Numpad0 because I've been known to do this as well. Just one line added:
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%
            Sleep 500
                       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
#19
(03-21-2015, 02:22 AM)Cichard Wrote:  cant get this to accept the pop up. it queues for the race jsut fine. but when the pop up comes up it doesnt do anything. I changed the coords to where my pop up is. but nothing.

I Just use something like a 32-37 second wait after I queue. The race can pop before 30 seconds, but it wont expire. In my experience it rarely popped before 30 seconds so I just stuck with the sleep 32, once or twice an hour you save 15 seconds (unless its different on your server)

PS if you bother to feed your bird occasionally. stack stamina and go for headstart as an ability for best performance. Also you can run a separate script to check for debuffs. depending on your skills an extra 150 stamina is pretty nice.
Reply
#20
Okay I did a few things to this overall, changing the structure and adding some tooltips to help with both Pixel Detect and Status to see if you are stuck in a loop or in the wrong place. So far 50/50 races.

I commented the code to show what I was attempting to look at. If you get the coordinates right in the places you need to set them then it will show you the colors.

Enter your coordinates then run your first race and watch the tooltips at the various key moments. If your coords are right you will know what to enter :) Window Spy and OPEN are your friends. They shouldn't be used when you are trying to bot this but should be very handy when configuring.

Things to check there are more than this one.
**NOTE; DOWNSIDE TO PIXEL CHECKING IS THAT WINDOW MUST BE ACTIVE OR IT WON'T DETECT PIXELS MEANING FFXIV IS ACTIVE UNLIKE PRIOR VERSION WHICH WASNT **

Code:
        PixelGetColor, color, 1560, 510 <== COORDS FOR CHECKING COLOR
        tooltip, Race Ready Color: %color%`n, 0, 50, 3 ;Create Window Tool Tip to show color at location
        if color = 0xD6226B <==COLOR SHOULD MATCH THE TOOLTIP

For Stam SPRINT/WALK check its a bit different as its looking for the empty bar not the full one.  I likely need to add in another value but since I never have that stamina left I didn't do anything about it.  Basically the bar will blink then it will pass the point and give you a color.  I set mine around 15% only because at that point it will finishing running and i am at like 2% anyways.
        if (color = 0x101418 or color=0x000000)

CODE BELOW
Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force    ;Skips the dialog box and replaces the old instance automatically
#Persistent

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, Pixel, Screen
;Initial state is Relative. Frustration awaits if you set Mouse to Screen and then use GetPixelColor because you forgot this line. There are separate ones for: Mouse, Pixel, ToolTip, Menu, Caret

; Control S to Start
^S::
looping=true
Loop
{
Queue:
    if looping=false
    break
        tooltip, Current Race # : %A_Index%`n, 0, 0, 1 ;Create Window Tool Tip to show # of Races
        tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
        StatusTip := "Asking for Race"
        tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
        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,,{Numpad0}, ahk_id %programid1%
        Sleep 1200
        ControlSend,,{Numpad0}, ahk_id %programid1%
        Sleep 1200
        ControlSend,,{Numpad4}, ahk_id %programid1%
        Sleep 1000
        ControlSend,,{Numpad0}, ahk_id %programid1%
        StatusTip := "Waiting for Race Ready"
                tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
        loop
        {
        sleep 1000
        ; Look for Purple Balloon in Race Ready
        PixelGetColor, color, 1560, 510
        tooltip, Race Ready Color: %color%`n, 0, 50, 3 ;Create Window Tool Tip to show color at location
        if color = 0xD6226B
        {
            StatusTip := "Race Ready"
                    tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
            Sleep 2000
               ControlSend,,{Numpad0}, ahk_id %programid1%
            Sleep 2000
            ControlSend,,{Numpad0}, ahk_id %programid1%
            break
        }
        else    
        {
                    Sleep 500
                    continue
        }
    }
    StatusTip := "Joined Race"
            tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
; Race Joined Wait to Skip Cutscene
    sleep, 13000
    ControlSend, , {Esc}, ahk_id %programid1%
    sleep, 2000
    ControlSend, , {Numpad0}, ahk_id %programid1%
    sleep, 14000
; Cutscene Skipped
    StatusTip := "Finding Stamina Bar"
            tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status

; Sprint until 10 percent and break in case stamina stays above 10% at race end
    loop
    {
        ; Look at stam bar around 15% marker and if the background turns to Black/Stam Bar Empty Color
        ; Then raise on W.  Two values are base on flashes of bar BLACK/Color of empty spot at 15%
        ; This also means it will resume pressing on the key if it gets a stam boost
        PixelGetColor, color, 783, 983
        tooltip, Stam Color: %color%`n, 0, 50, 3 ;Create Window Tool Tip for Stam Sprint/Walk Color
        if (color = 0x101418 or color=0x000000)
        {
            StatusTip := "WALKING"
            tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
            ControlSend,,{w up}, ahk_id %programid1%
            ControlSend,,{2}, ahk_id %programid1%
            break
        }
        else
        {
            StatusTip := "SPRINTING"
                    tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
            ;Press W Down otherwise
            sleep 2000
            ControlSend,,{w down}, ahk_id %programid1%
            ControlSend,,{1}, ahk_id %programid1%
            continue
        }
    }
; Wait for race results screen to pop
    loop
    {
    StatusTip := "Waiting for Race Results"
            tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
        PixelGetColor, color, 892, 380
        tooltip, Race CompleteColor: %color%`n, 0, 50, 3 ;Create Window Tool Tip to show color at location
; Look for Yellow XP Coin on Race Complete Screen
        if (color = 0x3DB3C6)
        {
            StatusTip := "Race Complete"
                    tooltip, Status: %StatusTip%`n, 0, 25, 2 ;Create Window Tool Tip for Status
            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

WHAT ELSE COULD BE DONE
Code:
* Move Coords up to top *
* Create a debug flag up top so once its configured it is there*
* Do resolution sizing instead of points (1920x1080 is what this one was done in) *
* Since the items should appear at the same location its really about math *
* Use Debug Flag and Show Coord Point Markers to ensure right locations *
* Add Detection of Item Timer so not spamming 1 *
* Add Potential Detect of trap to side step it *
* Take Screenshot at chests to see if there are pixels we can navigate the course on  by figuring out right left or chest locations*
Reply
 


Forum Jump:


Users browsing this thread: 2 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products