Original Source
- Original title: VsConvertEscapeCharacters - Custom escape characters
- Original author: VsRpgDev
- Original date: January 26, 2025
- Source thread: https://forums.rpgmakerweb.com/threads/vsconvertescapecharacters-custom-escape-characters.174963/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > JS Plugin Releases (RMMZ)
Summary
VsConvertEscapeCharacters + 1.1.0 VsRpgDev Introduction This plugin allows you to register custom escape characters, which lets you, for example, access custom values from your plugin, trigger methods, draw images, etc., when a text message is displayed.
Archived First Post
VsRpgDev
Introduction
This plugin allows you to register custom escape characters, which lets you, for example, access custom values from your plugin, trigger methods, draw images, etc., when a text message is displayed.
Additionally, you can use convertEscapeCharacters from anywhere in the code through the static class VsConvertEscapeCharacters.
Readme
Features
- registerEscapeCharacter
registers a new escaped character
- registerProcessEscapeCharacter
register a new escaped character (gets handled later then registerEscapeCharacter)
- convertEscapeCharacters
converts escaped characters in a text
How to Use
registerEscapeCharacter
// arrow functions -------------
VsConvertEscapeCharacters.registerEscapeCharacter("X",(text)=> {
return "your text was "+text;
});
// old style -------------------
function ReplaceText(text)
{
return "your text was "+text;
}
VsConvertEscapeCharacters.registerEscapeCharacter("X",ReplaceText);
registerProcessEscapeCharacter
// arrow functions -------------
VsConvertEscapeCharacters.registerProcessEscapeCharacter("X",(currentWindow, textState, param)=> {
//do whatever you like
//example draw icon
currentWindow.processDrawIcon(param, textState);
});
// old style -------------------
function CustomMethod(currentWindow, textState, param)
{
return "your text was "+text;
//do whatever you like
//example draw icon
currentWindow.processDrawIcon(param, textState);
}
VsConvertEscapeCharacters.registerProcessEscapeCharacter("X",CustomMethod);
convertEscapeCharacters - get escaped character from wherever you want
finalText = VsConvertEscapeCharacters.convertEscapeCharacters(text);
Plugin Commands / Script Calls
declare class VsConvertEscapeCharacters
{
static convertEscapeCharacters(text: string) : string;
static actorName(n: string) : string;
static partyMemberName (n:string) : string;
/**
* register a new escape character
* @param char escape character to use
* @param method callback method which gets the paramter from within the brackets [] and should return the replacement text
*/
static registerEscapeCharacter(char : string, method: (string)=>string) : string;
/**
* retursn all registered escape characters
*/
static get CustomEscapeCharacters() : { [id: string]:(string)=>string; };
/**
* register process escape character, these get processed character by character when the textbox draws the message text
* @param char scape character to use
* @param method callback method which gets the the current windows, the textstate and paramter from within the brackets [] and should return the replacement text
*/
static registerProcessEscapeCharacter(char : string, method: (windowBase:Window_Base, state: TextState, param: string)=>void) : string;
static get ProcessEscapeCharacter() : { [id: string]: (windowBase:Window_Base, state: TextState, param: string)=>void; };
}
Changes to the core script
- rmmz_windows.js
- Window_Base
- [M] convertEscapeCharacters: overrides,original gets called after
- [M] processEscapeCharacter: overrides,original gets called after
- Window_Base
Demo
demo.js
Download
VsConvertEscapeCharacters.js (Plugin)
Github Repository
Terms and Credits
VsConvertEscapeCharacters is marked with CC0 1.0 Universal. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/
This plugin can be used in any project, commercial or otherwise. no credit needed.
Features Mentioned
- registerEscapeCharacter
- registers a new escaped character
- registerProcessEscapeCharacter
- register a new escaped character (gets handled later then registerEscapeCharacter)
- convertEscapeCharacters
- converts escaped characters in a text
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
Terms and Credits VsConvertEscapeCharacters is marked with CC0 1.0 Universal. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/ This plugin can be used in any project, commercial or otherwise. no credit needed.
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
Topic Summary
Loading summary...