Code: Select all
screen main_menu():
tag menu
add gui.main_menu_background
add renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"])
Code: Select all
screen main_menu():
tag menu
add gui.main_menu_background
add renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"])
This line of code picks random imageK-PSZH wrote: ↑Sat May 21, 2022 3:46 pm So, I added a randomly choosen image to my screen.But they're changing, when I press Ctrl. Is there a way to disable button in main menu or just fix the problem?Code: Select all
screen main_menu(): tag menu add gui.main_menu_background add renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"])
Code: Select all
add renpy.random.choice(...)
Code: Select all
screen main_menu():
default random_img = None # screen variable
# choose image if not yet
if not random_img:
$ random_img = renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"])
tag menu
add gui.main_menu_background
add random_img
Alex wrote: ↑Sat May 21, 2022 4:16 pm To prevent image change try it likeCode: Select all
screen main_menu(): default random_img = None # screen variable # choose image if not yet if not random_img: random_img = renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"]) tag menu add gui.main_menu_background add random_img
Code: Select all
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/screens.rpy", line 295: u'random_img' is not a keyword argument or valid child for the screen statement.
random_img = renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"])
^
Oops, my fault forgot the $ sign - should beK-PSZH wrote: ↑Sat May 21, 2022 7:02 pmAlex wrote: ↑Sat May 21, 2022 4:16 pm To prevent image change try it likeCode: Select all
screen main_menu(): default random_img = None # screen variable # choose image if not yet if not random_img: random_img = renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"]) tag menu add gui.main_menu_background add random_img
Code: Select all
I'm sorry, but errors were detected in your script. Please correct the errors listed below, and try again. File "game/screens.rpy", line 295: u'random_img' is not a keyword argument or valid child for the screen statement. random_img = renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"]) ^
Code: Select all
$ random_img = renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"])
Worked!Alex wrote: ↑Sat May 21, 2022 7:32 pm Oops, my fault forgot the $ sign - should beCode: Select all
$ random_img = renpy.random.choice(["gui/main_menu/characters/1.png", "gui/main_menu/characters/2.png", "gui/main_menu/characters/3.png"])
Users browsing this forum: Google [Bot], Ocelot