Skip to content

Commit

Permalink
Look for Gog launcher, add an option not to launch anything if pressi…
Browse files Browse the repository at this point in the history
…ng cancel on browse folder dialog.
  • Loading branch information
Piotr Machacz authored and Piotr Machacz committed Jun 17, 2020
1 parent 4556685 commit 03e00f8
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions rts.au3
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,41 @@ EndFunc
HotKeySet("^q", "Quit")
If WinExists("Slay the Spire")=0 then;Launch the MTS launcher
$MTSDir=FileRead("MTSDir.txt")
If @error then ;Look for the file in the most common directories
If $MTSDir="" then ;Look for the file in the most common directories
$Dirs=StringSplit("C:\Program Files (x86)\Steam\steamapps\common\SlayTheSpire\|D:\Program Files (x86)\Steam\steamapps\common\SlayTheSpire\", "|", 2)
For $i=0 to UBound($dirs)-1 step 1
;Msgbox(0, "checking", $Dirs[$i3])
;Msgbox(0, "checking", $Dirs[$i])
If FileExists($dirs[$i] & "mts-launcher.jar") then
$MTSDir=$Dirs[$i]
;msgBox(64, "Success", $Dirs[$i])
ExitLoop
EndIf
Next
If $MTSDir="" then $MTSDir=FileSelectFolder("Browse to Slay the Spire installation folder", "")
If @error then exit
FileWrite("MTSDir.txt", $MTSDir)
If @error then
$NoLaunch=Msgbox(32+4, "Question", "Would you like to make ReadTheSpire not start MTS-launcher at startup?")
If $NoLaunch=6 then ;yes
$MTSDir="none"
MsgBox(64, "Done", "If you later want to specify the location of MTS-launcher, delete MTSDir.txt located in the ReadTheSpire folder.")
else ;no
exit
EndIf
EndIf;Looks for MTS-launcher.jar
FileWrite("MTSDir.txt", $MTSDir)
If $MTSDir <>"none" then
FileChangeDir($MTSDir)
If FileExists("moddespire.jar") then
ShellExecute("moddespire.jar");For Gog version
else
ShellExecute("mts-launcher.jar")
EndIf
speak("MTS Launcher started, waiting for game to start")
else
speak("ReadTheSpire ready, waiting for you to start the game.")
EndIf
EndIf


do
sleep(250)
until WinExists("Slay the Spire")
Expand Down

0 comments on commit 03e00f8

Please sign in to comment.