Names inside Dialogue?
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.
-
- Newbie
- Posts: 12
- Joined: Sat Apr 23, 2005 1:43 pm
- Location: Sarasota, Fl.
- Contact:
Names inside Dialogue?
Strange, I was reading over the old topic of 'custom names' to remember how to create a user inputted name. However, mid-workings into a dialogue in the game, I noticed something.
If you have a character speaking, is it possible to have them refer to the user inputted name in the actual dialogue? If so, I'm not sure how to do that. Perhaps one of you could answer that question for me?
I'll show you what I mean via example:
The user types their character's name as ... "Cindy". Rather than have this situation:
Ex. #1
Cindy: "That's when I saw him!"
Bob: "Hello."
I would much rather have:
Ex. #2
Cindy: "That's when I saw him!"
Bob: "Hello, Cindy."
Any takers?
If you have a character speaking, is it possible to have them refer to the user inputted name in the actual dialogue? If so, I'm not sure how to do that. Perhaps one of you could answer that question for me?
I'll show you what I mean via example:
The user types their character's name as ... "Cindy". Rather than have this situation:
Ex. #1
Cindy: "That's when I saw him!"
Bob: "Hello."
I would much rather have:
Ex. #2
Cindy: "That's when I saw him!"
Bob: "Hello, Cindy."
Any takers?
-
- Miko-Class Veteran
- Posts: 651
- Joined: Sat May 21, 2005 12:28 pm
- Location: University of Utah
- Contact:
-
- Newbie
- Posts: 12
- Joined: Sat Apr 23, 2005 1:43 pm
- Location: Sarasota, Fl.
- Contact:
-
- Newbie
- Posts: 12
- Joined: Sat Apr 23, 2005 1:43 pm
- Location: Sarasota, Fl.
- Contact:
I take that back. Now my problem must me in the coding itself:
Code: Select all
init:
python:
def p(what):
renpy.display_say(player, what, color=(255, 255, 0, 255))
p.say = p
$ player = renpy.prompt("Please enter your name:", "", 30)
- 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:
That's a really old-school way of doing what should now be written as:
I also note that it's renpy.input, not renpy.prompt.
Code: Select all
init:
$ p = DynamicCharacter("player", color=(255, 255, 0, 255))
$ player = renpy.input("Please enter your name:", "", length=30)
Last edited by PyTom on Tue Jun 14, 2005 7:10 am, edited 1 time in total.
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
-
- Newbie
- Posts: 12
- Joined: Sat Apr 23, 2005 1:43 pm
- Location: Sarasota, Fl.
- Contact:
Oh? Thank you Pytom! I appreciate the update. I didn't know that the code had been changed.
... Lord, almighty...
Code: Select all
I'm sorry, but an exception occured while executing your Ren'Py
script.
ParseError: On line 239 of game/script.rpy: one-line python statement does not expect a block.
$ player = renpy.input("Please enter your name:", "", 30)
^
While parsing game/script.rpy.
-- Full Traceback ------------------------------------------------------------
File "run_game.py", line 62, in main
File "renpy\main.pyc", line 154, in main
File "renpy\script.pyc", line 189, in load_script
File "renpy\script.pyc", line 83, in __init__
File "renpy\script.pyc", line 109, in load_file
File "renpy\parser.pyc", line 1216, in parse
File "renpy\parser.pyc", line 1192, in parse_block
File "renpy\parser.pyc", line 1090, in parse_statement
File "renpy\parser.pyc", line 364, in expect_noblock
File "renpy\parser.pyc", line 337, in error
ParseError: On line 239 of game/script.rpy: one-line python statement does not expect a block.
$ player = renpy.input("Please enter your name:", "", 30)
^
While parsing game/script.rpy.
Ren'Py Version: Ren'Py 4.8.5
- 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:
This error isn't caused by the code you have here. The problem is, the code after the input is indented. It's as if you wrote something like:
The solution is to indent the python line to the level of the surrounding script, or to dedent the following lines out to the level of the python line. Either way will solve the problem.
Code: Select all
label foo:
"Line 1"
$ player = renpy.input(...)
"Line 2"
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
-
- Newbie
- Posts: 12
- Joined: Sat Apr 23, 2005 1:43 pm
- Location: Sarasota, Fl.
- Contact:
Odd, I still seem to be getting error messages. I made sure that the lines weren't indented after that, but I'm still getting error messages. If I have the input code there, does that mean that all the rest of the game script will have to be be 'un-indented' as well?
Sorry to be such a bother to you. I'm sure that this is a simple answer, but I'm just not seeing it. If I don't indent every line, I will most likely just receive this everytime, right?
That's for every line that's indented. If I go through the entire game and take out the indents, that will fix?
Sorry to be such a bother to you. I'm sure that this is a simple answer, but I'm just not seeing it. If I don't indent every line, I will most likely just receive this everytime, right?
Code: Select all
I'm sorry, but an exception occured while executing your Ren'Py
script.
ParseError: On line 257 of game/script.rpy: say statement does not expect a block.
j "{size=-1}I think that's impressive. Being on time where ever you go is a very good habit to get into.{/size}"
^
While parsing game/script.rpy.
-- Full Traceback ------------------------------------------------------------
File "run_game.py", line 62, in main
File "renpy\main.pyc", line 154, in main
File "renpy\script.pyc", line 189, in load_script
File "renpy\script.pyc", line 83, in __init__
File "renpy\script.pyc", line 109, in load_file
File "renpy\parser.pyc", line 1216, in parse
File "renpy\parser.pyc", line 1192, in parse_block
File "renpy\parser.pyc", line 1175, in parse_statement
File "renpy\parser.pyc", line 364, in expect_noblock
File "renpy\parser.pyc", line 337, in error
ParseError: On line 257 of game/script.rpy: say statement does not expect a block.
j "{size=-1}I think that's impressive. Being on time where ever you go is a very good habit to get into.{/size}"
^
While parsing game/script.rpy.
Ren'Py Version: Ren'Py 4.8.5
- 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:
I'm not really quite sure I understand what's going on anymore. Can you kick the script over to me via email, and I'll check it out for you?Skittle Sama wrote:Odd, I still seem to be getting error messages. I made sure that the lines weren't indented after that, but I'm still getting error messages. If I have the input code there, does that mean that all the rest of the game script will have to be be 'un-indented' as well?
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
-
- Newbie
- Posts: 12
- Joined: Sat Apr 23, 2005 1:43 pm
- Location: Sarasota, Fl.
- Contact:
Okay, so I cut and pasted PyTom's sample code from above into my script. I can launch the game, but the second I try and input a name when I get to the renpy.input line, the program crashes and says--
I'm sorry, but an exception occured while executing your Ren'Py
script.
TypeError: iterable argument required
The last script statement executed was on line 116 of
game/script.rpy.
-- Full Traceback ------------------------------------------------------------
File "run_game.py", line 61, in main
File "renpy\main.pyc", line 157, in main
File "renpy\main.pyc", line 121, in run
File "renpy\execution.pyc", line 68, in run
File "renpy\ast.pyc", line 222, in execute
File "renpy\python.pyc", line 642, in py_exec_bytecode
File "<none>", line 1, in <module>
File "renpy\exports.pyc", line 142, in input
File "renpy\ui.pyc", line 45, in interact
File "renpy\display\core.pyc", line 658, in interact
File "renpy\display\core.pyc", line 897, in interact_core
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\behavior.pyc", line 467, in event
TypeError: iterable argument required
The last script statement executed was on line 116 of
game/script.rpy.
Weird, huh? Any idea what that could mean?
I'd appreciate any help.
I'm sorry, but an exception occured while executing your Ren'Py
script.
TypeError: iterable argument required
The last script statement executed was on line 116 of
game/script.rpy.
-- Full Traceback ------------------------------------------------------------
File "run_game.py", line 61, in main
File "renpy\main.pyc", line 157, in main
File "renpy\main.pyc", line 121, in run
File "renpy\execution.pyc", line 68, in run
File "renpy\ast.pyc", line 222, in execute
File "renpy\python.pyc", line 642, in py_exec_bytecode
File "<none>", line 1, in <module>
File "renpy\exports.pyc", line 142, in input
File "renpy\ui.pyc", line 45, in interact
File "renpy\display\core.pyc", line 658, in interact
File "renpy\display\core.pyc", line 897, in interact_core
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\behavior.pyc", line 467, in event
TypeError: iterable argument required
The last script statement executed was on line 116 of
game/script.rpy.
Weird, huh? Any idea what that could mean?
I'd appreciate any help.
-
- Miko-Class Veteran
- Posts: 829
- Joined: Sun Feb 20, 2005 8:45 pm
- Projects: NaNoRenO 2016, Ren'Py tutorial series
- Location: USA
- Contact:
the underlined lines (in the quote box) tell you where to look. since it's "script.rpy", this should be fixable on your end. open it up with SciTE and use the GOTO command to jump to that line. if you can't figure out what to do, then keep asking.Peewee wrote:Okay, so I cut and pasted PyTom's sample code from above into my script. I can launch the game, but the second I try and input a name when I get to the renpy.input line, the program crashes and says--
I'm sorry, but an exception occured while executing your Ren'Py
script.
TypeError: iterable argument required
The last script statement executed was on line 116 of
game/script.rpy.
-- Full Traceback ------------------------------------------------------------
File "run_game.py", line 61, in main
File "renpy\main.pyc", line 157, in main
File "renpy\main.pyc", line 121, in run
File "renpy\execution.pyc", line 68, in run
File "renpy\ast.pyc", line 222, in execute
File "renpy\python.pyc", line 642, in py_exec_bytecode
File "<none>", line 1, in <module>
File "renpy\exports.pyc", line 142, in input
File "renpy\ui.pyc", line 45, in interact
File "renpy\display\core.pyc", line 658, in interact
File "renpy\display\core.pyc", line 897, in interact_core
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\layout.pyc", line 106, in event
File "renpy\display\behavior.pyc", line 467, in event
TypeError: iterable argument required
The last script statement executed was on line 116 of
game/script.rpy.
Weird, huh? Any idea what that could mean?
I'd appreciate any help.
also, I think the code above was supposed to be for showing an example of what would cause an error, if I'm not mistaken...
~Kitsune Zeta
- 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:
Peewee:
There was an error in my sample code. I've updated it. Basically, the last parameter must be written length=30, rather than just 30.
We apologize for the inconvenience.
There was an error in my sample code. I've updated it. Basically, the last parameter must be written length=30, rather than just 30.
We apologize for the inconvenience.
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
-
- Miko-Class Veteran
- Posts: 651
- Joined: Sat May 21, 2005 12:28 pm
- Location: University of Utah
- Contact:
I'm trying to show some a number variable on the screen with the following statement:
show text "You obtained %(endcounter)d of 5 endings!"
But the program ends up not replacing %(endcounter)d with the value of the variable, but displays the text exactly as shown...
It works fine in dialog, but how can I get it to work with a show text statement?
show text "You obtained %(endcounter)d of 5 endings!"
But the program ends up not replacing %(endcounter)d with the value of the variable, but displays the text exactly as shown...
It works fine in dialog, but how can I get it to work with a show text statement?
- 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:
You can't, since show text isn't as magical as a say statement. You'll have to write something like:
instead. (Not tested.)
Code: Select all
$ renpy.show(('text', "You obtained %(endcounter)d of 5 endings!" % globals()))
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
Who is online
Users browsing this forum: Google [Bot]