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.
Let's say I have 3 different variables for controlling if 3 different events are done in the game. If I want to check how many of those done at the end, how do I do that? If there are 50 events I'm tracking it's gonna be really hard to keep track of 50 different variables I guess. I know this is a really simple question but I just couldn't come up with a solution so thanks in advance.
Now we can make a function that returns how many events are completed or how many events are completed for a particular character (we can do it, for example, if all events with character alice has "alice" in event name: like "alice_journey", "alice_party".
init python:
def event_counter(char_name = ""):
sum = 0
for key, value in store.events.items():
if char_name in key and value != False:
sum += 1
return sum
In similar manner we can check for more complex story progress. You can also use numbers in the dictionaries to unite a chain of events.
then you can just check the number of events using len(events). You would then also replace checks like "alice_journey_done == True" with " 'alice_journey' in events", if you ever need to check if a specific event has been done.