conditional statements and dating sim structure

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
User avatar
REDREDSWAP
Newbie
Posts: 15
Joined: Sat Jun 23, 2018 9:49 am
Projects: Road to Hinata
Location: Canada
Contact:

conditional statements and dating sim structure

#1 Post by REDREDSWAP » Thu Mar 07, 2019 11:41 pm

i'm having trouble using if statements (or something else more suitable) to queue conditional events correctly in my game.

to give context, this is how events in my game are structured. (thanks to philat!!!) -> /viewtopic.php?t=51050

Code: Select all

default city_convo = 0 # use variable to track how  many city conversations have been seen

label start:
    menu schedule:
        "What should I do?"
        "Go on a date":
            pass
        "Walk around the city":
            jump city_convos
        "Go shopping":
            pass

label city_convos:
    $ city_convo += 1 # add to the variable
    jump expression "city_convo" + str(city_convo) # jump to city_convo1, city_convo2, etc.

label city_convo1:
    "First"
    jump schedule # return to loop

label city_convo2:
    "Second"
    jump schedule
    
# and so on and so forth
for example, an afternoon event is to talk to a friend. each conversations are different for each time the player decide to choose that afternoon event in, so they follow a specific order. my features that structure for afternoon and evening events.

what i want to do is. depending on the player's choices, there should be a specific scene at the end of day four after the evening event. thus, having variables day=4 and cominghome=True should jump to the label day4event after the evening event on day.

however, i have no idea on how to queue the day4event after the evening event on day 4. should i program my planner another way, or maybe it can work with if and elif statements placed properly?
ImageImage
no thread yet but will create one soon! looking for a proofreader

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: conditional statements and dating sim structure

#2 Post by philat » Thu Mar 07, 2019 11:44 pm

I mean... what's wrong with

Code: Select all

if day==4 and coming home:
    jump day4event
?

User avatar
REDREDSWAP
Newbie
Posts: 15
Joined: Sat Jun 23, 2018 9:49 am
Projects: Road to Hinata
Location: Canada
Contact:

Re: conditional statements and dating sim structure

#3 Post by REDREDSWAP » Fri Mar 08, 2019 12:00 am

philat wrote:
Thu Mar 07, 2019 11:44 pm
I mean... what's wrong with

Code: Select all

if day==4 and coming home:
    jump day4event
?
oh! however, day4event has to run especially after the evening event (right before day 5) chosen by the player on day 4 (there's three options available). so, it gets a little confusing as to where i should put that part of the code.
ImageImage
no thread yet but will create one soon! looking for a proofreader

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: conditional statements and dating sim structure

#4 Post by philat » Fri Mar 08, 2019 12:08 am

I mean, there are better ways to do it, but like just putting the check after all three events to brute force it or jumping to a check label would both work fine.

Post Reply

Who is online

Users browsing this forum: Google [Bot]