Print command and Ren'Py
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.
-
- Veteran
- Posts: 264
- Joined: Sat Feb 26, 2011 9:36 am
- Projects: Rzeczpospolita Polska 1647
- Location: Κωνσταντινούπολη, Βασιλεύα των Ρωμαύων
- Contact:
Print command and Ren'Py
I have a quick question: Is the Python print command usable in Ren'Py?
Thanks beforehands!
Thanks beforehands!
One Province Minor - 120 class variables and still counting!
Because there is no such thing as too many variables.
Because there is no such thing as too many variables.
Re: Print command and Ren'Py
If you mean <print> command that shows text onscreen, then in Ren'Py it will be <text> command or its equivalent <ui.text()>
http://www.renpy.org/doc/html/text.html ... isplayable
http://www.renpy.org/wiki/renpy/doc/reference/Text
http://www.renpy.org/doc/html/text.html ... isplayable
http://www.renpy.org/wiki/renpy/doc/reference/Text
-
- Veteran
- Posts: 264
- Joined: Sat Feb 26, 2011 9:36 am
- Projects: Rzeczpospolita Polska 1647
- Location: Κωνσταντινούπολη, Βασιλεύα των Ρωμαύων
- Contact:
Re: Print command and Ren'Py
Not sure if that's what I'm looking for.
The situation here is that I need to combine the for statement with the if clause and use it as a condition to display text. The problem is, to use an if clause in a for statement I have to use a python block, which pretty much negates the entire standard Ren'Py dialogue display.
The question above is what I thought could have been a workaround if it existed. Any tips will be very welcome.
The situation here is that I need to combine the for statement with the if clause and use it as a condition to display text. The problem is, to use an if clause in a for statement I have to use a python block, which pretty much negates the entire standard Ren'Py dialogue display.
The question above is what I thought could have been a workaround if it existed. Any tips will be very welcome.
One Province Minor - 120 class variables and still counting!
Because there is no such thing as too many variables.
Because there is no such thing as too many variables.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Print command and Ren'Py
Yes, it works, although it's somewhat hard to see the output.
On linux, run your game on the command line, and the output goes to the command line. On windows, drag your game to console.exe, and you can see the output. Not sure about mac.
On linux, run your game on the command line, and the output goes to the command line. On windows, drag your game to console.exe, and you can see the output. Not sure about mac.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Veteran
- Posts: 264
- Joined: Sat Feb 26, 2011 9:36 am
- Projects: Rzeczpospolita Polska 1647
- Location: Κωνσταντινούπολη, Βασιλεύα των Ρωμαύων
- Contact:
Re: Print command and Ren'Py
Hmm... seems that it isn't a good workaround then. I'll try to fins another way.
Thanks anyway.
Thanks anyway.
One Province Minor - 120 class variables and still counting!
Because there is no such thing as too many variables.
Because there is no such thing as too many variables.
Re: Print command and Ren'Py
Could you show your code? 'Cause you can use <renpy.say(e, "Hello world!")> in python block.
-
- Veteran
- Posts: 264
- Joined: Sat Feb 26, 2011 9:36 am
- Projects: Rzeczpospolita Polska 1647
- Location: Κωνσταντινούπολη, Βασιλεύα των Ρωμαύων
- Contact:
Re: Print command and Ren'Py
I have found a simpler workaround that does not have to involve the for statement. Thanks for the suggestion anyway! I'm sure it will be of use later on.
One Province Minor - 120 class variables and still counting!
Because there is no such thing as too many variables.
Because there is no such thing as too many variables.
-
- Veteran
- Posts: 264
- Joined: Sat Feb 26, 2011 9:36 am
- Projects: Rzeczpospolita Polska 1647
- Location: Κωνσταντινούπολη, Βασιλεύα των Ρωμαύων
- Contact:
Re: Print command and Ren'Py
Sorry, I take back the last statement. My workaround did not work.
Here's the code in question:
What I want to achieve is to pop up a message announcing that the player has mined every ore that she has mined, but only if she has successfully mined it. I cannot find find any alternative to that after much brainstorming. That, and the renpy.say command apparently returned a "syntax error" message.
Here's the code in question:
Code: Select all
python:
for ore in mine1.available_ore:
if ore.ore_mined:
"You mined some [ore.ore_item.name]."
successful_mining = True
else:
pass
One Province Minor - 120 class variables and still counting!
Because there is no such thing as too many variables.
Because there is no such thing as too many variables.
Re: Print command and Ren'Py
Hm, <renpy.say> should work (it will look like character talking about mined ore) - what's the actual code you used?
Also, you might mess with tooltips - http://www.renpy.org/doc/html/screen_ac ... l#tooltips
Or you could make a screen, that has text line "You mined some [my_text_var]." and show it with different values of
"my_text_var". http://www.renpy.org/doc/html/screen_py ... -functions
Also, you might mess with tooltips - http://www.renpy.org/doc/html/screen_ac ... l#tooltips
Or you could make a screen, that has text line "You mined some [my_text_var]." and show it with different values of
"my_text_var". http://www.renpy.org/doc/html/screen_py ... -functions
Code: Select all
screen my_scr:
tag my_scr
zorder 100
key "mouseup_1" action Return("smth")
default my_text_var = "dirt"
frame:
background Frame("my_frame_bg.png", 7, 7)
xminimum 200 xmaximum 200
yminimum 100 ymaximum 100
xalign 0.5 yalign 0.5
vbox:
xfill True
text "You mined some [my_text_var]." xalign 0.5
null height 30
text "Click to continue" size 10 xalign 1.0
label start:
$ available_ore = ["gold", "iron", "silver"]
"..."
python:
for ore in available_ore:
renpy.call_screen("my_scr", my_text_var=ore)
"...?"
-
- Veteran
- Posts: 264
- Joined: Sat Feb 26, 2011 9:36 am
- Projects: Rzeczpospolita Polska 1647
- Location: Κωνσταντινούπολη, Βασιλεύα των Ρωμαύων
- Contact:
Re: Print command and Ren'Py
Here's the code I tried:
and
Both result in a syntax error.
Code: Select all
python:
for ore in mine1.available_ore:
if ore.ore_mined:
<renpy.say("You mined some [ore.ore_item.name].")>
successful_mining = True
else:
pass
Code: Select all
python:
for ore in mine1.available_ore:
if ore.ore_mined:
<renpy.say>("You mined some [ore.ore_item.name].")
successful_mining = True
else:
pass
One Province Minor - 120 class variables and still counting!
Because there is no such thing as too many variables.
Because there is no such thing as too many variables.
Re: Print command and Ren'Py
Khm, you don't need < and > in your code (I used them in my post instead of code-tag, sorry for misleading you).
-
- Veteran
- Posts: 264
- Joined: Sat Feb 26, 2011 9:36 am
- Projects: Rzeczpospolita Polska 1647
- Location: Κωνσταντινούπολη, Βασιλεύα των Ρωμαύων
- Contact:
Re: Print command and Ren'Py
Ah, that solves it. Looks like it works now.
Thanks again!
Thanks again!
One Province Minor - 120 class variables and still counting!
Because there is no such thing as too many variables.
Because there is no such thing as too many variables.
Who is online
Users browsing this forum: No registered users