Possible to name screen with variable?
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.
Possible to name screen with variable?
Is there a way to loop through a list and define screens like screen item01, screen item02, screen item03...?
Re: Possible to name screen with variable?
AFAIK, no. But you can have a single screen alter its contents based on the value of variables...
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Projects: The Button Man
- Organization: NILA
- Github: hell-oh-world
- Location: Philippines
- Contact:
Re: Possible to name screen with variable?
Just use the use and transclude method in screens. Its well documented in the screen language docs. It lets you recycle screens like what you're trying to do considering that item01 and item02 are pretty much the same but only differs in the contents such as item name etc.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
- Contact:
Re: Possible to name screen with variable?
You could always use keyword arguments
screen item(item_number):
screen item(item_number):
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Re: Possible to name screen with variable?
This is super cool and interesting! I'll definitely use this for parts of my game. Thanks!
Re: Possible to name screen with variable?
AH! It's useful to find out about this function. I'll definitely use this in some parts of my game too. Thanks!hell_oh_world wrote: ↑Thu Jul 16, 2020 3:11 pmJust use the use and transclude method in screens. Its well documented in the screen language docs. It lets you recycle screens like what you're trying to do considering that item01 and item02 are pretty much the same but only differs in the contents such as item name etc.
Who is online
Users browsing this forum: CharlieFuu69, Google [Bot]