From e5c5b6fbe932496f950a8781f664f744ddf44720 Mon Sep 17 00:00:00 2001 From: nutbuster Date: Sun, 8 Aug 2021 07:11:24 +1000 Subject: [PATCH] standardize and minify py-related functions also includes transitions fix --- game/screens.rpy | 99 +++++++++++++++--------------------------------- 1 file changed, 31 insertions(+), 68 deletions(-) diff --git a/game/screens.rpy b/game/screens.rpy index 6be62fb..0953cd2 100644 --- a/game/screens.rpy +++ b/game/screens.rpy @@ -1,80 +1,44 @@ ###Updater Python stuff### init python: - if renpy.variant("pc"): #Don't run this on mobile, not supported - if persistent.updateresult is None: - persistent.updateresult = "No new version is available" - if persistent.autoup is None: - persistent.autoup = False - if persistent.updateWebServer is None: - persistent.updateWebServer = "http://updates.snootgame.xyz/updates.json" + if renpy.variant("pc"): #Don't run this on mobile, not supported + if persistent.updateresult is None: + persistent.updateresult = "No new version is available" + if persistent.autoup is None: + persistent.autoup = False + if persistent.updateWebServer is None: + persistent.updateWebServer = "http://updates.snootgame.xyz/updates.json" - def UpdateCheck(): - # WHY YES I ONLY ALLOW PEOPLE USING MY FRAMEWORK TO CHECK FOR AN UPDATE EVERY SIX FUCKING HOURS HOW DID YOU KNOW - # NOPE check_interval=5 (5 SECONDS) FUCK YOU - pendingVersion = updater.UpdateVersion(persistent.updateWebServer, check_interval=5) - if pendingVersion == None or pendingVersion == config.version or "TEST" in pendingVersion: - persistent.updateresult = "No new version is available" - else: - persistent.updateresult = pendingVersion + def UpdateCheck(): +# WHY YES I ONLY ALLOW PEOPLE USING MY FRAMEWORK TO CHECK FOR AN UPDATE EVERY SIX FUCKING HOURS HOW DID YOU KNOW +# NOPE check_interval=5 (5 SECONDS) FUCK YOU + pendingVersion = updater.UpdateVersion(persistent.updateWebServer, check_interval=5) + if pendingVersion == None or pendingVersion == config.version or "TEST" in pendingVersion: + persistent.updateresult = "No new version is available" + else: + persistent.updateresult = pendingVersion #idk non-functional dummies for uisounds hackery #coming soon - def ToggleAutoUpdate(): - if persistent.autoup == True: - renpy.play("audio/ui/uiOptionOff.wav") - else: - renpy.play("audio/ui/uiOptionOn.wav") - persistent.autoup = not persistent.autoup + def onclick_audio(flag, audio_filename=["audio/ui/uiOptionOff.wav", "audio/ui/uiOptionOff.wav", "audio/ui/uiOptionOff.wav"]): + renpy.play(audio_filename[int(flag)]) - def ToggleLewd(): - if persistent.lewd == True: - renpy.play("audio/ui/uiOptionOff.wav") - else: - renpy.play("audio/ui/uiOptionOn.wav") -# persistent.lewd = not persistent.lewd + def ToggleAutoUpdate(): + onclick_audio(persistent.autoup) + preferences.autoup = not preferences.autoup - def ToggleScroll(): - if persistent.scroll == True: - renpy.play("audio/ui/uiOptionOff.wav") - else: - renpy.play("audio/ui/uiOptionOn.wav") -# persistent.scroll = not persistent.scroll + def ToggleAutoForwardMove(): + onclick_audio(persistent.afm_enable) + preferences.afm_enable = not preferences.afm_enable - def ToggleSkip(): - if preferences.skip_unseen == True: - renpy.play("audio/ui/uiOptionOff.wav") - else: - renpy.play("audio/ui/uiOptionOn.wav") -# preferences.skip_unseen = not preferences.skip_unseen - - def ToggleAfterChoices(): - if preferences.skip_after_choices == True: - renpy.play("audio/ui/uiOptionOff.wav") - else: - renpy.play("audio/ui/uiOptionOn.wav") -# preferences.skip_after_choices = not preferences.skip_after_choices - - def ToggleTransitions(): - if preferences.transitions == True: - renpy.play("audio/ui/uiOptionOff.wav") - else: - renpy.play("audio/ui/uiOptionOn.wav") -# preferences.transitions = not preferences.transitions # def ToggleMuteAll(): -# if preferences.all_mute == True: +# if preferences.all_mute == True: # renpy.play("audio/ui/uiOptionOff.wav") -# else: +# else: # renpy.play("audio/ui/uiOptionOn.wav") # preferences.all_mute = not preferences.all_mute - def ToggleAutoForwardMove(): - if preferences.afm_enable == True: - renpy.play("audio/ui/uiOptionOff.wav") - else: - renpy.play("audio/ui/uiOptionOn.wav") - preferences.afm_enable = not preferences.afm_enable ################################################################################ ## Initialization @@ -308,7 +272,7 @@ style choice_vbox: style choice_button is default: properties gui.button_properties("choice_button") activate_sound "audio/ui/uiRollover.wav" - + style choice_button_text is default: properties gui.button_text_properties("choice_button") @@ -941,20 +905,19 @@ screen preferences(): vbox: style_prefix "check" label _("Naughty Stuff") - textbutton _("Enable Lewd Images") action [Function(ToggleLewd), ToggleVariable("persistent.lewd", True, False)] + textbutton _("Enable Lewd Images") action [Function(onclick_audio, persistent.lewd), ToggleVariable("persistent.lewd", True, False)] vbox: style_prefix "check" label _("Requires Restart") - textbutton _("Enable Forward-Scroll Movement") action [Function(ToggleScroll), ToggleVariable("persistent.scroll", True, False)] - + textbutton _("Enable Forward-Scroll Movement") action [Function(onclick_audio, persistent.scroll), ToggleVariable("persistent.scroll", True, False)] vbox: style_prefix "check" label _("Skip") - textbutton _("Unseen Text") action [Function(ToggleSkip), ToggleVariable("preferences.skip_unseen", True, False)] - textbutton _("After Choices") action [Function(ToggleAfterChoices), ToggleVariable("preferences.skip_after_choices", True, False)] - textbutton _("Transitions") action [InvertSelected(Function(ToggleTransitions)), ToggleVariable("preferences.transitions", True, False)] + textbutton _("Unseen Text") action [Function(onclick_audio, preferences.skip_unseen), ToggleVariable("preferences.skip_unseen", True, False)] + textbutton _("After Choices") action [Function(onclick_audio, preferences.skip_after_choices), ToggleVariable("preferences.skip_after_choices", True, False)] + textbutton _("Transitions") action [Function(onclick_audio, preferences.transitions), ToggleVariable("preferences.transitions", 0, 2)] ## Additional vboxes of type "radio_pref" or "check_pref" can be ## added here, to add additional creator-defined preferences.