[Solved]Option to disable side sprites?
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.
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.
[Solved]Option to disable side sprites?
How would someone go about adding a 'disable side spite' option to their game?
I'm thinking a toggle button that changes a boolean variable True/False, but how would I check against that variable?
I'm thinking a toggle button that changes a boolean variable True/False, but how would I check against that variable?
Last edited by Vodka on Fri Apr 26, 2019 6:14 pm, edited 2 times in total.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Option to disable side sprites?
Such a variable already exists, its found in the say screen.
A button with the action ToggleScreenVariable("var"), or ToggleVariable("var"), where var is the name of the variable that controls the side image, should do the trick.
A button with the action ToggleScreenVariable("var"), or ToggleVariable("var"), where var is the name of the variable that controls the side image, should do the trick.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Option to disable side sprites?
I'll give that a shot, thank you.
Re: Option to disable side sprites?
What about this is incorrect?
say screen:
and then in the preferences menu:
It's giving me an error:
I take it my thinking is wrong about how the side image variable is meant to be set up?
say screen:
Code: Select all
screen say(who, what, side_image=None, two_window=False):
... default say code
$ side_image = SideImage()
add side_image xalign 0.04 yalign 1.15
Code: Select all
hotspot (980,418,365,40) action ToggleScreenVariable("side_image")
Code: Select all
KeyError: u'side_image'
Re: Option to disable side sprites?
Double posting to share this:
which i got from https://www.renpy.org/doc/html/side_image.html
If I'm reading this right, I should be able to define a python variable to associate with the side images. However, nothing I've tried seems to work for disabling it.
I will play with this more over the weekend and post an update if I figure it out.
Code: Select all
define e = Character("Eileen", image="eileen")
init python:
config.side_image_tag = "eileen"
If I'm reading this right, I should be able to define a python variable to associate with the side images. However, nothing I've tried seems to work for disabling it.
I will play with this more over the weekend and post an update if I figure it out.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3785
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Option to disable side sprites?
Sorry, after checking the screen, the variable I was thinking of cannot be used how I imagined.
I don't have the time right now, but I'll take a look later at this more thoroughly.
I don't have the time right now, but I'll take a look later at this more thoroughly.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: Option to disable side sprites?
The issue seemed a lot easier at first glance for me. Going back to my original strategy: would it be possible to make image declarations dependent on a global variable? I could set a variable for side sprites in the main script, and then have conditional loading of images (or declaration of characters) to disable it.
Re: Option to disable side sprites?
Okay, finally had some time to work on this and I got it.
In the Say screen:
This means the side image is only displayed if the variable is True.
And then in the script, before declaring characters:
We set the variable to be true by default. And then lastly in the options menu:
The only problem with this is that the game will reset the variable to True on startup, due to that second definition. Is there any way to store this variable in persistent data, and then check if it exists before setting it to True in script.py? That's really the only thing left to do with it.
In the Say screen:
Code: Select all
screen say(who, what, side_image=side_image, two_window=False)
...
if side_image == True:
add SideImage() xalign 0.04 yalign 1.15
And then in the script, before declaring characters:
Code: Select all
side_image = True
Code: Select all
hotspot (980,418,365,40) action SetVariable("side_image", False)
Re: Option to disable side sprites?
Turns out it was as easy as making the variable persistent.side_image and changing the option's action to ToggleVariable
Marking this solved!
Marking this solved!
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot]