The RPG Maker Resource Kit

RMRK RPG Maker Creation => MV => MV Scripts Database => Topic started by: yuyu! on March 16, 2016, 08:16:15 PM

Title: [MV] Gender Message Codes (yea I made a script OK)
Post by: yuyu! on March 16, 2016, 08:16:15 PM
Gender Message Codes
Version: 1.1
Author: yuyu!
Date: March 16, 2016

Version History



Description


This plugin will allow you to swap between male and female gender text. I recommend that you use this for a game with one main character, namely if you can select or customize that character. You can also specify a switch for the character's gender. :]

*This is my first script, so please bear with me if I goofed up the code somewhere. It's pretty simple though, so hopefully I didn't screw anything up. ;o

Screenshots

Spoiler for:
(http://i.imgur.com/EERYn6P.png?1)
(http://i.imgur.com/Dctgy85.png?1)


Instructions

Save the .js file in your plugins folder and import it through the Plugin Manager.  Please make sure that the file name is "Yuyu_GenderMessageCodes.js ". ;o

Plugin


Code: [Select]
//=============================================================================
// Yuyu!'s Gender Message Codes
// Yuyu_GenderMessageCodes.js
// Version: 1.1
//=============================================================================
//
//=============================================================================
// ** SPECIAL THANKS **
// Neko - Who's gender script inspired this one
// Yanfly - Who's code I looked to when I got lost
// SoulPour - Who's tutorials I looked to when I got lost
//
// (also I love boe)
//=============================================================================

var Imported = Imported || {};
Imported.Yuyu_GenderMessageCodes = true;

var Yuyu = Yuyu || {};
Yuyu.Message = Yuyu.Message || {};

//=============================================================================
/*:
* @plugindesc Use message codes for gender text!
* @author Yuyu! of RMRK.net

* @param Switch ID
* @desc The switch ID used for the player's gender.
* ON = Male, OFF = Female.
* @default 1
*
*
* @help
* ============================================================================
* Introduction
* ============================================================================
*
* This plugin will allow you to swap between male and female gender text.
* I recommend that you use this for a game with one main character, namely if
* you can select or customize that character.
*
* ============================================================================
* Message Codes
* ============================================================================
*
* Below is a list of pronouns and their lowercase (ex: "man")
* and capitalized (ex: "Man") codes. These codes will be replaced
* with the player's chosen gender when used.
*
* Most of the codes will be the two swapped words (ex: "\hisher").
* There are a few exceptions (himself/herself, prince/princess,
* guy/gal), which will be indicated by a "*".
*
* Note: For contractions and plural forms, simply add "s" or "'ll"
* at the end of the code. The game should read the code and add that
* part on its own.
* Ex: \heshe'll will create "he'll" or "she'll".
* Ex: \BoyGirls will created  "Boys" or "Girls"
*
*  ** Codes ARE CaSe SeNSiTivE! **
*
* -------------------------------------------------
* PROUNOUN LOWERCASE CODE   CAPITALIZED CODE
* -------------------------------------------------
*
* Man/Woman: \manwoman       \ManWoman
* Men/Women: \menwomen       \MenWomen
* Boy/Girl:         \boygirl        \BoyGirl
*
* He/She:           \heshe          \HeShe
* Him/Her:          \himher         \HimHer
* His/Her:          \hisher         \HisHer
* His/Hers:         \hishers        \HisHers
* *Himself/Herself: \self           \Self
*
* Lad/Lass:         \ladlass        \LadLass
* Sir/Ma'am:        \sirmaam        \SirMaam
* Dude/Chick:       \dudechick      \DudeChick
* Lord/Lady:        \lordlady       \LordLady
* *Prince/Princess: \prince         \Prince
* King/Queen:       \kingqueen      \KingQueen
* Mister/Miss:      \mistermiss     \MisterMiss
* Mr./Ms.:          \mrms           \MrMs
* *Guy/Gal:         \pguygal         \pGuyGal
*
* Brother/Sister:   \brothersister  \BrotherSister
* Bro/Sis:          \brosis         \BroSis
* Son/Daughter: \sondaughter \SonDaughter
* Father/Mother: \fathermother \FatherMother
* Dad/Mom:          \dadmom         \DadMom
* Daddy/Mommy:      \daddymommy     \DaddyMommy
* Papa/Mama:        \papamama       \PapaMama
* Husband/Wife:     \husbandwife    \HusbandWife
*
*/
//=============================================================================

//=============================================================================
// Parameter Variables
//=============================================================================

var params = PluginManager.parameters('Yuyu_GenderMessageCodes');
var switchId = Number(params['Switch ID'] || 1);

//=============================================================================
// Code Set-Up
//=============================================================================

Window_Message.prototype.convertMessageCharacters = function(text)
{

var gender = $gameSwitches.value(switchId);

// -------- MAN/WOMAN --------
text = text.replace(/\x1bmanwoman/g, function() {
if (gender == true)
    return "man";
else
return "woman";
}.bind(this));
text = text.replace(/\x1bManWoman/g, function() {
if (gender == true)
    return "Man";
else
return "Woman";
}.bind(this));

// -------- MEN/WOMEN --------
text = text.replace(/\x1bmenwomen/g, function() {
if (gender == true)
    return "men";
else
return "women";
}.bind(this));
text = text.replace(/\x1bMenWomen/g, function() {
if (gender == true)
    return "Men";
else
return "Women";
}.bind(this));

// -------- BOY/GIRL --------
text = text.replace(/\x1bboygirl/g, function() {
if (gender == true)
    return "boy";
else
return "girl";
}.bind(this));
text = text.replace(/\x1bBoyGirl/g, function() {
if (gender == true)
    return "Boy";
else
return "Girl";
}.bind(this));

// -------- HE/SHE --------
text = text.replace(/\x1bheshe/g, function() {
if (gender == true)
    return "he";
else
return "she";
}.bind(this));
text = text.replace(/\x1bHeShe/g, function() {
if (gender == true)
    return "He";
else
return "She";
}.bind(this));

// -------- HIM/HER --------
text = text.replace(/\x1bhimher/g, function() {
if (gender == true)
    return "him";
else
return "her";
}.bind(this));
text = text.replace(/\x1bHimHer/g, function() {
if (gender == true)
    return "Him";
else
return "Her";
}.bind(this));

// -------- HIS/HERS --------
text = text.replace(/\x1bhishers/g, function() {
if (gender == true)
    return "his";
else
return "hers";
}.bind(this));
text = text.replace(/\x1bHisHers/g, function() {
if (gender == true)
    return "His";
else
return "Hers";
}.bind(this));

// -------- HIS/HER --------
text = text.replace(/\x1bhisher/g, function() {
if (gender == true)
    return "his";
else
return "her";
}.bind(this));
text = text.replace(/\x1bHisHer/g, function() {
if (gender == true)
    return "His";
else
return "Her";
}.bind(this));

// -------- HIMSELF/HERSELF --------
text = text.replace(/\x1bself/g, function() {
if (gender == true)
    return "himself";
else
return "herself";
}.bind(this));
text = text.replace(/\x1bSelf/g, function() {
if (gender == true)
    return "Himself";
else
return "Herself";
}.bind(this));


// -------- LAD/LASS --------
text = text.replace(/\x1bladlass/g, function() {
if (gender == true)
    return "lad";
else
return "lass";
}.bind(this));
text = text.replace(/\x1bLadLass/g, function() {
if (gender == true)
    return "Lad";
else
return "Lass";
}.bind(this));

// -------- SIR/MA'AM --------
text = text.replace(/\x1bsirmaam/g, function() {
if (gender == true)
    return "sir";
else
return "ma'am";
}.bind(this));
text = text.replace(/\x1bSirMaam/g, function() {
if (gender == true)
    return "Sir";
else
return "Ma'am";
}.bind(this));

// -------- DUDE/CHICK --------
text = text.replace(/\x1bdudechick/g, function() {
if (gender == true)
    return "dude";
else
return "chick";
}.bind(this));
text = text.replace(/\x1bDudeChick/g, function() {
if (gender == true)
    return "Dude";
else
return "Chick";
}.bind(this));

// -------- LORD/LADY --------
text = text.replace(/\x1blordlady/g, function() {
if (gender == true)
    return "lord";
else
return "lady";
}.bind(this));
text = text.replace(/\x1bLordLady/g, function() {
if (gender == true)
    return "Lord";
else
return "Lady";
}.bind(this));

// -------- PRINCE/PRINCESS --------
text = text.replace(/\x1bprince/g, function() {
if (gender == true)
    return "prince";
else
return "princess";
}.bind(this));
text = text.replace(/\x1bPrince/g, function() {
if (gender == true)
    return "Prince";
else
return "Princess";
}.bind(this));

// -------- KING/QUEEN --------
text = text.replace(/\x1bkingqueen/g, function() {
if (gender == true)
    return "king";
else
return "queen";
}.bind(this));
text = text.replace(/\x1bKingQueen/g, function() {
if (gender == true)
    return "King";
else
return "Queen";
}.bind(this));

// -------- MISTER/MISS --------
text = text.replace(/\x1bmistermiss/g, function() {
if (gender == true)
    return "mister";
else
return "miss";
}.bind(this));
text = text.replace(/\x1bMisterMiss/g, function() {
if (gender == true)
    return "Mister";
else
return "Miss";
}.bind(this));

// -------- MR./MS. --------
text = text.replace(/\x1bmrms/g, function() {
if (gender == true)
    return "mr.";
else
return "ms.";
}.bind(this));
text = text.replace(/\x1bMrMs/g, function() {
if (gender == true)
    return "Mr.";
else
return "Ms.";
}.bind(this));

// -------- GUY/GAL --------
text = text.replace(/\x1bpguygal/g, function() {
if (gender == true)
    return "guy";
else
return "gal";
}.bind(this));
text = text.replace(/\x1bpGuyGal/g, function() {
if (gender == true)
    return "Guy";
else
return "Gal";
}.bind(this));

// -------- BROTHER/SISTER --------
text = text.replace(/\x1bbrothersister/g, function() {
if (gender == true)
    return "brother";
else
return "sister";
}.bind(this));
text = text.replace(/\x1bBrotherSister/g, function() {
if (gender == true)
    return "Brother";
else
return "Sister";
}.bind(this));

// -------- BRO/SIS --------
text = text.replace(/\x1bbrosis/g, function() {
if (gender == true)
    return "bro";
else
return "sis";
}.bind(this));
text = text.replace(/\x1bBroSis/g, function() {
if (gender == true)
    return "Bro";
else
return "Sis";
}.bind(this));

// -------- SON/DAUGHTER --------
text = text.replace(/\x1bsondaughter/g, function() {
if (gender == true)
    return "son";
else
return "daughter";
}.bind(this));
text = text.replace(/\x1bSonDaughter/g, function() {
if (gender == true)
    return "Son";
else
return "Daughter";
}.bind(this));

// -------- FATHER/MOTHER --------
text = text.replace(/\x1bfathermother/g, function() {
if (gender == true)
    return "father";
else
return "mother";
}.bind(this));
text = text.replace(/\x1bFatherMother/g, function() {
if (gender == true)
    return "Father";
else
return "Mother";
}.bind(this));

// -------- DAD/MOM --------
text = text.replace(/\x1bdadmom/g, function() {
if (gender == true)
    return "dad";
else
return "mom";
}.bind(this));
text = text.replace(/\x1bDadMom/g, function() {
if (gender == true)
    return "Dad";
else
return "Mom";
}.bind(this));

// -------- DADDY/MOMMY --------
text = text.replace(/\x1bdaddymommy/g, function() {
if (gender == true)
    return "daddy";
else
return "mommy";
}.bind(this));
text = text.replace(/\x1bDaddyMommy/g, function() {
if (gender == true)
    return "Daddy";
else
return "Mommy";
}.bind(this));

// -------- PAPA/MAMA --------
text = text.replace(/\x1bpapamama/g, function() {
if (gender == true)
    return "papa";
else
return "mama";
}.bind(this));
text = text.replace(/\x1bPapaMama/g, function() {
if (gender == true)
    return "Papa";
else
return "Mama";
}.bind(this));

// -------- HUSBAND/WIFE --------
text = text.replace(/\x1bhusbandwife/g, function() {
if (gender == true)
    return "husband";
else
return "wife";
}.bind(this));
text = text.replace(/\x1bHusbandWife/g, function() {
if (gender == true)
    return "Husband";
else
return "Wife";
}.bind(this));

    return text;
};


Thanks



Terms of Use


Free for commercial and non-commercial use. You can credit me if you want, but the simplicity of this script doesn't really warrant that (due to my limited programming knowledge). :)
Title: Re: [MV] Gender Message Codes (yea I made a script OK)
Post by: Irock on March 16, 2016, 09:44:01 PM
wow you can't use a boolean for gender because gender isn't binary

looks neat e3e;
Title: Re: [MV] Gender Message Codes (yea I made a script OK)
Post by: yuyu! on March 16, 2016, 11:40:04 PM
The script that inspired this one did have non-binary choices, but I couldn't get it to work (I think the parameters were messed up) and the codes confused me because pronouns are too technical, mang. :( So, I decided to make this cis white script.

Or rather, I decided to make one that worked for the game I'm working on and then wanted to share it with the class. :)

also heil booleans !!!
Title: Re: [MV] Gender Message Codes (yea I made a script OK)
Post by: &&&&&&&&&&&&& on March 17, 2016, 03:20:12 PM
:O
Title: Re: [MV] Gender Message Codes (yea I made a script OK)
Post by: yuyu! on April 26, 2016, 05:09:41 AM
Updated to remove useless code that interfered with Yanfly's Message Core  D: