mirror of
https://github.com/bnowakow/GT7-Scripts.git
synced 2026-01-28 14:06:01 +00:00
499 lines
19 KiB
AutoHotkey
499 lines
19 KiB
AutoHotkey
#Persistent
|
||
#NoEnv
|
||
#MaxHotkeysPerInterval 99000000
|
||
#HotkeyInterval 99000000
|
||
#KeyHistory 0
|
||
#Include Lib\Gdip.ahk
|
||
#Include Lib\AHK-ViGEm-Bus.ahk
|
||
#Include Lib\__utility__.ahk
|
||
#Include Lib\__controller_functions__.ahk
|
||
#Include Mod\TokyoDetections.ahk
|
||
#Include Races\Tokyo.ahk
|
||
|
||
hModule := DllCall("LoadLibrary", "Str", A_LineFile "\..\Lib\SuperSleep.dll", "Ptr")
|
||
SuperSleep := DllCall("GetProcAddress", "Ptr", DllCall("GetModuleHandle", "Str", A_LineFile "\..\Lib\SuperSleep.dll", "Ptr"), "AStr", "super_sleep", "Ptr")
|
||
|
||
ListLines Off
|
||
Process, Priority, , A
|
||
SetBatchLines, -1
|
||
SetKeyDelay, -1, -1
|
||
SetMouseDelay, -1
|
||
SetDefaultMouseSpeed, 0
|
||
SendMode Input
|
||
|
||
SetWorkingDir %A_ScriptDir%
|
||
DetectHiddenWindows, On
|
||
#Persistent
|
||
|
||
Global script_start := A_TickCount
|
||
Global remote_play_offsetY := 71
|
||
Global racecounter := 0
|
||
Global resetcounter := 0
|
||
Global color_pitstop1 := 0xFFFFFF
|
||
Global color_restart := 0x6D5223
|
||
Global hairpin_delay := 0
|
||
Global PitstopTimings := 0
|
||
Global TelegramBotToken := ""
|
||
Global TelegramChatID := ""
|
||
Global location := ""
|
||
Global TokyoLapCount := 1
|
||
Global PitstopTimingsArray :=
|
||
Global DynTurnDelay := 0
|
||
Global SaveResetClip := 0
|
||
SetFormat, integerfast, d
|
||
ps_win_width := 640
|
||
ps_win_height := 360
|
||
IniRead, hairpin_delay, config.ini, Vars, hairpin_delay, 0
|
||
IniRead, color_pitstop1, config.ini, Vars, color_pitstop1, 0
|
||
IniRead, RaceCounterTotal, config.ini, Stats, racecountertotal, 0
|
||
IniRead, ResetCounterTotal, config.ini, Stats, resetcountertotal, 0
|
||
IniRead, TelegramBotToken, config.ini, API, TelegramBotToken, 0
|
||
IniRead, TelegramChatID, config.ini, API, TelegramChatID, 0
|
||
IniRead, PitstopTimings, config.ini, Vars, PitStopTimings0, 0
|
||
StringSplit, PitstopTimingsArray, PitstopTimings, `,
|
||
|
||
IniRead, DynTurnDelay, config.ini, Vars, DynTurnDelay, 0
|
||
IniRead, SaveResetClip, config.ini, Vars, SaveResetClip, 0
|
||
|
||
|
||
SetFormat, FloatFast, 0.2
|
||
creditcountertotal := 835000*racecountertotal/1000000
|
||
StringSplit, PitstopTimingsArray, PitstopTimings, `,
|
||
|
||
Global controller := new ViGEmDS4()
|
||
controller.SubscribeFeedback(Func("OnFeedback"))
|
||
OnFeedback(largeMotor, smallMotor, lightbarColor){
|
||
}
|
||
|
||
;- GUI 1 (MAIN) -------------------------------------------------------------------------------------------------
|
||
Icon = Assets\GT7_Tokyo.ico
|
||
Menu, Tray, Icon, %Icon%
|
||
Gui, -Caption
|
||
Gui, Add, Picture, x0 y0 w650 h207 , Assets\tokyo_gui.png
|
||
Gui, Add, Button, x222 y82 w410 h80 default gButtonStart, START
|
||
Gui, Add, Progress, x0 y54 w641 h12 RaceProgress vRaceProgress -Smooth, 0
|
||
Gui, Font, S8 CDefault Bold, Verdana
|
||
Gui, Add, Text, x440 y3 w160 h20 RaceCounterTotal +BackgroundTrans, // ALL TIME
|
||
Gui, Font, ,
|
||
Gui, Add, Text, x440 y23 w160 h20 RaceCounterTotal vracecountertotal +BackgroundTrans, Races completed: %racecountertotal%
|
||
Gui, Add, Text, x440 y38 w160 h20 ResetCounterTotal vresetcountertotal +BackgroundTrans, Races failed: %resetcountertotal%
|
||
Gui, Add, Text, x550 y38 w160 h20 CreditCounterTotal vcreditcountertotal +BackgroundTrans, Credits: %creditcountertotal% M
|
||
Gui, Font, S8 CDefault Bold, Verdana
|
||
Gui, Add, Text, x220 y3 w300 h20 RaceSession vracesession +BackgroundTrans, // SESSION
|
||
Gui, Font, ,
|
||
Gui, Add, Text, x220 y23 w160 h20 RaceCounterSession vracecountersession +BackgroundTrans, Races completed: 0
|
||
Gui, Add, Text, x220 y38 w160 h20 ResetCounterSession vresetcountersession +BackgroundTrans, Races failed: 0
|
||
Gui, Add, Text, x330 y23 w160 h20 CreditCounterSession vcreditcountersession +BackgroundTrans, Credits: 0
|
||
Gui, Add, Text, x330 y38 w160 h20 CreditAVG vcreditavg +BackgroundTrans, Avg./h: 0
|
||
Gui, Add, Text, x10 y38 w150 h20 CounterLap vcurrentlap +BackgroundTrans, Current Lap: 0/12
|
||
Gui, Add, Text, x10 y23 w220 h20 CurrentLoop vcurrentloop +BackgroundTrans, Current Location: -
|
||
Gui, Add, Button, x222 y172 w300 h20 default gGUIReset, Reset
|
||
Gui, Add, Button, x531 y172 w101 h20 default gGUIClose, Exit
|
||
Gui, Add, Button, x12 y82 w200 h20 default gRaceSettingsWindow, Settings: Race
|
||
Gui, Add, Button, x12 y112 w200 h20 default gMachineSettingsWindow, Settings: Machine/Setup
|
||
Gui, Add, Button, x12 y142 w200 h20 default gIngameSettingsWindow, Settings: Ingame (wip)
|
||
Gui, Add, Button, x12 y172 w200 h20 default gNotificationsWindow, Settings: Notifications/API
|
||
Gui, Font, S8 CDefault Bold, Verdana
|
||
Gui, Add, Text, x10 y3 w620 h20 +BackgroundTrans, // TOKYO CONTROL CENTER
|
||
Gui, Add, Statusbar, -Theme Backgroundeeeeee ;#eeeeee, no typo
|
||
SB_SetParts(80,270,190)
|
||
SB_SetText(" beta 9.4 ",1)
|
||
SB_SetText(" by problemz.",4)
|
||
Gui, Show, x8 y532 h225 w640, GT7 Tokyo // by problemz
|
||
guicontrol,, CurrentLoop, Press START, go go!
|
||
;- GUI 2 (MACHINE/SETUP) ----------------------------------------------------------------------------------------
|
||
;Gui, 2: Add, Picture, x0 y0 w650 h500 , Assets\tokyo_gui.png
|
||
Gui, 2: Add, Text, x10 y14 w200 h20 +BackgroundTrans , Hairpin Turn Delay:
|
||
Gui, 2: Add, Text, x170 y14 w200 h20 +BackgroundTrans , (ms)
|
||
Gui, 2: Add, Slider, x220 y10 w300 h51 vsliderhairpindelay Range0-800 Thick40 +ToolTip TickInterval50 gSliderMove,%hairpin_delay%
|
||
Gui, 2: Add, Edit, x106 y11 w60 vtxthairpindelay gtextchanged, %hairpin_delay%
|
||
Gui, 2: Add, Text, x10 y40 w200 h20 +BackgroundTrans , Lower = slower PC // Higher = faster PC
|
||
Gui, 2: Add, Button, x530 y11 w100 h73 +BackgroundTrans gSaveToIni, Save
|
||
Gui, 2: Add, Button, x10 y103 w200 h40 gPit1Color, Stuck in pit `n(Only click when at tire selection menu)
|
||
Gui, 2: Add, Checkbox, x320 y110 w300 gDynTurnDelay vDynTurnDelay +BackgroundTrans Checkbox Checked%DynTurnDelay%, Experimental: Use dynamic hairpin turn delays.
|
||
Gui, 2: Add, Checkbox, x320 y130 w300 gSaveResetClip vSaveResetClip +BackgroundTrans Checkbox Checked%SaveResetClip%, Experimental: Save clip (past 3 minutes) after a reset.
|
||
|
||
;- GUI 3 (INGAME) -----------------------------------------------------------------------------------------------
|
||
;Gui, 3: Add, Picture, x0 y0 w650 h177 , Assets\tokyo_gui.png
|
||
;- GUI 4 (RACE SETTINGS) ----------------------------------------------------------------------------------------
|
||
;Gui, 4: Add, Picture, x0 y0 w650 h450 , Assets\tokyo_gui.png
|
||
Gui, 4: Font, S8 CDefault Bold, Verdana
|
||
Gui, 4: Add, Text, x220 y20 w200 h20 vFightme +gFightMe +BackgroundTrans , ლ(`ー´ლ)
|
||
Gui, 4: Add, Text, x30 y10 w200 h50 +BackgroundTrans vPitstopText , Pit stop wait timers in ms`n(Read-only):
|
||
Gui, 4: Font, ,
|
||
Gui, 4: Add, Text, xp yp+40 w100 h20 +BackgroundTrans , Lap 1:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray1, %PitstopTimingsArray1%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 2:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray2, %PitstopTimingsArray2%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 3:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray3, %PitstopTimingsArray3%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 4:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray4, %PitstopTimingsArray4%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 5:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray5, %PitstopTimingsArray5%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 6:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray6, %PitstopTimingsArray6%
|
||
Gui, 4: Add, Text, xp-540 yp+30 w100 h20 +BackgroundTrans , Lap 7:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray7, %PitstopTimingsArray7%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 8:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray8, %PitstopTimingsArray8%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 9:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray9, %PitstopTimingsArray9%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 10:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray10, %PitstopTimingsArray10%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 11:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray11, %PitstopTimingsArray11%
|
||
Gui, 4: Add, Text, xp+60 yp+3 w100 h20 +BackgroundTrans , Lap 12:
|
||
Gui, 4: Add, Edit, +ReadOnly xp+40 yp-3 w50 vNewPitstopTimingsArray12, %PitstopTimingsArray12%
|
||
Gui, 4: Add, Button, +hidden xp-540 yp+30 w590 h25 vNewPitstopTimingsButton gSaveNewTimings, Save pit stop timings
|
||
Gui, 4: Font, S8 CDefault Bold, Verdana
|
||
Gui, 4: Add, Text, x370 y10 w120 h20 +BackgroundTrans , Select Race pace:
|
||
Gui, 4: Font, ,
|
||
Gui, 4: Add, DropDownList, xp+125 yp-3 w125 vRacePaceChoice gRacePaceChoice, Select to change||Safe (slower)|Risky (faster)
|
||
Gui, 4: Add, Button, +hidden x230 yp+10 w120 h25 vLoadDevTimings gLoadDevTimings, Load last dev timings
|
||
|
||
;- GUI 5 (NOTIFICATIONS/API) ------------------------------------------------------------------------------------
|
||
;Gui, 5: Add, Picture, x0 y0 w650 h400 , Assets\tokyo_gui.png
|
||
Gui, 5: Add, Text, x10 y14 w205 h20 +BackgroundTrans , Telegram Bot Token:
|
||
Gui, 5: Add, Edit, x116 y11 w400 vTelegramBotToken Password, %TelegramBotToken%
|
||
Gui, 5: Add, Text, x10 y44 w205 h20 +BackgroundTrans , Telegram Chat ID:
|
||
Gui, 5: Add, Edit, x116 y41 w400 vTelegramChatID Password, %TelegramChatID%
|
||
Gui, 5: Add, Button, x530 y11 w100 h51 +BackgroundTrans gSaveToIni, Save
|
||
Return
|
||
|
||
DynTurnDelay:
|
||
return
|
||
|
||
SaveResetClip:
|
||
return
|
||
|
||
MachineSettingsWindow:
|
||
|
||
if (GetKeyState("LShift", "P") AND GetKeyState("LAlt", "P")){
|
||
goto, MouseColor
|
||
}
|
||
else{
|
||
Gui, 2: Show, x6 y757 w639 h150, Settings: Machine/Setup
|
||
}
|
||
return
|
||
|
||
IngameSettingsWindow:
|
||
Gui, 3: Show, x6 y757 w639 h35, Settings: Ingame
|
||
return
|
||
|
||
RaceSettingsWindow:
|
||
Gui, 4: Show, x6 y757 w639 h140, Settings: Race
|
||
return
|
||
|
||
NotificationsWindow:
|
||
Gui, 5: Show, x6 y757 w639 h70, Settings: Notifications/API
|
||
return
|
||
|
||
SliderMove:
|
||
Gui, Submit, nohide
|
||
GuiControl,, txthairpindelay, %sliderhairpindelay%
|
||
Return
|
||
|
||
SaveToIni:
|
||
Gui, Submit, Hide
|
||
IniWrite, %txthairpindelay%, config.ini,Vars, hairpin_delay
|
||
IniWrite, %TelegramBotToken%, config.ini,API, TelegramBotToken
|
||
IniWrite, %TelegramChatID%, config.ini,API, TelegramChatID
|
||
GuiControlGet, DynTurnDelay,,DynTurnDelay
|
||
IniWrite, %DynTurnDelay%, config.ini,VARS, DynTurnDelay
|
||
GuiControlGet, SaveResetClip,,SaveResetClip
|
||
IniWrite, %SaveResetClip%, config.ini,VARS, SaveResetClip
|
||
return
|
||
|
||
SaveNewTimings:
|
||
MsgBox, 4,, Do you really wanna save new pitstop timings?
|
||
IfMsgBox Yes
|
||
{
|
||
Gui, Submit, NoHide
|
||
NewPitStopTimings = %NewPitstopTimingsArray1%`,%NewPitstopTimingsArray2%`,%NewPitstopTimingsArray3%`,%NewPitstopTimingsArray4%`,%NewPitstopTimingsArray5%`,%NewPitstopTimingsArray6%`,%NewPitstopTimingsArray7%`,%NewPitstopTimingsArray8%`,%NewPitstopTimingsArray9%`,%NewPitstopTimingsArray10%`,%NewPitstopTimingsArray11%`,%NewPitstopTimingsArray12%
|
||
IniWrite, %NewPitStopTimings%, config.ini,VARS, PitStopTimings0
|
||
IniWrite, %NewPitStopTimings%, config.ini,VARS, PitStopTimings99
|
||
IniRead, PitstopTimings, config.ini, Vars, PitStopTimings0, 0
|
||
StringSplit, PitstopTimingsArray, PitstopTimings, `,
|
||
}
|
||
return
|
||
|
||
|
||
RacePaceChoice:
|
||
Gui, Submit, NoHide
|
||
If (RacePaceChoice = "Safe (slower)")
|
||
IniRead, PitstopTimings, config.ini, Vars, PitStopTimings1, 0
|
||
IniWrite, %PitstopTimings%, config.ini,VARS, PitStopTimings0
|
||
IniRead, PitstopTimings, config.ini, Vars, PitStopTimings0, 0
|
||
StringSplit, PitstopTimingsArray, PitstopTimings, `,
|
||
guicontrol,, NewPitstopTimingsArray1, %PitstopTimingsArray1%
|
||
guicontrol,, NewPitstopTimingsArray2, %PitstopTimingsArray2%
|
||
guicontrol,, NewPitstopTimingsArray3, %PitstopTimingsArray3%
|
||
guicontrol,, NewPitstopTimingsArray4, %PitstopTimingsArray4%
|
||
guicontrol,, NewPitstopTimingsArray5, %PitstopTimingsArray5%
|
||
guicontrol,, NewPitstopTimingsArray6, %PitstopTimingsArray6%
|
||
guicontrol,, NewPitstopTimingsArray7, %PitstopTimingsArray7%
|
||
guicontrol,, NewPitstopTimingsArray8, %PitstopTimingsArray8%
|
||
guicontrol,, NewPitstopTimingsArray9, %PitstopTimingsArray9%
|
||
guicontrol,, NewPitstopTimingsArray10, %PitstopTimingsArray10%
|
||
guicontrol,, NewPitstopTimingsArray11, %PitstopTimingsArray11%
|
||
guicontrol,, NewPitstopTimingsArray11, %PitstopTimingsArray11%
|
||
|
||
If (RacePaceChoice = "Risky (faster)")
|
||
IniRead, PitstopTimings, config.ini, Vars, PitStopTimings2, 0
|
||
IniWrite, %PitstopTimings%, config.ini,VARS, PitStopTimings0
|
||
IniRead, PitstopTimings, config.ini, Vars, PitStopTimings0, 0
|
||
StringSplit, PitstopTimingsArray, PitstopTimings, `,
|
||
guicontrol,, NewPitstopTimingsArray1, %PitstopTimingsArray1%
|
||
guicontrol,, NewPitstopTimingsArray2, %PitstopTimingsArray2%
|
||
guicontrol,, NewPitstopTimingsArray3, %PitstopTimingsArray3%
|
||
guicontrol,, NewPitstopTimingsArray4, %PitstopTimingsArray4%
|
||
guicontrol,, NewPitstopTimingsArray5, %PitstopTimingsArray5%
|
||
guicontrol,, NewPitstopTimingsArray6, %PitstopTimingsArray6%
|
||
guicontrol,, NewPitstopTimingsArray7, %PitstopTimingsArray7%
|
||
guicontrol,, NewPitstopTimingsArray8, %PitstopTimingsArray8%
|
||
guicontrol,, NewPitstopTimingsArray9, %PitstopTimingsArray9%
|
||
guicontrol,, NewPitstopTimingsArray10, %PitstopTimingsArray10%
|
||
guicontrol,, NewPitstopTimingsArray11, %PitstopTimingsArray11%
|
||
guicontrol,, NewPitstopTimingsArray11, %PitstopTimingsArray11%
|
||
return
|
||
|
||
TextChanged:
|
||
guiControlGet, txtvar,, txthairpindelay
|
||
if (txtvar > 800)
|
||
{
|
||
GuiControl,, txthairpindelay, 800
|
||
}
|
||
|
||
GuiControl,, sliderhairpindelay, %txtvar%
|
||
return
|
||
|
||
Pit1Color:
|
||
MsgBox, 4,, Do you really wanna set a new Pitstop color?
|
||
IfMsgBox Yes
|
||
{
|
||
gosub, GrabRemotePlay
|
||
color_pitstop1 := PixelColorSimple(199, 315+remote_play_offsetY)
|
||
IniWrite, %color_pitstop1%, config.ini,Vars, color_pitstop1
|
||
}
|
||
return
|
||
|
||
ButtonStart:
|
||
SetTimer, UpdateTimer, 1000
|
||
Gui, Submit, NoHide
|
||
id := ""
|
||
SetKeyDelay, 10
|
||
Process, priority, , High
|
||
gosub, GrabRemotePlay
|
||
if (id = "")
|
||
return
|
||
gosub, PauseLoop
|
||
CoordMode, Pixel, Screen
|
||
CoordMode, ToolTip, Screen
|
||
loop {
|
||
Press_X()
|
||
Race_Tokyo()
|
||
}
|
||
|
||
PixelTuning:
|
||
x_ratio := ps_win_width/640
|
||
y_ratio := ps_win_height/360
|
||
return
|
||
|
||
GrabRemotePlay:
|
||
WinGet, remotePlay_id, List, ahk_exe RemotePlay.exe
|
||
if (remotePlay_id = 0)
|
||
{
|
||
MsgBox, PS4 Remote Play not found
|
||
return
|
||
}
|
||
Loop, %remotePlay_id%
|
||
{
|
||
id := remotePlay_id%A_Index%
|
||
WinGetTitle, title, % "ahk_id " id
|
||
If InStr(title, "PS Remote Play")
|
||
break
|
||
}
|
||
WinMove, ahk_id %id%,, 0, 0, 640, 540
|
||
|
||
ControlFocus,, ahk_class %remotePlay_class%
|
||
WinActivate, ahk_id %id%
|
||
GetClientSize(remotePlay_id5, ps_win_width, ps_win_height)
|
||
gosub, PixelTuning
|
||
return
|
||
|
||
FightMe:
|
||
if (A_GuiEvent = "DoubleClick")
|
||
{
|
||
guicontrol, -readonly, NewPitstopTimingsArray1
|
||
guicontrol, -readonly, NewPitstopTimingsArray2
|
||
guicontrol, -readonly, NewPitstopTimingsArray3
|
||
guicontrol, -readonly, NewPitstopTimingsArray4
|
||
guicontrol, -readonly, NewPitstopTimingsArray5
|
||
guicontrol, -readonly, NewPitstopTimingsArray6
|
||
guicontrol, -readonly, NewPitstopTimingsArray7
|
||
guicontrol, -readonly, NewPitstopTimingsArray8
|
||
guicontrol, -readonly, NewPitstopTimingsArray9
|
||
guicontrol, -readonly, NewPitstopTimingsArray10
|
||
guicontrol, -readonly, NewPitstopTimingsArray11
|
||
guicontrol, -readonly, NewPitstopTimingsArray12
|
||
guicontrol, -hidden, NewPitstopTimingsButton
|
||
guicontrol, -hidden, LoadDevTimings
|
||
guicontrol,, PitstopText, Pit stop wait timers in ms`ndevmode unlocked ლ(`ー´ლ):
|
||
guicontrol, +hidden, FightMe
|
||
}
|
||
return
|
||
|
||
LoadDevTimings:
|
||
IniRead, PitstopTimings, config.ini, Vars, PitStopTimings99, 0
|
||
StringSplit, PitstopTimingsArray, PitstopTimings, `,
|
||
guicontrol,, NewPitstopTimingsArray1, %PitstopTimingsArray1%
|
||
guicontrol,, NewPitstopTimingsArray2, %PitstopTimingsArray2%
|
||
guicontrol,, NewPitstopTimingsArray3, %PitstopTimingsArray3%
|
||
guicontrol,, NewPitstopTimingsArray4, %PitstopTimingsArray4%
|
||
guicontrol,, NewPitstopTimingsArray5, %PitstopTimingsArray5%
|
||
guicontrol,, NewPitstopTimingsArray6, %PitstopTimingsArray6%
|
||
guicontrol,, NewPitstopTimingsArray7, %PitstopTimingsArray7%
|
||
guicontrol,, NewPitstopTimingsArray8, %PitstopTimingsArray8%
|
||
guicontrol,, NewPitstopTimingsArray9, %PitstopTimingsArray9%
|
||
guicontrol,, NewPitstopTimingsArray10, %PitstopTimingsArray10%
|
||
guicontrol,, NewPitstopTimingsArray11, %PitstopTimingsArray11%
|
||
guicontrol,, NewPitstopTimingsArray11, %PitstopTimingsArray11%
|
||
return
|
||
|
||
PauseLoop:
|
||
controller.Buttons.Cross.SetState(false)
|
||
controller.Buttons.Square.SetState(false)
|
||
controller.Buttons.Triangle.SetState(false)
|
||
controller.Buttons.Circle.SetState(false)
|
||
controller.Buttons.L1.SetState(false)
|
||
controller.Buttons.L2.SetState(false)
|
||
controller.Axes.L2.SetState(0)
|
||
controller.Buttons.R1.SetState(false)
|
||
controller.Buttons.R2.SetState(false)
|
||
controller.Axes.R2.SetState(0)
|
||
controller.Buttons.RS.SetState(false)
|
||
controller.Axes.RX.SetState(50)
|
||
controller.Axes.RY.SetState(50)
|
||
controller.Buttons.LS.SetState(false)
|
||
controller.Axes.LX.SetState(50)
|
||
controller.Axes.LY.SetState(50)
|
||
controller.Dpad.SetState("None")
|
||
return
|
||
|
||
ResetRace:
|
||
|
||
|
||
|
||
SB_SetText(" - RESET INITIATED -",2)
|
||
guicontrol,, CurrentLoop, Something went wrong, reseting.
|
||
controller.Axes.LX.SetState(50)
|
||
|
||
if(SaveResetClip)
|
||
{
|
||
FormatTime, TGTime,, MM/dd hh:mm:ss
|
||
FileAppend, %TGTime%: Race failed - Lap %TokyoLapCount% - %location% - Clip saved.`n, log.txt
|
||
url := "https://api.telegram.org/bot" TelegramBotToken "/sendMessage?text=" TGTime ": Race failed - Lap " TokyoLapCount " - " location ". Clip saved.&chat_id=" TelegramChatID
|
||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||
hObject.Open("GET",url)
|
||
hObject.Send()
|
||
SB_SetText(" Saving clip (past 3 minutes)...",2)
|
||
Sleep(500)
|
||
PressShare()
|
||
Sleep(1000)
|
||
Press_Left()
|
||
Sleep(200)
|
||
Press_X()
|
||
Sleep(200)
|
||
Press_X()
|
||
Sleep(200)
|
||
Press_Down()
|
||
Sleep(200)
|
||
Press_Down()
|
||
Sleep(200)
|
||
Press_Down()
|
||
Sleep(200)
|
||
Press_X()
|
||
Sleep(1000)
|
||
PressShare()
|
||
Sleep(1000)
|
||
Press_O()
|
||
Sleep(200)
|
||
Press_Right()
|
||
Sleep(200)
|
||
Press_X()
|
||
}
|
||
else {
|
||
FormatTime, TGTime,, MM/dd hh:mm:ss
|
||
FileAppend, %TGTime%: Race failed - Lap %TokyoLapCount% - %location%.`n, log.txt
|
||
url := "https://api.telegram.org/bot" TelegramBotToken "/sendMessage?text=" TGTime ": Race failed - Lap " TokyoLapCount " - " location ". Clip saved.&chat_id=" TelegramChatID
|
||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||
hObject.Open("GET",url)
|
||
hObject.Send()
|
||
SB_SetText(" Saving clip (past 3 minutes)...",2)
|
||
Sleep(500)
|
||
Press_Options()
|
||
Sleep(1000)
|
||
Press_Right()
|
||
Sleep(500)
|
||
Press_X()
|
||
}
|
||
controller.Axes.LX.SetState(65)
|
||
IniRead, ResetCounterTotal, config.ini, Stats, resetcountertotal, 0
|
||
SetFormat, integerfast, d
|
||
resetcounter++
|
||
resetcountertotal++
|
||
IniWrite, %resetcountertotal%, config.ini,Stats, ResetCounterTotal
|
||
guicontrol,, ResetCounterTotal, Races failed: %resetcountertotal%
|
||
guicontrol,, ResetCounterSession, Races failed: %resetcounter%
|
||
guicontrol,, RaceProgress, 0
|
||
Race_Tokyo()
|
||
return
|
||
|
||
|
||
MouseHelp:
|
||
|
||
coord=relative
|
||
sleep, 1000
|
||
CoordMode, ToolTip, %coord%
|
||
CoordMode, Pixel, %coord%
|
||
CoordMode, Mouse, %coord%
|
||
CoordMode, Caret, %coord%
|
||
CoordMode, Menu, %coord%
|
||
return
|
||
|
||
Refresh:
|
||
MouseGetPos, x, y
|
||
PixelGetColor, cBGR, %x%, %y%,, Alt RGB
|
||
WinGetPos,,, w, h, A
|
||
ToolTip,Location: %x% x %y%`nRGB: %cBGR%`nWindow Size: %w% x %h%
|
||
return
|
||
|
||
MouseColor:
|
||
gosub, MouseHelp
|
||
SetTimer, Refresh, 75
|
||
return
|
||
|
||
GuiClose:
|
||
gosub, PauseLoop
|
||
ExitApp
|
||
^Esc::ExitApp
|
||
|
||
GUIReset:
|
||
if (GetKeyState("LShift", "P") AND GetKeyState("LAlt", "P")){
|
||
MsgBox, 4,, Reset all data?
|
||
IfMsgBox Yes
|
||
{
|
||
IniWrite, 0, config.ini,Stats, RaceCounterTotal
|
||
IniWrite, 0, config.ini,Stats, ResetCounterTotal
|
||
}
|
||
}
|
||
Sleep(500)
|
||
gosub, PauseLoop
|
||
Reload
|
||
|
||
|
||
|
||
|
||
|