How to add an option to preferences?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
SodaPopPanda
Newbie
Posts: 2
Joined: Tue Dec 04, 2018 5:25 am
Contact:

Re: How to add an option to preferences?

#16 Post by SodaPopPanda »

So I've been going back and forth from this thread to some quick tutorials I've seen and I'm trying to set up the preferences so that when you're given the in game option "Sexual Content: Yes or No" and "Gore: Yes or No" your choice automatically toggles or untoggles the default setting of having Sex off or Gore off

Code: Select all

define persistent.sexualcontent = False
define persistent.gore = False
screen startgame():
    vbox xalign 0.1 yalign 0.1:
        style_prefix "radio"
        spacing 10

        label _("sexual content")
        textbutton _("Yes") xalign 0.33 yalign 0.5 action SetPreference :=
            "Stuff to Avoid"(persistent,"sexualcontent", "yes")
        textbutton _("No") xalign 0.33 yalign 0.5 action SetPreference :=
            "Stuff to Avoid"(persistent,"sexualcontent",  "no")

    vbox xalign 0.5 yalign 0.1:
        style_prefix "radio"
        spacing 10
        label _("gore")
        textbutton _("Yes") xalign 0.33 yalign 0.5 action SetPreference(persistent,"gore", "yes")
        textbutton _("No") xalign 0.33 yalign 0.5 action SetPreference(persistent,"gore", "no")


    textbutton _("Time to wake up.") xalign 0.5 yalign 0.5 action Return(value=_return)
That's the script I'm trying to fix within screens

Code: Select all

vbox:
                    style_prefix "check"
                    label _("Stuff to avoid")
                    textbutton _("Sexual Content") action Preference(persistent,"sexualcontent", "no")
                    textbutton _("Gore") action Preference(persistent,"gore", "no")
This is the scripting within screens under preferences
that I'm trying to make functional and relevant to the variable I originally had set up like this below

Code: Select all

#enter script anywhere 
$ sexualcontent = "no"
$ gore = "no"
call screen startgame

#enter code below in screens.rpy
screen startgame():
    vbox:
        style_prefix "radio"
        label _("sexual content")
        textbutton _("Yes") SetVarible("sexualcontent", "yes")
        textbutton _("No") SetVariable("sexualcontent",  "no")
vbox:
        style_prefix "radio"
        label _("gore")
        textbutton _("Yes") SetVarible("gore", "yes")
        textbutton _("No") SetVariable("gore",  "no")


    textbutton _("Time to wake up.") action Return(value=_return)
Please let there be someone out there who can help me I really don't want to keep bothering this artist I like or copy them just from what I see in their tutorials
I'm trying really hard to get this coding thing down on my own I get basic concepts in my head but executing them seems to be the struggle.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]