[Solved] Customize name_only character without getting Lint warning

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
User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

[Solved] Customize name_only character without getting Lint warning

#1 Post by SleepKirby » Sun Mar 18, 2018 5:28 am

Some of my scenes use generic, one-off speaker names like "Girl 1" "Boy 2" and so on. I can't really be bothered to define a unique Character object for each of those speakers. As far as I know, this is the use case for the name_only character, which is automatically used when I have the character name as a string, like this:

Code: Select all

"Girl 1" "Nice weather today."
I do want to customize the appearance of these speakers' dialogue. I just don't need to customize them individually. So I redefine the name_only character, similar to how the narrator character is redefined in the Ren'Py tutorial:

Code: Select all

define name_only = Character("", kind=my_base_character, color="#FFFFFF")
And it works as expected. Girl 1's line is styled accordingly. But Lint has something to say about the code:
game/main.rpy:80 'define name_only' replaces a Ren'Py built-in name, which may cause problems.
I haven't seen any actual problems in game behavior related to this, but it just seems like I should be listening to Lint. Or at least cleaning up my Lint messages. There is no such Lint error when redefining the narrator character, so I'm wondering if name_only is even intended to be customized with a redefine like this. Is there another way?

I'm thinking it'd be possible to do stuff like name_only.color = "#FFFFFF", but that seems dependent on undocumented internals and therefore fiddly. And looking at the ADVCharacter code, I'm pretty sure name_only.kind = my_base_character isn't going to do anything useful.

Sorry if I missed some threads related to name_only. It doesn't seem to be the easiest concept to do a keyword search on.
Last edited by SleepKirby on Tue Mar 27, 2018 9:09 pm, edited 1 time in total.

User avatar
DragonKnight
Regular
Posts: 50
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: Customize name_only character without getting Lint warning

#2 Post by DragonKnight » Sun Mar 18, 2018 5:38 am

Lint is not a substitute for thorough testing. Remember to update Ren'Py
before releasing. New releases fix bugs and improve compatibility.
Lint says it all, not a substitute. Just test..
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: Customize name_only character without getting Lint warning

#3 Post by SleepKirby » Sun Mar 18, 2018 5:57 am

Well, there's also this bit in the Quickstart:
[Lint] will check your games for potential errors. Since some of these errors will only affect users on other platforms, it's important to understand and usually fix all errors, even if you don't see the problem on your computer.
I know Lint's not meant to be perfect, but if I'm actually using name_only in Ren'Py's intended way and it leads to an unavoidable Lint message, then something seems off. So I'm asking if I'm using name_only correctly. If I am, then maybe that means Lint should be improved to not produce this message.

User avatar
Ocelot
Miko-Class Veteran
Posts: 849
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: Customize name_only character without getting Lint warning

#4 Post by Ocelot » Sun Mar 18, 2018 6:36 am

It seems that name_only character does not contain anything out of ordinary, which would break after complete redefining (unlike, say, extend character). So, I would assume that it is false positive. It was probably not caught, because almost nobody had the need to redefine that character before.
< < insert Rick Cook quote here > >

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: Customize name_only character without getting Lint warning

#5 Post by SleepKirby » Sun Mar 18, 2018 3:33 pm

Yeah Ocelot, you're probably right. I saw this GitHub issue related to redefining name_only, and it seems like redefining is the intended usage. As of 2015, at least.

I'll poke around the Renpy code and see if I can figure out why narrator doesn't trigger Lint, while name_only does.

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: Customize name_only character without getting Lint warning

#6 Post by SleepKirby » Tue Mar 27, 2018 9:09 pm

(Slightly late) Update: PyTom resolved this by excluding name_only and a bunch of other names from Lint redefine warnings. The change is in the 6.99.14.2 prerelease.

So to answer this thread: There's nothing wrong with redefining name_only, and now it doesn't get a Lint warning anymore.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]