[Solved] Certain Events Aren't Triggering with my points in the Script

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
CrystalD
Newbie
Posts: 19
Joined: Fri Aug 18, 2017 11:50 pm
Tumblr: CrystalDennisMusic
Skype: valkyrieceles
Soundcloud: crystaldennismusic
Contact:

[Solved] Certain Events Aren't Triggering with my points in the Script

#1 Post by CrystalD »

I'm coding a small game just to get used to renpy, and I'm using 3 sets of points. It's a slice of life short story surrounding a baker starting a new business, and a cat that pesters her and I want certain things to trigger depending on how many points they have. Like I have if you give the cat certain items, the points go up and different things happen that show the cat is attached to the baker, and another is that if the baker has a certain amount of prepared points, a business man comes in and offers them some investment capital, and that sequence of events leads to a meeting with said business man.

The problem I've been having is, I have the points set, and the game runs fine, but those events aren't triggering? Especially the business man showing up: I've tried so many things with that one, like setting a true or false variable, but no matter what I do the same sort of things trigger in the script, and the business man sequence doesn't even show up at all. Here's what I've set in the script for now:

Code: Select all

label start:
$ baking_buffup = 0
$ prepared_points = 0
$ cat_points = 0

label day_2_tally:
if prepared_points >= 2:
    jump business_offer
if cat_points >= 6:
    jump cat_eats_cookie
if cat_points >= 4:
    jump cat_dozing
if cat_points >= 2:
    jump cat_chillin
I've also tried this for the business_offer label:

Code: Select all

label start:
$ make_business_plan = False

label day_2_tally:
    if make_business_plan == True:
        jump business_offer
So yeah, I honestly have no clue what I've done wrong, unless I have to set up where I write the scenes differently? right after I set the points tallies, I write the respective scenes, or do I need to add a different sort of statement to make it work?
Any help would be appreciated!
Last edited by CrystalD on Thu Feb 01, 2018 11:36 pm, edited 1 time in total.

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Certain Events Aren't Triggering with my points in the Script

#2 Post by IrinaLazareva »

Well, if I have correctly understood...
try instead of:

Code: Select all

if cat_points >= 6:
    jump cat_eats_cookie
if cat_points >= 4:
    jump cat_dozing
if cat_points >= 2:
    jump cat_chillin
the following code:

Code: Select all

label whatever:
    if cat_points >= 6:
        jump cat_eats_cookie
    elif 6 > cat_points >= 4:
        jump cat_dozing
    elif 4 > cat_points >= 2:
        jump cat_chillin    
    else:
        pass # options with cat_points < 2

CrystalD
Newbie
Posts: 19
Joined: Fri Aug 18, 2017 11:50 pm
Tumblr: CrystalDennisMusic
Skype: valkyrieceles
Soundcloud: crystaldennismusic
Contact:

Re: Certain Events Aren't Triggering with my points in the Script

#3 Post by CrystalD »

Edit: It half worked! For some reason, my middle option isn't jumping to the 3rd jump statement/scene I've set though? I feel like this is something so obvious I just am not getting. Do you have to structure the points in a certain order to make the logic work?

Code I have right now is this:

Code: Select all

label cat_convo_1:
if cat_points >= 6:
    jump cat_eats_cookie
elif 6 > cat_points >= 4:
    jump cat_dozing
elif 4 > cat_points >= 2:    
    jump cat_chillin

I'll try it, I tried just switching everything to an elif statement and it didn't work but I didn't have it structured like that haha. Why in the other 2 examples you have it like this?

Code: Select all

    elif 6 > cat_points >= 4:
        jump cat_dozing
    elif 4 > cat_points >= 2:
        jump cat_chillin


like with the 6 > cat_points >= 4 why is it structured like that? I've never seen any examples structured like that before so want to know the logic behind it.

Also any ideas why my True False statement with the business man section aren't working?

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Certain Events Aren't Triggering with my points in the Script

#4 Post by IrinaLazareva »

CrystalD wrote: Mon Jan 29, 2018 11:23 am For some reason, my middle option isn't jumping to the 3rd jump statement/scene I've set though?
CrystalD wrote: Mon Jan 29, 2018 11:23 amAlso any ideas why my True False statement with the business man section aren't working?
I'm not sure, but, may be, problem in the identation... (The program can pass lines if they aren't allocated with a indentation)
For example, lines

Code: Select all

label cat_convo_1:
if cat_points >= 6:
have to be

Code: Select all

label cat_convo_1:
    if cat_points >= 6:
CrystalD wrote: Mon Jan 29, 2018 11:23 am like with the 6 > cat_points >= 4 why is it structured like that? I've never seen any examples structured like that before so want to know the logic behind it.

6 > cat_points >= 4 is equivalent to cat_points < 6 and cat_points >= 4.
Here some doc about this.

CrystalD
Newbie
Posts: 19
Joined: Fri Aug 18, 2017 11:50 pm
Tumblr: CrystalDennisMusic
Skype: valkyrieceles
Soundcloud: crystaldennismusic
Contact:

Re: Certain Events Aren't Triggering with my points in the Script

#5 Post by CrystalD »

OK, I'll mess around with it! A lot of my points throughout the script aren't indented and I wasn't getting any run errors from it, so I'll see if indenting them helps fix the problem. Thank you :D

CrystalD
Newbie
Posts: 19
Joined: Fri Aug 18, 2017 11:50 pm
Tumblr: CrystalDennisMusic
Skype: valkyrieceles
Soundcloud: crystaldennismusic
Contact:

Re: [Solved] Certain Events Aren't Triggering with my points in the Script

#6 Post by CrystalD »

After tinkering with stuff I realized my problem was not adding a jump statement to jump to point tallies haha, so going to mark this as solved :)

Post Reply

Who is online

Users browsing this forum: Ocelot