Auto lower/upper-case of variables in dialogue ?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Auto lower/upper-case of variables in dialogue ?

Post by Abelius »

Hi Tony,

I've searched the forum but didn't find a mention of it, so this will probably turn into a feature suggestion.

There's one nice thing from Adventure Creator, that goes like this...:

Image

This is referred to a Hotspot. You can use their names in dialogues in a similar fashion as Dialogue System variables. This setting in particular does as it says, though, giving extra control.

That's a nice feature to have, because if we want to use a pronoun variable (she, he, they, etc), we'd also need to account for the upper-cased version at the start of sentences.

In DS (unless I'm missing something), I'd need to create two variables (pronoun and Pronoun) and remember to use the correct one when writing dialogue and/or changing the position of those pronouns (from the start to the middle of a sentence).

I think it would be dope if we could write the value of the pronoun in lower-case, and then DS turning the first letter to upper-case if at the start of a sentence (or using AC's approach, the opposite).

Examples:

[var=pronoun] wouldn't do that!
The last time [var=pronoun] did it was just this morning.

He wouldn't do that!
The last time he did it was just this morning.


Granted, determining what would constitute the start of a sentence could a bit tricky at times, but a good starting point would be to declare a word's first letter upper-case, if...:

- it's after a dot and a space
- it's at the start of the subtitle text
- it's after a colon character (so "Mike: [var=pronoun] wouldn't do that!" would still work as intended).

Your thoughts?

Thank you!
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Tony Li »

What about adding a [pronoun=variable] tag?

So if there are two variables named "partner" (set to "she") and "rival" (set to "he"), then this:
  • Dialogue Text: "[var=partner] is just my type. Maybe[var=he] can introduce me."
would display: "she is just my type. Maybe he can introduce me."

But this:
  • Dialogue Text: "[pronoun=partner] is just my type. Maybe [pronoun=he] can introduce me."
would display: "She is just my type. Maybe he can introduce me."

Alternatively, I could add tags [Var=variable] and [Lua(code)] that always capitalize the first letter. Example:
  • Dialogue Text: "[Var=partner] is just my type. Maybe[var=he] can introduce me."
would display: "She is just my type. Maybe he can introduce me."

I'm leaning more toward the latter. It more explicitly shows what's going to be capitalized.
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Abelius »

Err... I'm not sure we're understanding each other. :P

Or maybe I should have explained my actual use case better.

I'm making an adult game, and we creators are having a hard time with woke platforms like Patreon, which has draconian Terms & Conditions, regarding their poor tolerancy for perfectly legal topics (as long as they're only done in video games). They don't like them, so they prohibit them, which is sad as hell if you ask me.

So, one way to circumvent those limits is to let the player decide how he wants to define the relationship between two characters.

Hence, at some point in the game, the player would need to manually introduce an answer to a question like this...:

"Emily has arrived at your home. By the way, what she is for you...?"

And then the player will need to write down the word "friend", "sister", "slave", or whatever the hell he wants because we live in a damned freaking free country, you know? :lol:

Anyway, that means that "pronoun" variable in my game won't actually be a pronoun, but the term the player has chosen, which he may have written capitalized, or not.

And so a necessity to automatically upper-case or lower-case that variable has been born.
Edited: No longer true. A new tag would be nice.
This means I'd still prefer to use variables to do this, instead of a new named tag.
Do you think it would be possible?
Last edited by Abelius on Fri Jan 29, 2021 6:28 pm, edited 2 times in total.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Tony Li »

I think that still works. Let the player enter a relationship term for Emily. For example, say you use a variable named emilyRelationship. Then you could set it up like this:
  • Dialogue Text: "By the way, what is she for you?"
  • Sequence: TextInput(Text Field UI, Relationship:, emilyRelationship)
  • Dialogue Text: "Okay, Emily is your [var=emilyRelationship]."
and
  • Dialogue Text: Player: "[Var=emilyRelationship], come take a look at this."
Let's say a very boring player enters "platonic friend". Then [var=emilyRelationship] would be "platonic friend", and [Var=emilyRelationship] would be "Platonic friend".
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Abelius »

I see a potential problem with that.

I don't think you (or the users) want [var=...] tags behaving different as currently. That is, NOT altering the value of strings.

So, in this example, if the player introduces "Platonic friend" instead of "platonic friend", it will still be read as capitalized, and we'd have the same capitaled string for both [var=...] and [Var=...] tags.

Also, and more importantly, having two ways of referencing both lower and upper case versions is what I wanted to avoid, as the title of my thread assumes (Auto...) :P

My suggestion would be to create a clearly different tag like [autocase=<variable>], that still behaves like the normal [var=<variable>] tag, but with additional processing that takes into account where the word will be placed, and lower or upper-casing the first letter as appropriate, regardless of the current value of the source variable.

How that sounds?
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Tony Li »

Makes complete sense! What tag do you prefer? [pronoun=], [autocase=], or something else?
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Abelius »

As this could be used for pronouns, relationship types, place names, or whaever people can think of, I guess [autocase=] would be preferrable, as the "auto-casing" function is the main point of such a tag. :roll:

Thank you for this in advance, and basically for all what you've done. This plugin is amazing, and you are amazing. :mrgreen:
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Tony Li »

[autocase] it is, then! I'll try to get a patch out by the end of the weekend. And thank you! Several folks here such as you are responsible for a great majority of improvements to the Dialogue System by sharing your suggestions.
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Auto lower/upper-case of variables in dialogue ?

Post by Abelius »

Great! I'll test it tomorrow. :mrgreen:
Unity 2019.4.9f1
Dialogue System 2.2.15
Post Reply