If Statements
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.
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.
-
- Regular
- Posts: 72
- Joined: Mon Mar 30, 2009 3:59 am
- Location: Moriya Shrine, Gensokyo
- Contact:
If Statements
I've been having trouble with If Statements and after messing around with it, I got this error. I figured if I posted that somebody could help me set it up properly. The line that is supposed to be triggered by the If Statement still shows up in the route where it shouldn't.
- Attachments
-
- traceback.txt
- (1.11 KiB) Downloaded 126 times
"I've heard that villains who go soft and then crazy are pretty popular these days, right?
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: If Statements
Can you post the code in question too?
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
-
- Regular
- Posts: 72
- Joined: Mon Mar 30, 2009 3:59 am
- Location: Moriya Shrine, Gensokyo
- Contact:
Re: If Statements
Hmmm I should just attach the whole script right? Or would that be a bit much to search through? Because if I posted it here it might take up some space...
"I've heard that villains who go soft and then crazy are pretty popular these days, right?
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: If Statements
No, just some lines before and after the row which causes error.
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
-
- Regular
- Posts: 72
- Joined: Mon Mar 30, 2009 3:59 am
- Location: Moriya Shrine, Gensokyo
- Contact:
Re: If Statements
Oh, okay~
That's where I get the error.
Code: Select all
scene bg hall
with fade
a "Another boring night ahead. I guess I should do my homework for real this time..."
if goto_class:
a "The teachers went easy on me afterall..."
a "Maybe that hikikomori will help me too..."
"I've heard that villains who go soft and then crazy are pretty popular these days, right?
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: If Statements
You need to define variable before you use it. Do you by any chance have
goto_class = True
somewhere before that if statement occurs?
goto_class = True
somewhere before that if statement occurs?
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
-
- Regular
- Posts: 72
- Joined: Mon Mar 30, 2009 3:59 am
- Location: Moriya Shrine, Gensokyo
- Contact:
Re: If Statements
I had it at the beginning where the new label started and I didn't get the error. But it still showed up for the route that didn't choose the choice that should have activated it.
Unless it's supposed to. I was under the impression it wouldn't show if I chose a different option from the menu.
Code: Select all
jump walkhome
label walkhome:
$ goto_class = True
scene bg street day
with fade
"I've heard that villains who go soft and then crazy are pretty popular these days, right?
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
-
- Miko-Class Veteran
- Posts: 546
- Joined: Wed Sep 21, 2005 10:49 pm
- Projects: Winter Shard, EVE, Hyperion
- Contact:
Re: If Statements
Generally, it is a good idea to have a full list of variables defined from the beginning. So go and add something like...
Code: Select all
label start:
$ goto_room = False
-
- Regular
- Posts: 72
- Joined: Mon Mar 30, 2009 3:59 am
- Location: Moriya Shrine, Gensokyo
- Contact:
Re: If Statements
Yeah, I had that in too.
"I've heard that villains who go soft and then crazy are pretty popular these days, right?
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: If Statements
This may seem ridiculous, but try this for if statement:
if goto_class==True:
This is out on a limb, though, because if goto_class: should do the same.
if goto_class==True:
This is out on a limb, though, because if goto_class: should do the same.
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
-
- Regular
- Posts: 72
- Joined: Mon Mar 30, 2009 3:59 am
- Location: Moriya Shrine, Gensokyo
- Contact:
Re: If Statements
Okay, I tried that. It still didn't work.
Could the following be the trouble?
Could the following be the trouble?
Code: Select all
a "What should I do?"
menu:
"Got to class":
jump goto_class
"Skip class":
jump skip
label goto_class:
$ goto_class = True
a "I'll have other chances to talk to her. I might be able to explain myself to the teacher anyways..."
"I've heard that villains who go soft and then crazy are pretty popular these days, right?
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: If Statements
Yes, you can't have a label and a variable with the same name. I think. Change the name of label to something different.
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
-
- Regular
- Posts: 72
- Joined: Mon Mar 30, 2009 3:59 am
- Location: Moriya Shrine, Gensokyo
- Contact:
Re: If Statements
Ah, I was hoping that would work. I shorted the label down to 'goto' but still no luck, the line still appears regardless.
"I've heard that villains who go soft and then crazy are pretty popular these days, right?
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
Even sooo, I've studied a lot of manga, anime and galge that have been popular, you seeee?" - Beatrice, Umineko no Naku Koro ni
Loli Salad~ Music, Doujin, Touhou, Umineko and Anime
(previously I was Hashihime~)
-
- Veteran
- Posts: 284
- Joined: Fri Dec 28, 2007 5:47 am
- Location: Where the Dragons rule!
- Contact:
Re: If Statements
goto is a reserved word I think. Try some other words instead.
Angels of paradise, angels of sacrifice
Please let me be under your wings...
Please let me be under your wings...
-
- Eileen-Class Veteran
- Posts: 1153
- Joined: Mon Jul 07, 2003 4:57 pm
- Completed: Elven Relations, Cloud Fairy, When I Rule The World
- Tumblr: alextfish
- Skype: alextfish
- Location: Cambridge, UK
- Contact:
Re: If Statements
Hmm. Since our first couple of attempts to track this down have failed, it sounds like it'd be a good idea to post your entire script. (If you'd rather keep it secret, strip it down to a small bit of it, but the important thing is that it's (1) a complete script file that we can run in our own Ren'Py and (2) still produces the error you're seeing.)
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!
Who is online
Users browsing this forum: Imperf3kt