List available scenes with tags

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.
Post Reply
Message
Author
tkolev
Newbie
Posts: 5
Joined: Mon Jul 16, 2018 10:50 am
Contact:

List available scenes with tags

#1 Post by tkolev »

Is there a way to list all available images by supplying the name and a list of tags? E.g. I have a scene with a building and people walking around in daytime - "building busy day.png" and I want to add another one e.g. "building busy day 2.png", so when I list the name = "building", tag_list=["busy", "day"], I will get ["building busy day", "building busy day 2"] so I can then choose (randomly) what to show. The issue is that I don't know which location/tag combinations will have more than one image, so I can't have it "hardcoded" in the game.

P.S. I tried searching in the forum for similar questions, but it keeps returning HTTP500 error and Google search doesn't come up with an answer.

User avatar
Kia
Eileen-Class Veteran
Posts: 1039
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: List available scenes with tags

#2 Post by Kia »

if you add all of your images to a list you can get the length of that list with code

Code: Select all

default images_list = [
    "bild1.png",
    "bild1.png",
    "bild1.png",
    ]
...

for i in range(len(images_list):
    ...

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Starberries