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

Terozu

It's been like 4 years, my lifes spiraling. Yay.
Veteran
Joined
Mar 3, 2019
Messages
82
Reaction score
42
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.
 

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
178
Reaction score
143
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

It's been like 4 years, my lifes spiraling. Yay.
Veteran
Joined
Mar 3, 2019
Messages
82
Reaction score
42
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.
 

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
178
Reaction score
143
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

It's been like 4 years, my lifes spiraling. Yay.
Veteran
Joined
Mar 3, 2019
Messages
82
Reaction score
42
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

It's been like 4 years, my lifes spiraling. Yay.
Veteran
Joined
Mar 3, 2019
Messages
82
Reaction score
42
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
404
Reaction score
217
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.
 

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
178
Reaction score
143
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

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,045
Reaction score
16,852
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

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
178
Reaction score
143
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

It's been like 4 years, my lifes spiraling. Yay.
Veteran
Joined
Mar 3, 2019
Messages
82
Reaction score
42
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

It's been like 4 years, my lifes spiraling. Yay.
Veteran
Joined
Mar 3, 2019
Messages
82
Reaction score
42
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

It's been like 4 years, my lifes spiraling. Yay.
Veteran
Joined
Mar 3, 2019
Messages
82
Reaction score
42
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
404
Reaction score
217
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.
 

KurayamiBlackheart

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
178
Reaction score
143
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

Ok. I am seriously going to make efforts to stop double-posting because I got suspended for two days because of doing it too much. Lmao; am I the only one who got a suspension for this? Probably not, but I'd still like to know LOL.
I always hated when the an NPC disappears for the night they just blink out. Finally got around to making a fade out/in for any NPCs that leave/comeback for the night or day.
LmHbTL.png


Continuing our countdown with Capsule Monster #10 Curl Shot! A powerful ranged attacker, you're better off double teaming him with magic users to defeat!!
TSR
Taking a break from mapping, I've been working on the shop scene lately.Capture d’écran, le 2023-06-09 à 17.18.41.png


The project is going well, it's just I rarely share clips and stuff 'round here

Forum statistics

Threads
131,777
Messages
1,223,257
Members
173,547
Latest member
KamiPawa
Top