[RMMV] I finally got a system set up to allow players to use Custom Pronouns. Is there an easier way for this?

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
I thought 'how hard could it be'?
Then it occurred to me that every instance of a pronoun would have to account for whether it would need to be capitalized or not. Hahaha. So I eventually frankensteined this monstrosity off basic coding tips on the Javascript site and some things I saw on here.
Woo.png

So for the sake of making me feel stupid, would there be an easier way to do this? I'm not exactly a coder so I might just be dumb.
 

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
What is $gameVariables.setValue(0)'s purpose ? You don't seem to use a variable ID 0, not even sure if a variable 0 exists to begin with. and you don't set it to anything, pretty sure setValue is a function that requires 2 arguments to begin with ?

Also copy/pasting your code for each actors or each whatever is unnecessary, you could just use a variable instead of actor(3), actor(4), actor(5), so that it would become actor($gameVariables.value(<variable id>)). Which will pretty much get rid of every copy/paste of the code you made.
 

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
Gonna be honest, I probably just copy pasted it so that I wouldn't keep having to go back to the site.
As for your second paragraph, I'm not sure what that actually means?

What I have set up is that the player can enter custom pronouns into Actors 2-5, (one for each form, Subjective, Objective, Possessive, and a secondary possessive for for cases like 'his' so I can't just add an s in text, then this runs, takes that text and capitalizes the first letter. Each pronoun is then stored as a Variable with the first letter capitalized so I can call on it whenever.

If you could write it out what you mean, I feel like I would understand better, sorry, I'm not really a coder.
 

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
Gonna be honest, I probably just copy pasted it so that I wouldn't keep having to go back to the site.
As for your second paragraph, I'm not sure what that actually means?

What I have set up is that the player can enter custom pronouns into Actors 2-5, this then runs, takes that text and capitalizes the first letter.

If you could write it out what you mean, I feel like I would understand better, sorry, I'm not really a coder.
I meant that you should use loops or labels. So that you don't have to write the same code for each actor. just replace the ID of the actor by a variable (in your code), set this variable and run the code.
 

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
Oh, so you mean like, set a game variable to equal the needed players name, then just use that variable in the code, right.
So outside of script Variable 1 = Actor 1's name, run script with Variable 1, then Variable 1 = Actor 2's name, repeat?
 

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
I meant that you should use loops or labels. So that you don't have to write the same code for each actor. just replace the ID of the actor by a variable (in your code), set this variable and run the code.
Actually, since each one has to get stored as a separate Variable, 1st instance assigns Variable 2. second instance assigns Variable 3, and so on, how would that work?
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
321
Reaction score
174
First Language
English
Primarily Uses
Yeah, there's a lot easier way.
Unfortunately it's a paid plug-in now but:
Message macros.
All you'd need to do is the following:
Use the plugin and turn on quick macros.
Let's say you have var 1, var 2, var 3, etc. for variations.
You can have a macro that calls var 1, let's say var 1 is the equivalent of She but different versions of it. You can make the call code for var 1 She. Now, going forward, type out every instance of uppercase she as \She and it'll be replaced by the player-customizable var 1.

Next, do the same for the other pronouns with different variables. So, now, in your text, you simply need to use a single gendered pronoun with a \ in front and it'll get changed into the player's preferred pronouns.

Only problem is that it's not case sensitive, but the way around it is to either A: edit the plugin to be case sensitive or B: Change the macros like so: \She and \1she for upper lower case.
 

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
Actually, since each one has to get stored as a separate Variable, 1st instance assigns Variable 2. second instance assigns Variable 3, and so on, how would that work?
No... I meant instead of this :
$gameActors.actor(2).name().chatAt(1);
(few lines below...)
$gameActors.actor(3).name().chatAt(1);
(few lines below...)
$gameActors.actor(4).name().chatAt(1);

just replace the first code by this :
$gameActors.actor($gameVariables.value(x)).name().chatAt(1);
so that you run the same code for each actor, instead of copying the code just to change the actor ID, why not set the actor ID in a variable to begin with ?
 
  • Like
Reactions: Bex

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,718
Reaction score
15,843
First Language
English
Primarily Uses
RMMV
Assuming it's a single word that you want capitalised, use Control Variables and put the following in the Script line.

Code:
$gameActors.actor(2).name().charAt(1).toUpperCase() + $gameActors.actor(2).name().slice(1).toLowerCase()
 
  • Love
Reactions: Bex

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
Assuming it's a single word that you want capitalised, use Control Variables and put the following in the Script line.

Code:
$gameActors.actor(2).name().charAt(1).toUpperCase() + $gameActors.actor(2).name().slice(1).toLowerCase()
I would also replace 2 by a variable that I would define before definining this particular variable.

also you could always make a new variable for your actors like :
$gameActors.actor(2)._pronoun = "She" or whatever. then checking the "_pronoun" variable of the actor will give you its pronoun.
 

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
I would also replace 2 by a variable that I would define before definining this particular variable.

also you could always make a new variable for your actors like :
$gameActors.actor(2)._pronoun = "She" or whatever. then checking the "_pronoun" variable of the actor will give you its pronoun.
Variables didn't seem to persist outside of their initial script call the way I was doing this. I assumed it was just part of how the system worked, was that not right?
 

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
Assuming it's a single word that you want capitalised, use Control Variables and put the following in the Script line.

Code:
$gameActors.actor(2).name().charAt(1).toUpperCase() + $gameActors.actor(2).name().slice(1).toLowerCase()
This... is exactly what I was trying to do. I knew there had to be an easier way, jesus. That's a single line lmfao.
 

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
Yeah, there's a lot easier way.
Unfortunately it's a paid plug-in now but:
Message macros.
All you'd need to do is the following:
Use the plugin and turn on quick macros.
Let's say you have var 1, var 2, var 3, etc. for variations.
You can have a macro that calls var 1, let's say var 1 is the equivalent of She but different versions of it. You can make the call code for var 1 She. Now, going forward, type out every instance of uppercase she as \She and it'll be replaced by the player-customizable var 1.

Next, do the same for the other pronouns with different variables. So, now, in your text, you simply need to use a single gendered pronoun with a \ in front and it'll get changed into the player's preferred pronouns.

Only problem is that it's not case sensitive, but the way around it is to either A: edit the plugin to be case sensitive or B: Change the macros like so: \She and \1she for upper lower case.
Isn't that no different than just calling the \V[X]?
My problem was getting the variable to the proper value lol.
 

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
321
Reaction score
174
First Language
English
Primarily Uses
Isn't that no different than just calling the \V[X]?
My problem was getting the variable to the proper value lol.
Ah. I mean, it's still easier since you'd be able to just type normally, just adding a \ where appropriate rather than needing to memorize variable numbers.

But what you're trying to do is just to take the player input, capitalize it so you have it in a different variable for the start of sentences, right? Yeah, then Shaz's is the way to do it. I did something similar myself in a single line, so I didn't quite see what you were doing for what it was, sorry about that.
 

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
Variables didn't seem to persist outside of their initial script call the way I was doing this. I assumed it was just part of how the system worked, was that not right?
variables value do persist (inside $gameVariables), global JS variable too (at least if you put them inside the same script code in the common event).
 

Latest Threads

Latest Posts

Latest Profile Posts

Remember to do your 0,01% progress on your game today!
Went to see Jujutsu Kaisen 0 yesterday, it was cool. The movie wasnt really a masterpiece, it had some pacing and characterization problems, but overall I enjoyed it, maybe because it was the first anime film I have ever been to in the cinema lol. The battle animation & music were top-notch. I havent seen much of the anime so people who watched the entire season would probably like it more.
MainMenu.PNG
Finally satisfied with the main menu xD

The plan was to have battle sprites in the menu...But these faces from Ocean's Nostalgia look pretty damn good imo. (Will have to adjust for them ofc and maybe recolor to match the overworld/battle sprites more)
It's always disturbing to me to see my cat eating something off the bathroom floor.

Forum statistics

Threads
121,986
Messages
1,145,708
Members
160,259
Latest member
Leonson
Top