Flag Help
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.
- Mikomi
- Veteran
- Posts: 324
- Joined: Tue Jun 24, 2014 11:45 pm
- Completed: That Which Binds Us, Enamored Risks, Alice in Stardom
- Projects: Asterism, Magicanna
- Organization: Crystal Game Works
- itch: CrystalGameWorks
- Contact:
Flag Help
Hello, I'm kinda new to Ren'Py, and was wondering how I would make flags that would react to certain choices. So far I have 4 choices, and I'd like to be able to make flags for each separate choice. Would I just call it flag1 if I wanted to make it about choice1?
- ArachneJericho
- Regular
- Posts: 196
- Joined: Sun Jun 22, 2014 2:04 am
- Projects: Kaguya Hime
- Tumblr: mousedeerproductions
- Location: Seattle, WA, USA
- Contact:
Re: Flag Help
Code: Select all
$ flag = valueCode: Select all
menu:
"You choose a banana.":
"That banana looks quite nicely yellow and ripe. Delicious!"
$ fruit_choice = 'banana'
"You choose an apple.":
"That apple turned out to be crisp and scrumptious."
$ fruit_choice = 'apple'
"You choose no fruit.":
"You aren't hungry anyways."
$ fruit_choice = None
if fruit_choice == 'banana':
"You drop your peel on the floor. And then slip on it in a moment."
else if fruit_choice == 'apple':
"You toss your core on the floor. And then it rolls under your foot and trips you."
else:
"No fruit chosen, no mess to tidy up! You walk down the hallway without incident."
- Mikomi
- Veteran
- Posts: 324
- Joined: Tue Jun 24, 2014 11:45 pm
- Completed: That Which Binds Us, Enamored Risks, Alice in Stardom
- Projects: Asterism, Magicanna
- Organization: Crystal Game Works
- itch: CrystalGameWorks
- Contact:
Re: Flag Help
I think it does- So all I have to do is insert the small line $ flag == value somewhere and then I can enter in different variables for the flags? Also, is there anywhere specific I should put that line?ArachneJericho wrote:I suggest naming "flag" to be something meaningful. Also remember that flags are just variables, and can have values other than True or False. Here's some sample code:Code: Select all
$ flag = value
Hope this helps.Code: Select all
menu: "You choose a banana.": "That banana looks quite nicely yellow and ripe. Delicious!" $ fruit_choice = 'banana' "You choose an apple.": "That apple turned out to be crisp and scrumptious." $ fruit_choice = 'apple' "You choose no fruit.": "You aren't hungry anyways." $ fruit_choice = None if fruit_choice == 'banana': "You drop your peel on the floor. And then slip on it in a moment." else if fruit_choice == 'apple': "You toss your core on the floor. And then it rolls under your foot and trips you." else: "No fruit chosen, no mess to tidy up! You walk down the hallway without incident."
Thank you for your help!
- Asceai
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: Flag Help
= for assignment (setting a variable to something)Mikomi wrote:I think it does- So all I have to do is insert the small line $ flag == value somewhere and then I can enter in different variables for the flags? Also, is there anywhere specific I should put that line?
Thank you for your help!
== for comparison (checking a variable is equal to something
Code: Select all
$flag = valueCode: Select all
if flag == True:
"the flag is set"- Mikomi
- Veteran
- Posts: 324
- Joined: Tue Jun 24, 2014 11:45 pm
- Completed: That Which Binds Us, Enamored Risks, Alice in Stardom
- Projects: Asterism, Magicanna
- Organization: Crystal Game Works
- itch: CrystalGameWorks
- Contact:
Re: Flag Help
I understand they're two different things, but I don't understand what they mean.Asceai wrote:= for assignment (setting a variable to something)Mikomi wrote:I think it does- So all I have to do is insert the small line $ flag == value somewhere and then I can enter in different variables for the flags? Also, is there anywhere specific I should put that line?
Thank you for your help!
== for comparison (checking a variable is equal to something
Code: Select all
$flag = valueCode: Select all
if flag == True: "the flag is set"
Who is online
Users browsing this forum: Bing [Bot], nyeowmi

