Thread Rating:
  • 25 Vote(s) - 2.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My choco racing loop AHK
#41
(04-06-2015, 03:40 PM)Rustyclippers Wrote:  http://www.mmominion.com/Thread-Gold-Saucer?page=9

I made a few different scripts trying different things. There is an example script I made in that link, just to show how to handle races being full (pixel reading).

A few pages prior someone made a script that Sprints during the race (without pixel reading, however if the races are full... or there is a timing issue at some point you would run into a wall and would no longer Q)


Below is a very basic Q and leave AHK script

Code:
CoordMode, ToolTip, Screen

^s::
WinGet, programid, List, FINAL FANTASY

Loop
    {
    Sleep 1200
tooltip, `n Race # : %A_Index%`n, 0, 0
    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,,{Numpad0}, ahk_id %programid1%
    Sleep 1200
    ControlSend,,{Numpad6}, ahk_id %programid1%
    Sleep 1200
    ControlSend,,{Numpad0}, ahk_id %programid1% ;Queue
    Sleep 35000 ;universal wait timer (Q pops at 0,15,30 seconds)
    ControlSend,,{Numpad0}, ahk_id %programid1% ; accept Queue
    Sleep 190000 ;race duration
    ControlSend,,{Numpad0}, ahk_id %programid1% ; double hit numpad 0 to exit
    Sleep 500
    ControlSend,,{Numpad0}, ahk_id %programid1%
    Sleep 12000
    }
    INS::pause
Return

This script has tons of extra delay in it. The 190000 sleep value needs to roughly be the time from when you accept Q + longest possible race time + 10 seconds. This was my day 1 shitty ahk script. I ran a seperate script to sprint, but it works off pixel reading.


Do you use windows 8? I shared a few scripts with people who use windows 8 and they all failed (image / pixel reading). AutoIt may have better pixel reading functionality. I have never used AutoIT but it appears to be more robust

With the hit to 8th place finishes in the last patch a Sprint is necessary for decent chocobo leveling time / mgp

this doesnt work either. it goes in to the "tell me about chocobo racing" menu
Reply
#42
Sorry, that script requires you to start with the chocobo racing npc as your target. Sorry, forgot to mention that part. It also is intended for use with minion attached (cutscene + dialogue skipping)

I havent chocoraced since week 1 sorry ^^;
Reply
#43
Oh, you must be targetting the wrong guy to start a race!
Reply
#44
(04-06-2015, 04:06 PM)Rustyclippers Wrote:  Sorry, that script requires you to start with the chocobo racing npc as your target. Sorry, forgot to mention that part. It also is intended for use with minion attached (cutscene + dialogue skipping)

I havent chocoraced since week 1 sorry ^^;

thanks ill try it out, the other one i tried with timers i end up running into a wall after the first match.
Reply
#45
(04-07-2015, 01:06 AM)Cichard Wrote:  thanks ill try it out, the other one i tried with timers i end up running into a wall after the first match.

He probably wrote it at a higher rated race (faster finish times).

Code:
; Padding in case race started late
sleep, 37000

Use that value to increase the padding, assuming the conversation script is correct its looping too early. I believe his script is for use without minion (without skip dialogue).
Reply
#46
(04-07-2015, 01:41 AM)Rustyclippers Wrote:  
(04-07-2015, 01:06 AM)Cichard Wrote:  thanks ill try it out, the other one i tried with timers i end up running into a wall after the first match.

He probably wrote it at a higher rated race (faster finish times).

Code:
; Padding in case race started late
sleep, 37000

Use that value to increase the padding, assuming the conversation script is correct its looping too early. I believe his script is for use without minion (without skip dialogue).

i wish i could get something to work well, last place is only 25.
Reply
#47
Do you have windows 8 Cichard? I havent gotten pixel reading to work on 8. Without pixel reading its a little iffy to get a "decent" script working.

If you can get pixel reading working / are using 7. Essentially if you build your chocobo full stamina and just sprint for the entire race you wont come in last. Pixel reading also stops you from wasting 40+ seconds a run aswell (buffer time due to slow player load ins and what not). I might make one with AutoIt, it might be less quirky with windows 8
Reply
#48
im using windows 7, and cant get pixel to work at all.

(03-22-2015, 10:53 AM)edb6377 Wrote:  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*

this one doesnt work it doesnt even select to start the race, it never hits a(left) to click ok. it just clicks cancel. Not sure why none of these remotely work. the only one i have found that works is rusty and it just comes in last place every time.
Reply
#49
(04-07-2015, 04:08 AM)Cichard Wrote:  this one doesnt work it doesnt even select to start the race, it never hits a(left) to click ok. it just clicks cancel. Not sure why none of these remotely work. the only one i have found that works is rusty and it just comes in last place every time.

My script requires you to have the race npc targeted before you start it. It will accept the race properly on subsequent loops even though you zone back into the chocobo square without the npc selected. My script also is ment to be run with minion and skip dialogue enabled. People dont seem to mention those things with their scripts normally.


Hopefully you get it working. I ran into an issue were i started using an ahk script / tool to pull coords + colour into my clipboard. For an hour i was utterly confused why my scripts weren't working. Eventually i noticed the tool i was using was pulling RGB format instead of BGR

Code:
Loop
{
    ImageSearch, FoundX, FoundY, 610, 263, 700, 284, C:\file\path.bmp
    if ErrorLevel = 0
        {
            Sleep 100
            Click %FoundX% %FoundY%
break
}
else
continue
}

http://www.autohotkey.com/docs/commands/ImageSearch.htm

You can also use image search. You take a screenshot and search for the image within a specified area. Certain situations like triggering an event off a word work better with image search. or situations were a pixel color is common and multiple things can trigger it.

The code above will actually click were the image is found. X variable "FoundX" and the Y variable are the coordinates of the top left of the screenshot image were it is found on the screen. As long as your screenshot image is smaller then the button .

all screenshot images are not created equally. Use lightshot and bmp images. I have had success with 32bit bmp images. other programs + other image types + other sizes gave me greif
Reply
#50
i think its just silly that it is this difficult to get working, im thinking of using macro goblin. its pixel detection i never had a problem with. im using version 112102
Reply
 


Forum Jump:


Users browsing this thread: 5 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products