Switchable Text v1.2 for RPG Maker MZ

Hey RPG Makers!

McKathlin has added several great new features to her Switchable Text plugin for RPG Maker MZ!

  • Use \OPS to switch text based on party size!
  • Use \OPL to switch text based on party leader attributes!
  • Use \OPM to switch text based on any party member’s attributes!
  • Use \PartySize to get the number of the party’s size!
  • Use \NumWord to change a number to the spelled out word! (Numbers greater than 10 are left as numerals.)
  • Use \Ordinal to make the ordinal of a number. For example: 1 becomes 1st, 2 becomes 2nd, 3 becomes 3rd, etc.
  • Use \OrdinalWord to makes the spelled-out ordinal. For example: first, second, third, etc. (Numbers greater than 10 are numerals with a suffix.)

Switch Text Based on Party Size!

You can switch text based on the size of the party!

Consider these examples:

Welcome to my lair, \OPS[1]{hero}{heroes}.

If there is one member of the party, the text will display as, “Welcome to my lair, hero.” Otherwise, it will read, “Welcome to my lair, heroes.”

Hey, \OPS[>2]{buddies}\OPS[2]{buddy and friend}\OPS[1]{buddy}.

The above example uses the \OPS code three times, to account for three different possibilities of party size. If there are three or more party members, this will read as, “Hey, buddies.” If there are two party members, it will display, “Hey, buddy and friend.” If there is one party member, it will display, “Hey, buddy.”

Using the Switchable Text plugin, this text detected the size of the party. If there is 1 party member, it says, "Hey, buddy." If 2 party members, it says, "Hey, buddy and friend." If 3 or more party members, it says, "Hey, buddies."

Switch Text Based on Attributes of Party Leader or Party Members!

\OPL stands for On Party Leader, and can check various attributes, to see whether the party leader has any of those attributes. \OPM can check the same attributes, to see whether there is any party member that matches those attributes.

Attributes that can be checked include:

  • Actor ID: Write this in the switchable text as “actor” or “a“.
  • Class ID: Write this as “class” or “c“.
  • State ID: Write this as “state” or “s“.

Examples:

What are you doing, \OPL[a=5]{old man}{kid}?

If the party leader is actor 5, then the text will display, “What are you doing, old man?” Otherwise, it will display, “What are you doing, kid?”

Put your \OPL[class<=2]{might}{skill} to the test!

If the party leader’s class is less than or equal to 2, then this will display, “Put your might to the test!” Otherwise, this will show, “Put your skill to the test!”

A good meal restores health.\OPM[s=1]{ But it can’t revive the dead.}

In this case, \OPM checks if any of the party members are in state 1 (which is the “death” state by default). If none of the party members are in state 1, then this reads, “A good meal restores health.” However, if any of the party members are in state 1, then this reads, “A good meal restores health. But it can’t revive the dead.”

To identify which actor ID, class ID, or state ID you want to check, you can find the lists of these in your project’s Database, under the “Actors”, “Classes”, and “States” tabs.

Additional Text Codes!

This plugin also adds several useful text codes! While not technically “switchable” text, these codes are very useful in many situations.

  • \PartySize is replaced with the number of the party’s size.
  • \NumWord[expr] replaces expr with the word version of the number. e.g. one, two, three, four, five, six, seven, eight, nine, or ten. Numbers greater than 10 are not altered.
  • \Ordinal[expr] makes the ordinal version of a numeric expression. e.g. 1st, 2nd, 3rd… Works on all numbers, including numbers greater than 10.
  • \OrdinalWord[expr] makes the spelled-out ordinal, e.g. first, second, third… Numbers greater than 10 become numerals with a suffix.

The \NumWord, \Ordinal, and \OrdinalWord text codes can be used on RPG Maker’s default \V[n] text code, on \PartySize, or on anything else that resolves to a number! (Note that if you plan on using these features on text codes from any other plugin, you will need to put McKathlin_SwitchableText under such plugins.)

Examples:

You have squished \NumWord[\V[22]] bugs.

The above example checks the value of variable 22. If the value is any number from 1 to 10, the number is changed into the corresponding word. If greater than 10, the number remains unaltered.

A \NumWord[\PartySize]-person party like yours would be in for a challenge.

In this example, the party size number is determined, and that number is changed into a word.

\Ordinal[\V[75]] Place

The above checks variable 75 to determine which number it contains. Then, the number is changed into ordinal form, such as 1st, 2nd, 3rd, 4th…11th, 12th, 13th…100th, 101st, 102nd, etc.

You’re our \OrdinalWord[\V[158]] visitor!

The above checks variable 158 to determine which number it holds. The number is then changed into an ordinal form, similar to the previous example. However, in cases of any number from 1 to 10, the word of the ordinal will be written out. e.g. first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, 11th, 12th, 13th, 14th…100th, 101st, 102nd, etc.

Come in\OPS[>1]{, \OPS[2]{both of you}{all \NumWord[\PartySize] of you}}!

The above example uses \OPS to make switchable text based on the party size. If the party size is 1, this simple reads, “Come in!” If the party size is 2, this reads, “Come in, both of you!” If the party size is 3 or more, then \PartySize gives the number of party members, and \NumWord changes that number into a word, which is then used. For example, if there are 8 party members, it reads, “Come in, all eight of you!”

You are not logged in.
Download available to supporters of the Design Counselor level and higher.

To install:

  1. Download the file, and unzip it.
  2. Make sure the unzipped file is named McKathlin_SwitchableText.js and is saved as a .js file.
  3. Open the file folder of your project. Place the file in your project’s “js” folder, within the “plugins” folder.
  4. Open your project in RPG Maker MZ, then go to the Tools menu and select Plugin Manager. Use the Plugin Manager to add and activate the plugin.
  5. I recommend you place this plugin toward the bottom of your plugin list, so it has high priority.

The Switchable Text v1.2 help document is included below!

McKathlin Switchable Text for RPG Maker MZ
v1.2, updated 9/15/2020

Desciption of Plugin:

This plugin enables text codes for use in messages or dialogue choices. Text is inserted in place at runtime based on state of the referenced switch or variable.

How to use this plugin:

To start a switch-based snippet, use one of the following text codes:

  • \ON[ID]{text} Show the contained text if the switch is ON (true).
  • \OFF[ID]{text} Show the contained text if the switch is OFF (false).
  • \ON[ID]{foo}{bar} Show “foo” if switch is on; otherwise show “bar”.
  • \OFF[ID]{blue}{red} Show “blue” if switch is off; otherwise show “red”.

An integer ID will check the corresponding game-wide switch. If the ID is the letter A, B, C, or D, then the calling event’s self switch is checked.

Start a variable-based snippet with a statement like this:

  • \OV[vID>=N]{text} Show the text if the variable with the given ID has a value greater than or equal to N.
  • \OV[vID==N]{foo}{bar} Show “foo” if the variable’s value is equal to N; Otherwise, show “bar”.
  • \OV[vJ < vK]{blah} Show “blah” if variable J’s value is less than variable K’s value.

Some statements allow for text snippets based on party attributes.

\OPS stands for On Party Size.

Example:

  • \OPS[1]{hero}{heroes} Show “hero” if party size is 1, otherwise show “heroes”

\OPL stands for On Party Leader, and can check various actor attributes.

\OPM stands for On Party Member, and is true if any member matches.

When checking an attribute, use a comparison operator and numeric ID.

Here is a full list of attributes that can be checked:

  • Actor ID: Write this as “actor” or “a“.
  • Class ID: Write this as “class” or “c“.
  • State ID: Write this as “state” or “s“.

Examples using \OPL or \OPM:

  • Hey \OPL[a=5]{old man}{kid}.
  • Put your \OPL[class<=2]{might}{skill} to the test!
  • A good meal restores health.\OPM[s=1]{ But it can’t revive the dead.}

The following comparison operators are valid for variable-based snippets:

== Equal
!= Not equal
>= Greater or equal
> Greater than
<= Less or equal
< Less than

If a dialogue choice ends up empty for a given Switchable state, it will not appear in the player’s list of dialogue choices. This allows available choices to vary dynamically based on game state.

Due to Switchable Text’s use of curly braces as delimiters, any text in which switchable snippets and literal curly braces both occur will need to escape the literal curly braces thus:

  • \BO Opening brace {
  • \BC Closing brace }

This plugin offers the following additional text codes:

\PartySize Replaced with number of party members.

\NumWord[expr] Replaces expr with the word version of the number: e.g. one, two, three… Numbers greater than 10 are left as numerals.

\Ordinal[expr] Makes the ordinal version of a numeric expression: e.g. 1st, 2nd, 3rd…

\OrdinalWord[expr] Makes the spelled-out ordinal, e.g. first, second, third… Numbers greater than 10 are numerals with a suffix.

\NumWord[expr], \Ordinal[expr], and \OrdinalWord[expr] can enclose \V[n], \PartySize, and anything else that resolves to a number. Note: If you plan to use these features on text codes from other plugins, put McKathlin_SwitchableText UNDER these plugins.

Examples using \PartySize, \NumWord, \Ordinal, and \OrdinalWord:

  • You have squished \NumWord[\V[22]] bugs.
  • A \NumWord[\PartySize]-person party like yours would be in for a challenge.
  • \Ordinal[\V[75]] Place
  • You’re our \OrdinalWord[\V[158]] visitor!
  • Come in\OPS[>1]{, \OPS[2]{both of you}{all \NumWord[\PartySize] of you}}!

More Examples:

  • Good \ON[21]{evening}{day}, \OFF[A]{stranger}{friend}. Go safely. \OV[143<=10]{Watch out for wolves.}
  • Excuse me for a moment. My \OV[v2>1]{\ON[41]{enemies}{friends} have}{\ON[41]{enemy}{friend} has} arrived.
  • We have\OV[v22!=v23]{n’t} squished the same number of bugs.

This plugin does not use any parameters or plugin commands.

Version History:

v1.0: 9/3/2020

  • Switchable Text plugin released for RPG Maker MZ!

v1.1: 9/13/2020

  • Added nested text snippets! Now, you can use switchable text snippets nested within each other!
  • Added variable-to-variable comparison. You can now check one variable’s value against the value of another variable.

v1.2: 9/15/2020

  • Added \OPS, which switches text based on party size.
  • Added \OPL, which switches text based on party leader attributes.
  • Added \OPM, which switches text based on any party member.
  • Added \PartySize, a text code for number of people in party.
  • Added \NumWord, \Ordinal, and \OrdinalWord, which change how numbers are written out.

Terms of Use:

  1. You joined Tyruswoo.com as a paying member when you downloaded this plugin. You do not have to remain a paying member to use the plugin you downloaded. However, your support is greatly appreciated, and allows me to continue improving and updating plugins.
  2. You agree to not redistribute this plugin. You agree to direct others to Tyruswoo.com if they want the plugin.
  3. You may use this for any game for which you are one of the main developers. This includes any commercial or non-commercial game you are creating.
  4. Adding “McKathlin” to your game’s credits is greatly appreciated, but not required.
  5. Likewise, listing which Tyruswoo Team plugins you used is appreciated, but not required.
  6. A free copy of your game is awesome, but not required.

Enjoy the plugin!
-McKathlin

A big thank you to McKathlin for this update to her Switchable Text plugin for RPG Maker MZ!

Tyruswoo

Questions or concerns? Check out the forums to ask a question. You may even find an answer there, already!

To view and submit comments on this post, you must be logged in and joined as at least a Warm Fuzzy member. Log In No account, or ready to upgrade your membership? Join the adventure!

Tyruswoo

Indie Game Designer
creating game content!

Latest RPG Maker

Pin It on Pinterest

Shares