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.
-
span4ev
- Regular
- Posts: 77
- Joined: Fri Jul 08, 2022 9:29 pm
- itch: rpymc
-
Contact:
#1
Post
by span4ev » Wed Jul 13, 2022 12:08 am
Code: Select all
screen statsNames():
for i in range(len(open_persons_list)):
$ current_class_name = open_persons_list[i]
textbutton current_class_name:
# I want to put it here and use the variable in another screen, but I don't understand how to do it.
# I get an error "str object is not callable"
# |
# |
# \ /
hovered Show('test(current_class_name)')
action NullAction()
screen test(class_name):
frame:
text class_name
usually without passing arguments it works like this:
hovered Show('statsDetail')
I've tried a bunch of different options but i don't understand this syntax
Code: Select all
hovered Show('test(current_class_name)')
hovered Show('test[current_class_name]')
hovered Show('test([current_class_name])')
hovered Show('test', 'current_class_name')
hovered Show('test', current_class_name)
hovered Show('test', $ current_class_name)
hovered Show('test', [current_class_name])
hovered Show('test', [$ current_class_name])
hovered Show('test', '[$ current_class_name]')
hovered Show('test', ['current_class_name'])
hovered Show('test', '[current_class_name]')
-
span4ev
- Regular
- Posts: 77
- Joined: Fri Jul 08, 2022 9:29 pm
- itch: rpymc
-
Contact:
#3
Post
by span4ev » Wed Jul 13, 2022 2:53 pm
m_from_space wrote: ↑Wed Jul 13, 2022 7:48 am
Use keywords arguments:
Code: Select all
Show('test', class_name=current_class_name)
Thank you very much! You are my hero. It really works. I don't know why the syntax is the way it is, but it is.
Yesterday, out of desperation, I used this approach:
Code: Select all
init python:
def some_func(class_name):
renpy.show_screen('test', class_name)
screen statsNames():
style_prefix 'statsNames_'
frame:
$ class_name = '5555'
textbutton 'gggg':
hovered Function(some_func, class_name)
action NullAction()
screen test(class_name):
frame:
text class_name
-
span4ev
- Regular
- Posts: 77
- Joined: Fri Jul 08, 2022 9:29 pm
- itch: rpymc
-
Contact:
#5
Post
by span4ev » Thu Jul 14, 2022 7:51 pm
I am missing a code example to see how I can use this
Users browsing this forum: No registered users