While 1
If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then
_SoundPlay($sound, 0)
EndIf
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $quitButton
ExitLoop
Case $saveCmlLineParamsButton
$cmdLineParams = GUICtrlRead ($cmdLineInput)
If IniWrite(@ScriptDir & "\" & $iniFile, $defaultIniSection, $defaultIniKey, $cmdLineParams) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
Case $EngineSelectCombo
$EngineSelected = GUICtrlRead($EngineSelectCombo)
If $EngineSelected = "Select your engine" Then
$EngineSelected = "RomeTW.exe"
EndIf
IniWrite(@ScriptDir & "\" & $iniFile, $defaultIniSection, "Engine", $EngineSelected)
; $iniFile, $defaultIniSection, $EngineIniKey, $defaultEngine
If IniWrite(@ScriptDir & "\" & $iniFile, $defaultIniSection, $EngineIniKey, $EngineSelected) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
; MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
Case $FactionSelectCombo
$FactionSelected = GUICtrlRead($FactionSelectCombo)
$EngineSelected = GUICtrlRead($EngineSelectCombo)
If $EngineSelected = "Select your engine" Then
$EngineSelected = "RomeTW.exe"
EndIf
IniWrite(@ScriptDir & "\" & $iniFile, $defaultIniSection, "Faction", $FactionSelected)
; $iniFile, $defaultIniSection, $EngineIniKey, $defaultEngine
If IniWrite(@ScriptDir & "\" & $iniFile, $defaultIniSection, $FactionIniKey, $FactionSelected) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
; MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
_FactionSelected()
Case $maprwm
_DeleteMapRwm()
MsgBox(4096, "RS II - message", "All RS II map.rwm files have been removed.", 12)
Case $SteamButton
$Steam = MsgBox(4, "Steam?", "Do you use the Steam version of Rome Total War?")
If $Steam = 6 Then
IniWrite(@ScriptDir & "\launcher.ini", $defaultIniSection, "SteamLaunch", "Yes")
GUICtrlSetData( $SteamButton, "Steam: YES" )
_BISteam()
Elseif $Steam = 7 Then
IniWrite(@ScriptDir & "\launcher.ini", $defaultIniSection, "SteamLaunch", "No")
GUICtrlSetData( $SteamButton, "Steam: NO" )
Endif
Case $playRSIIButton
$EngineSelected = GUICtrlRead($EngineSelectCombo)
If $EngineSelected = "Select your engine" Then
$EngineSelected = "RomeTW.exe"
EndIf
; $iniFile, $defaultIniSection, $EngineIniKey, $defaultEngine
If IniWrite(@ScriptDir & "\" & $iniFile, $defaultIniSection, $FactionIniKey, $FactionSelected) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
; MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
; $iniFile, $defaultIniSection, $EngineIniKey, $defaultEngine
If IniWrite(@ScriptDir & "\" & $iniFile, $defaultIniSection, $EngineIniKey, $EngineSelected) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
; MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
If $Check = 0 Then
$YesNo = MsgBox(4,"Ready?", "Are you ready to play multiplayer?")
$Check = 1
Else
$YesNo = MsgBox(4,"Really ready?", "Are you really sure you're good enough?")
EndIf
If $YesNo = 6 Then
_FactionSelected()
$SteamIni = Iniread (@ScriptDir & "\launcher.ini", $defaultIniSection, "SteamLaunch", "0")
If $SteamIni = "No" Then
If FileExists($EngineSelected) Then
If $SVNActive = 1 Then
If $CurrentRevision = $PreviousRevision Then
Else
_DeleteMapRwm()
EndIf
Else
EndIf
Run($EngineSelected & " " & $FactionSelected & " " & $cmdLineParams)
_SoundClose($sound)
_SoundPlay($sound2, 1)
;Sleep(2000)
ExitLoop
Else
Global $ErrorMsg1 = "You don't have Roma Surrectum II installed in the correct folder. (" & $GameDir & ")"
Global $ErrorMsg2 = "Engine: " & $EngineSelected & ", Faction campaign: " & $FactionSelected
Global $ErrorMsg3 = "In total: '" & $EngineSelected & " " & $FactionSelected & $cmdLineParams & "'"
MsgBox(4096,"RS II - error", "If you get this error, then you've probably done something wrong. Please report the next three messages.")
MsgBox(4096,"RS II - error 1/3", $ErrorMsg1)
MsgBox(4096,"RS II - error 2/3", $ErrorMsg2)
MsgBox(4096,"RS II - error 3/3", $ErrorMsg3)
If IniWrite(@ScriptDir & "\" & $ErrorIni, $defaultErrorSection, $DefaultErrorReport1, $ErrorMsg1) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
; MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
If IniWrite(@ScriptDir & "\" & $ErrorIni, $defaultErrorSection, $DefaultErrorReport2, $ErrorMsg2) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
; MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
If IniWrite(@ScriptDir & "\" & $ErrorIni, $defaultErrorSection, $DefaultErrorReport3, $ErrorMsg3) == 0 Then
MsgBox(BitOr(4096, 16), "Could not write to " & $iniFile, 12)
Else
; MsgBox(4096, "RS II - message", "The changes have been saved. You can now start all RS II campaigns with your new options.", 12)
EndIf
$Check = 0
EndIf
ElseIf $SteamIni = "Yes" Then
If FileExists($EngineSelected) Then
If $SVNActive = 1 Then
If $CurrentRevision = $PreviousRevision Then
Else
_DeleteMapRwm()
EndIf
EndIf
EndIf
EndSwitch
WEnd