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.
-
Iraqian
- Newbie
- Posts: 1
- Joined: Fri Jun 26, 2020 3:45 pm
-
Contact:
#1
Post
by Iraqian » Fri Jul 31, 2020 11:56 pm
hey! i wanted to use notify screen to display certain vars.
for ex:
$ coins = 1000
$ renpy.notify("you've gained [coins] coins")
but the output goes like
"you've gained [coins] coins"
instead of:
"you've gained 1000 coins"
so what i did to fix this problem was changing the text value in the notify screen, and it actually worked:
from:
Code: Select all
screen notify(message):
zorder 100
style_prefix "notify"
frame at notify_appear:
text [message!tq]
timer 3.25 action Hide('notify')
to:
Code: Select all
screen notify(message):
zorder 100
style_prefix "notify"
frame at notify_appear:
text message
timer 3.25 action Hide('notify')
changed [message!tq] ---> message
it feels like i just plaster patched it so hard... and i actually don't know what [message!tq] stands for.
can i get an explanation and if i am at the right with how i managed to fixed that?
thanks!
-
IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
-
Contact:
#2
Post
by IrinaLazareva » Sat Aug 01, 2020 8:58 am
The purpose of the conversions flags
!tq is
described in doc.
P.S.You can eliminate the need to change the standard screen, for example, as follows:
Code: Select all
$ coins = 1000
$ renpy.notify("You\'ve gained {} coins".format(coins))
-
dGameBoy101b
- Regular
- Posts: 31
- Joined: Sun Aug 12, 2018 8:32 am
- itch: dgameboy101b
-
Contact:
#3
Post
by dGameBoy101b » Fri Aug 07, 2020 10:47 am
To expand upon IrinaLazareva's answer, since what you're using is a python statement instead of a renpy statement, you need to use python syntax. An easy way to convert a renpy variable substitution to its python equivalent is to swap out the square braces for curly braces and add an "f" to the start of the string.
Code: Select all
$ coins = 10
"You've gained [coins] coins."
$ renpy.notify(f"You've gained {coins} coins.")
Users browsing this forum: Bing [Bot], Google [Bot]