screen four_images():
default picno = 0
fixed:
frame:
xalign 0.5 yalign 1.0
background "{}".format("pic" + str(picno))
label "Scene {}".format(picno + 1):
xalign 0.15 yalign 0.2
textbutton "Next >":
xalign 0.9 yalign 0.2
action SetScreenVariable("picno", (picno + 1) % 4)
textbutton "<Exit>":
xalign 0.9 yalign 0.25
action Return()
label start:
scene black with fade
call screen four_images
"*** THE END ***"
return
picno
- since this logic only needs to work within the screen.picno
variable. (So pic0
, pic1
, pic2
and pic3
... These match 4 images in my /game/images/
folder called pic0.webp, pic1.webp, pic2.webp and pic3.webp.picno
by 1. But I do a bit of extra math using a rarely used arithmetical operator called modulo /
% 4
(modulus 4) to wrap the number back to 0 (zero) when it reaches 4 (four). For more information on modulus/modulo... see
picno
value.Another one that perhaps match more what he had in mind:As with all things RenPy, there are lots of possible solutions.
init python:
# Interface turning the feature On/Off
def multiPov( state ):
# Show the screen if it isn't already the case
if renpy.has_screen( "multiPov" ) is None:
renpy.show_screen( "multiPov" )
# Change the state
store.multiPovFlag = state
# Reset the view
store.PoV = "view0"
# Screen offering the selection
screen multiPov():
# Will only be visible if "multiPov" is True
showif multiPovFlag:
vbox:
textbutton "view 1":
action SetVariable( PoV, "view1" )
textbutton "view 2":
action SetVariable( PoV, "view2" )
textbutton "view 3":
action SetVariable( PoV, "view3" )
# Flag telling if the screen have to be seen or not
default multiPovFlag = False
# Define the image shown
default PoV = "view0"
label whatever:
# Turn the multiPov feature On
$ multiPov( True )
# Ren'Py will display the image located on "images/myMultiView/"
# and named "scene1_" + the content of /PoV/
scene expression "images/myMultiView/scene1_[PoV].jpg"
"blablabla"
"bliblibli"
# Then turn it Off
$ multiPov( False )
PoV
. Therefore, change the value of PoV
(what the screen do), and the image will change accordingly.Hello, i've tried your, but i have an error :Another one that perhaps match more what he had in mind:
For this to works, you need to have four images "images/myMultiView/scene1_view0.jpg", "images/myMultiView/scene1_view1.jpg", "images/myMultiView/scene1_view2.jpg" and "images/myMultiView/scene1_view3.jpg".Python:init python: # Interface turning the feature On/Off def multiPov( state ): # Show the screen if it isn't already the case if renpy.has_screen( "multiPov" ) is None: renpy.show_screen( "multiPov" ) # Change the state store.multiPov = state # Reset the view store.PoV = "view0" # Screen offering the selection screen multiPov(): # Will only be visible if "multiPov" is True showif multiPov: vbox: textbutton "view 1": action SetVariable( PoV, "view1" ) textbutton "view 2": action SetVariable( PoV, "view2" ) textbutton "view 3": action SetVariable( PoV, "view3" ) # Flag telling if the screen have to be seen or not default multiPov = False # Define the image shown default PoV = "view0" label whatever: # Turn the multiPov feature On $ multiPov( True ) # Ren'Py will display the image located on "images/myMultiView/" # and named "scene1_" + the content of /PoV/ scene expression "images/myMultiView/scene1_[PoV].jpg" "blablabla" "bliblibli" # Then turn it Off $ multiPov( False )
The whole thing rely on Ren'Py dynamism. As long as the scene is not replaced, Ren'Py will regularly update it accordingly to the value ofPoV
. Therefore, change the value ofPoV
(what the screen do), and the image will change accordingly.
I believe that it's more on the spirit of the intent behind the question, since it don't stop the progress of the game. The player will be able to pass through all the different view without even having to pass the current dialog line. As it can pass multiple dialog line before changing again the point of view.
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 1933, in script
$ multiPov(True)
File "game/script.rpy", line 1933, in <module>
$ multiPov(True)
TypeError: 'bool' object is not callable
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 1933, in script
$ multiPov(True)
File "renpy/ast.py", line 928, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "renpy/python.py", line 2245, in py_exec_bytecode
exec(bytecode, globals, locals)
File "game/script.rpy", line 1933, in <module>
$ multiPov(True)
TypeError: 'bool' object is not callable
Thank for the adding.As Anne points out, my solution only shows these images.
I wasn't really thinking about the story continuing while the images (and buttons) are in the background.
You don't have permission to view the spoiler content. Log in or register now.
As always here on F95... Anne will generally have the better technical answer. My answer will "probably" work, but tends to be simpler or be less flexible.
Use whichever answer where you can understand the code for. If you understand both... use Anne's. It's always better to not do something than try to copy/paste code you don't understand - since YOU might need to change it again in the future.
Oops, my bad. I wrote it on the fly, between two beers, while looking at the AFC finals, and it wasn't such a great idea ; I use the same name for the function and the flag, what obviously wouldn't works.Hello, i've tried your, but i have an error :
Not always, and not necessarily better technically. I think the main difference is my weirdness ; especially when I past the week writing test suits. After hours having to be rigorous at works, thinking outside of the box keep the passion living. Therefore, your answer tend to be more academical, and mine sometimes totally crazy.As always here on F95... Anne will generally have the better technical answer. My answer will "probably" work, but tends to be simpler or be less flexible.
Well, now that I edited the typo, yeah, why notIf you understand both... use Anne's.