added an optional feature to recieve automatic updates which include scripts and sounds downloading on demand.

This commit is contained in:
Augustus
2026-02-08 17:29:18 +02:00
parent 326564483a
commit 432c02b616
5 changed files with 208 additions and 36 deletions

View File

@@ -39,3 +39,14 @@ ActualSave; #say {Settings saved!};
#alias makeworse {#Configure PassThruChar {~>}; #Configure SwitchSession {~:}; #passthru {•}} #alias makeworse {#Configure PassThruChar {~>}; #Configure SwitchSession {~:}; #passthru {•}}
#alias makebetter {#Configure PassThruChar {~•}; #Configure SwitchSession {~•}; #passthru {%<;>{}#"'}} #alias makebetter {#Configure PassThruChar {~•}; #Configure SwitchSession {~•}; #passthru {%<;>{}#"'}}
#alias rawinput {#if {@rawpass = "enabled"} {#var rawpass "disabled"; makeworse; #say {Raw input mode is now disabled.};#play {@sppath/general/misc/off.wav} @vol} {#var rawpass "enabled"; makebetter; #say {Raw input mode is now enabled.};#play {@sppath/general/misc/on.wav} @vol}} #alias rawinput {#if {@rawpass = "enabled"} {#var rawpass "disabled"; makeworse; #say {Raw input mode is now disabled.};#play {@sppath/general/misc/off.wav} @vol} {#var rawpass "enabled"; makebetter; #say {Raw input mode is now enabled.};#play {@sppath/general/misc/on.wav} @vol}}
#alias {AutomaticUpdate} {#if {@AutomaticUpdate="enabled"} {
#var AutomaticUpdate "disabled";
#play {@sppath/general/misc/off.wav} @vol;
#say {Automatic updates will no longer be applied to your soundpack.};
} {
#var AutomaticUpdate "enabled";
#play {@sppath/general/misc/on.wav} @vol;
#say {Updates will now automaticly be applied to your soundpack.};
}
}

View File

@@ -67,7 +67,6 @@
#key {control-f1} {smute} #key {control-f1} {smute}
#key {alt-\} {rawinput} #key {alt-\} {rawinput}
#key {control-`} {#if {@commandsinoutput="enabled"} {#var commandsinoutput "disabled";#Configure DisplayCommandsInOutput False;#say {commands will no longer be displayed in the output window.}} {#var commandsinoutput "enabled";#Configure DisplayCommandsInOutput true;#say {Commands will now be displayed in the output window.}}} #key {control-`} {#if {@commandsinoutput="enabled"} {#var commandsinoutput "disabled";#Configure DisplayCommandsInOutput False;#say {commands will no longer be displayed in the output window.}} {#var commandsinoutput "enabled";#Configure DisplayCommandsInOutput true;#say {Commands will now be displayed in the output window.}}}
#key {alt-control-v} {checkforupdates}
#key {alt-v} {%clipboard} #key {alt-v} {%clipboard}
#key {shift-f4} { #key {shift-f4} {
#if {@devmode = "disabled"} { #if {@devmode = "disabled"} {
@@ -84,3 +83,5 @@
#key {alt-f1} {decimalpick} #key {alt-f1} {decimalpick}
#key {alt-n} {gagconfig} #key {alt-n} {gagconfig}
#key {alt-enter} {#if {@numpadon="disabled"} {#var numpadon "enabled" ; #load {@scpath/numpad.set} ; #play {@sppath/general/misc/on.wav} @vol;#say {Numpad movement enabled.} VoiceOnly} {#var numpadon "disabled" ; #unload {@scpath/numpad.set} ; #play {@sppath/general/misc/off.wav} @vol;#say {Numpad movement disabled} VoiceOnly}} #key {alt-enter} {#if {@numpadon="disabled"} {#var numpadon "enabled" ; #load {@scpath/numpad.set} ; #play {@sppath/general/misc/on.wav} @vol;#say {Numpad movement enabled.} VoiceOnly} {#var numpadon "disabled" ; #unload {@scpath/numpad.set} ; #play {@sppath/general/misc/off.wav} @vol;#say {Numpad movement disabled} VoiceOnly}}
#key {alt-shift-v} {%replace(%clipboard,%crlf,%chr(32))}
#key {alt-control-v} {AutomaticUpdate}

View File

@@ -1,11 +1,9 @@
;core variables ;core variables
#var clientversion 13 #var clientversion 15
#var loadtask {soundpack|keys|aliases|updator|misc|gagcreator|pathupdator}
#var settings {rawpass|miscgags|shipgags|vehiclegags|activitygags|intromusic|vol|commandsinoutput|devmode|decchar|numpadon} #var settings {rawpass|miscgags|shipgags|vehiclegags|activitygags|intromusic|vol|commandsinoutput|devmode|decchar|numpadon|AutomaticUpdate}
#var speech "disabled" #var speech "disabled"
#if {%volume<100} {#pc 0 volume 100} #if {%volume<100} {#pc 0 volume 100}
;Initialising the script files
#ForAll @loadtask {#load {@scpath/%i.set}}
;Reading and writing Settings. ;Reading and writing Settings.
#File 6 {settings.set} 1 #File 6 {settings.set} 1
#var num 1 #var num 1
@@ -14,17 +12,26 @@
#math num {@num + 1}}; #math num {@num + 1}};
#close 6 #close 6
#Load {@scpath/aliases.set};
#alarm 0.500 {#load {@scpath/keys.set}};
#alarm 0.75 {#load {@scpath/updator.set}};
#alarm 1 {#load {@scpath/soundpack.set}};
#alarm 2 {#load {@scpath/misc.set}};
#alarm 2.3 {#load {@scpath/gagcreator.set}};
#alarm 3 {#load {@scpath/pathupdator.set}};
#trigger {Welcome to: cosmic rage!} { #trigger {Welcome to: cosmic rage!} {
#if {@intromusic = "enabled"} { #if {@intromusic = "enabled"} {
#if {@IntroPlaying = 1} {#pc @introhandle stop;#var IntroPlaying 0}; #if {@IntroPlaying = 1} {#pc @introhandle stop;#var IntroPlaying 0};
#playloop {@sppath/music/IntroMusic/DefaultIntro.wav} @vol; #var introhandle %playhandle; #var IntroPlaying 1}} {} AnyCase #playloop {@sppath/music/IntroMusic/DefaultIntro.wav} @vol; #var introhandle %playhandle; #var IntroPlaying 1}} {} AnyCase
#TRIGGER {synaptic signal verified. Sleep mode disengaged. Welcome back to Cosmic Rage!} {#if {@IntroPlaying = 1} {#pc @introhandle stop; #var IntroPlaying 0}; ~@sp-register vip;~@sp-version} #TRIGGER {synaptic signal verified. Sleep mode disengaged. Welcome back to Cosmic Rage!} {#if {@IntroPlaying = 1} {#pc @introhandle stop; #var IntroPlaying 0}; ~@sp-register vip;~@sp-version}
#trigger {Your synaptic signal wavers for a moment, then returns with a snap!} {#if {@IntroPlaying = 1} {#pc @introhandle stop; #var IntroPlaying 0}; ~@sp-register vip;~@sp-version} #trigger {Your synaptic signal wavers for a moment, then returns with a snap!} {#if {@IntroPlaying = 1} {#pc @introhandle stop; #var IntroPlaying 0}; ~@sp-register vip;~@sp-version}
#if {@rawpass = "enabled"} {makebetter} #if {@rawpass = "enabled"} {makebetter};
#if {@activitygags = "enabled"} {#load {gags/activitygags.set}} #if {@activitygags = "enabled"} {#load {gags/activitygags.set}};
#if {@vehiclegags = "enabled"} {#load {gags/vehiclegags.set}} #if {@vehiclegags = "enabled"} {#load {gags/vehiclegags.set}};
#if {@shipgags = "enabled"} {#load {gags/shipgags.set}} #if {@shipgags = "enabled"} {#load {gags/shipgags.set}};
#if {@miscgags = "enabled"} {#load {gags/miscgags.set}} #if {@miscgags = "enabled"} {#load {gags/miscgags.set}};
#if {@devmode="enabled"} {#load {@scpath/dev.set}} #if {@devmode="enabled"} {#load {@scpath/dev.set}};
#if {%defined(decchar)=0 or %length(@decchar)<1} {#var decchar .} #if {%defined(decchar)=0 or %length(@decchar)<1} {#var decchar .};
#If {@numpadon="enabled"} {#load @scpath/numpad.set} #If {@numpadon="enabled"} {#load @scpath/numpad.set};
#if {@commandsinoutput="enabled"} {#Configure DisplayCommandsInOutput true} {#Configure DisplayCommandsInOutput false};

View File

@@ -11,5 +11,7 @@
#if {@pitch <> "na"} {#pc %var(@id) frequency @pitch} #if {@pitch <> "na"} {#pc %var(@id) frequency @pitch}
}}; }};
#gagline all; #gagline all;
#if {%playhandle=0} {#SetSpeech system stop;#say {Failed to play @soundpath.}}} #if {%playhandle=0} {#SetSpeech system stop;#say {Failed to play @soundpath.};
#var faildsound {$sphook @action:@soundpath:@volume:@pitch:@pan:@id};
#if {@AutomaticUpdate="enabled"} {FetchSound @soundpath}}}
#trig {$buffer *} {#gagline all; #say %1 voiceonly} #trig {$buffer *} {#gagline all; #say %1 voiceonly}

View File

@@ -1,19 +1,170 @@
#var rightofpath {%replace(@scpath,\,|)} ; Initialize variables if they don't exist
#var rightofpath %ReverseList(@rightofpath) #if {%defined(ClientVersion)=0} {#var ClientVersion 0}
#var rightofpath %pop(rightofpath) #if {%defined(AutomaticUpdate)=0} {#var AutomaticUpdate "disabled"}
#load {@sppath/version.set};#unload {@sppath/version.set} #var SoundStatus {}
#trigger {$soundpack &client last version: &remoteversion} { #var SoundStatusPrev {}
#gagline all; #var SyncUpdatePending 0
#if {%IfWord(@client,vip,"|")} {#var remoteclientversion @remoteversion;#alarm 2 {checkclientversion}} {#var remotesoundsversion @remoteversion;#alarm 4 {checksoundsversion}}} #file 4 sound_status.txt;
#alias checksoundsversion { #write 4 { };
#math soundscondition {@remotesoundsversion - @SoundsVersion}; #close 4;
#if {@soundscondition>0} {#say {attention! Sound Updates found! Current version: @SoundsVersion. New Version: @remotesoundsversion};#play {@sppath/general/misc/spsave.wav} @vol}; #file 4 sound_error.txt;
#if {@soundscondition>0 or @clientcondition>0} {#say {Hint: To update the soundpack, navigate to %replace(@scpath,@rightofpath,) folder, run the file named updator.bat, and wait until the installation process completes. This will download and apply all available updates automatically.}}} #write 4 { };
#alias checkclientversion { #close 4;
#math clientcondition {@remoteclientversion - @clientversion}; ; Version Checking Triggers
#if {@clientcondition>0} {#say {attention! soundpack script Updates found! Current version: @clientversion. New Version: @remoteclientversion}; #play {@sppath/general/misc/spannouncement.wav} @vol}}
#alias checkforupdates {#if {@updatechecking=1} {#say {I'm Checking for updates already, Please hold on} VoiceOnly;#play {@sppath/general/misc/boop.wav} @vol} { ; Captures lines like: "$soundpack vip last version: 13"
#say {Checking for updates, this will take a few seconds.} VoiceOnly; #trigger {$soundpack &SyncType last version: &SyncVer} {
#var updatechecking 1; #gagline all;
~@sp-version;
#alarm 5 {#if {@soundscondition<1 and @clientcondition<1} {#say {No updates found!};#play {@sppath/general/misc/logoutold.wav} @vol; #unvar updatechecking} {#unvar updatechecking}}}} ; Only check vip version
#if {@SyncType = "vip"} {
#say {Updator: Checking @SyncType version. Local: @ClientVersion, Remote: @SyncVer};
; Check if update needed
#if {@ClientVersion < @SyncVer} {
#say {Updator: Update available for @SyncType.};
#if {@AutomaticUpdate="enabled"} {PerformUpdate}
} {
#say {Updator: @SyncType is up to date.}
}
}
}
; Update Automation
#alias PerformUpdate {
#if {@SyncUpdatePending = 0} {
#var SyncUpdatePending 1;
; Force refresh
#var SoundStatusPrev {};
; Ensure monitor is running
StartSyncMonitor;
#say {Updator: Initiating script update sequence...};
; Step 1: Write command to sound_error.txt
#DelFile {sound_error.txt};
#file 4 sound_error.txt;
#write 4 {update_scripts};
#close 4;
; Step 2: Trigger the external updater
LaunchSoundSync;
#say {Updator: Update request sent to background process.};
; Reset pending flag after a delay
#alarm 30 {#var SyncUpdatePending 0}
} {
#say {Updator: Update already in progress.}
}
}
#alias FetchSound {
#var SoundFile %0;
; Force refresh so we see the status even if unchanged
#var SoundStatusPrev {};
; Ensure monitor is running
StartSyncMonitor;
#say {Updator: Requesting download for: @SoundFile};
#DelFile {sound_error.txt};
#file 4 sound_error.txt;
#write 4 {%RTrim(@SoundFile).wav};
#close 4;
LaunchSoundSync
}
#alias LaunchSoundSync {
#config editor {%homefolder\SoundSync.exe};
#edit sound_error.txt;
#config editor notepad.exe
}
; Sync Monitor Loop
#alias StartSyncMonitor {
#var SoundStatusPrev {};
; Clear existing status file to prevent catching stale "Finished" signals
#DelFile {sound_status.txt};
#file 10 sound_status.txt;
#write 10 { } 1;
#close 10;
#alarm SyncMonitor -0.1 {
CheckSyncStatus
}
}
#alias StopSyncMonitor {
#unalarm SyncMonitor;
}
#alias CheckSyncStatus {
; Read status file using handle 5 (Sequential)
#file 5 sound_status.txt;
#read 5 CurrentStatus;
#close 5;
; Guard against empty reads or EOF
#if {@CurrentStatus = "[EOF]" OR @CurrentStatus = ""} {
; parsing failed or empty, skip this cycle
} {
; Process only if status changed
#if {@CurrentStatus <> @SoundStatusPrev} {
; Update prev status IMMEDIATELY to prevent looping if subsequent commands error out
#var SoundStatusPrev @CurrentStatus;
#var StatusCode {%word(@CurrentStatus,"|",1)};
#var StatusMsg {%word(@CurrentStatus,"|",2)};
; Detailed Notification
#if {%pos("Downloading", "@StatusCode") > 0} {
#say {Updator: Downloading - @StatusMsg}
};
#if {%pos("Downloaded", "@StatusCode") > 0} {
#say {Updator: Completed - @StatusMsg}
};
#if {%pos("Extracting", "@StatusCode") > 0} {
#say {Updator: Extracting - @StatusMsg}
};
#if {%pos("Failed", "@StatusCode") > 0 OR %pos("404", "@StatusCode") > 0 OR %pos("Timeout", "@StatusCode") > 0} {
#say {Updator: Error - @StatusCode: @StatusMsg}
};
#if {%pos("Finished", "@StatusCode") > 0} {
#say {Updator: All downloads finished.};
StopSyncMonitor
};
; Handle specific states
#if {%pos("Downloaded", "@StatusCode") > 0} {
HandleDownloadSuccess @StatusMsg
};
#if {%pos("Failed", "@StatusCode") > 0 OR %pos("404", "@StatusCode") > 0 OR %pos("Timeout", "@StatusCode") > 0} {
#play {@sppath/general/misc/boop.wav} @vol
};
}
}
}
#alias HandleDownloadSuccess {
#var DownloadedFile %0;
; Use %pos for maximum robustness. It ignores spaces and underscores.
; Checking for "Scripts" anywhere in the name.
#if {%pos("Scripts", "@DownloadedFile") > 0} {
#say {Updator: Scripts successfully updated! Reloading...};
#play {@sppath/general/misc/spannouncement.wav} @vol;
#var SyncUpdatePending 0;
spreload
} {
; It's a sound file
#say {Updator: NEW SOUND: @DownloadedFile};
echo @faildsound;
}
}