Problem with custom names in a new .rpy file

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.
Post Reply
Message
Author
Altali
Newbie
Posts: 4
Joined: Sat Dec 30, 2017 6:35 pm
Location: Brazil
Contact:

Problem with custom names in a new .rpy file

#1 Post by Altali »

In my game's script, i made the game go in another .rpy file using jump and label. In the new file, when the custom name appears the game haves an exception.
What should i do to fix this?
(I'm a complete newbie at this...)
Last edited by Altali on Thu Jan 04, 2018 3:49 am, edited 1 time in total.

User avatar
erickcire95
Regular
Posts: 33
Joined: Tue Dec 26, 2017 7:38 pm
Contact:

Re: Problem with custom names in a new .rpy

#2 Post by erickcire95 »

That could be a lot of things, it would be useful if you copy the exception text here so people can better understand the problem.

Altali
Newbie
Posts: 4
Joined: Sat Dec 30, 2017 6:35 pm
Location: Brazil
Contact:

Re: Problem with custom names in a new .rpy

#3 Post by Altali »

Thank you for the quick response!
In this case, "a" is the custom name.
Here's the code:

I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/FloRoute.rpy", line 6, in script
a "We should not only train, but also study."
KeyError: u'name'

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "game/FloRoute.rpy", line 6, in script
a "We should not only train, but also study."
File "C:\Users\Vagner\Downloads\Trabalhos Rafa\ss\fon\trab\renpy-6.99.13-sdk\renpy\ast.py", line 624, in execute
renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
File "C:\Users\Vagner\Downloads\Trabalhos Rafa\ss\fon\trab\renpy-6.99.13-sdk\renpy\exports.py", line 1173, in say
who(what, *args, **kwargs)
File "C:\Users\Vagner\Downloads\Trabalhos Rafa\ss\fon\trab\renpy-6.99.13-sdk\renpy\character.py", line 889, in __call__
who = who_pattern.replace("[who]", sub(who))
File "C:\Users\Vagner\Downloads\Trabalhos Rafa\ss\fon\trab\renpy-6.99.13-sdk\renpy\character.py", line 884, in sub
return renpy.substitutions.substitute(s, scope=scope, force=force, translate=translate)[0]
File "C:\Users\Vagner\Downloads\Trabalhos Rafa\ss\fon\trab\renpy-6.99.13-sdk\renpy\substitutions.py", line 242, in substitute
s = formatter.vformat(s, (), kwargs)
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 563, in vformat
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 585, in _vformat
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 646, in get_field
File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 605, in get_value
KeyError: u'name'

Windows-7-6.1.7601-SP1
Ren'Py 6.99.13.2919

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Problem with custom names in a new .rpy file

#4 Post by Remix »

How are you defining the character a?

... and equally as important, are you re-using the variable 'a' for anything else?
Frameworks & Scriptlets:

Altali
Newbie
Posts: 4
Joined: Sat Dec 30, 2017 6:35 pm
Location: Brazil
Contact:

Re: Problem with custom names in a new .rpy file

#5 Post by Altali »

Remix wrote: Thu Jan 04, 2018 9:17 am How are you defining the character a?

... and equally as important, are you re-using the variable 'a' for anything else?
It's being defined in this way:

Code: Select all

define a = Character("[name]")
The name input is this:

Code: Select all

 $ name = renpy.input("Now then... Why don't you introduce yourself?")
 $ name = name.strip()
And "a" is only being used for the custom name...

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Problem with custom names in a new .rpy file

#6 Post by Remix »

Do you have a
default name = "Bob"
or somesuch? If not, add one.

I'd also advise using a variable name that is a bit more obscure than just 'name'. That might well clash with inner workings of Ren'py
Frameworks & Scriptlets:

Altali
Newbie
Posts: 4
Joined: Sat Dec 30, 2017 6:35 pm
Location: Brazil
Contact:

Re: Problem with custom names in a new .rpy file

#7 Post by Altali »

Only now i noticed that the problem resides in the fact that i made the script use a name before the input....
But thanks for the tips!

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], piinkpuddiin, snotwurm