Whitespace causing regex to pick up wrong array content (Irina VisualNovelBusts)
BMM_Archive · July 15, 2026
Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.
Original Source
- Original title: Whitespace causing regex to pick up wrong array content (Irina VisualNovelBusts)
- Original author: Anyone
- Original date: November 14, 2019
- Source thread: https://forums.rpgmakerweb.com/threads/whitespace-causing-regex-to-pick-up-wrong-array-content-irina-visualnovelbusts.115269/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Javascript/Plugin Support
Summary
I've got a small but still annoying bug I want to fix in the Irina VisualNovelBusts plugin. (https://atelieririna.itch.io/visual-novel-busts) The Situation: If I use the escape code \bustMsgExp[x, y] in a Show text event it switches the face used in bustslot x to y. So if I make a showtext event like this:
Archived First Post
I've got a small but still annoying bug I want to fix in the Irina VisualNovelBusts plugin. (https://atelieririna.itch.io/visual-novel-busts)
The Situation:
If I use the escape code \bustMsgExp[x, y] in a Show text event it switches the face used in bustslot x to y.
So if I make a showtext event like this:
It sets the current face picture to show as bust in Bust slot 1, prints "This is a simple message" and afterwards changes the face to expression 5.
That's working fine.
The Problem:
However if I write this code...
The game crashes and I get an error message.
My suspicion: the regular expression that's supposed to pick up \BustMsgExp doesn't get picked up correctly due to the white space confusing the process.
The error message itself refers as the problem happening in this line:
Regardless of what comes first, toUpperCase or trim, the code immediately crashes.
I've set up a couple alert messages to get the contents of the array before the crash:
If it's working, the array returns:
array[0] = 1
array[1] = 5
array[2] = undefined (this array is not made use of, no issues)
The array[0] is the x in \BustMsgExp[x, y], the array[1] is the y.
But if I insert a whitespace:
array[0] =
(there is nothing in the array, not even undefined or 0. Just nothing)
array[1] = undefined
array[2] = undefined (as it should be)
The part of the code that parses into the array is this one:
That's where array[0], the Bustslot, gets its ID assigned.
The part obtainVNBustMsgEscapeString leads back to this function that's used for all escape strings:
I don't know much about regular expressions, but my assumption is that somewhere in these two codes, there's something that causes a single whitespace to pick up the entirely wrong contents.
Can someone tell me where the problem is and how to fix it? I'd really like to ensure that a single whitespace won't cause crashes and that the plugin becomes more stable.
The Situation:
If I use the escape code \bustMsgExp[x, y] in a Show text event it switches the face used in bustslot x to y.
So if I make a showtext event like this:
Code:
\bust[1]This is a simple message.\BustMsgExp[1, 5]
That's working fine.
The Problem:
However if I write this code...
Code:
\bust[1]This is a simple message. \BustMsgExp[1, 5]
My suspicion: the regular expression that's supposed to pick up \BustMsgExp doesn't get picked up correctly due to the white space confusing the process.
The error message itself refers as the problem happening in this line:
Code:
var expression=array[1].toUpperCase().trim();
I've set up a couple alert messages to get the contents of the array before the crash:
If it's working, the array returns:
array[0] = 1
array[1] = 5
array[2] = undefined (this array is not made use of, no issues)
The array[0] is the x in \BustMsgExp[x, y], the array[1] is the y.
But if I insert a whitespace:
array[0] =
(there is nothing in the array, not even undefined or 0. Just nothing)
array[1] = undefined
array[2] = undefined (as it should be)
The part of the code that parses into the array is this one:
Code:
if(code.match(/BUSTMSG(?:INDEX|EXP|EXPRESSION)/i)){var array=this.obtainVNBustMsgEscapeString(textState).split(",");
var sprite=$bust(parseInt(array[0]));
The part obtainVNBustMsgEscapeString leads back to this function that's used for all escape strings:
Code:
Window_Base.prototype.obtainVNBustMsgEscapeString=function(t){var e=/^\[(.*?)\]/.exec(t.text.slice(t.index));
if(e){t.index+=e[0].length;
return String(e[0].slice(1,e[0].length-1))}else{return""}};
Imported.Irina_VisualNovelBusts.Window_Message_initMembers=Window_Message.prototype.initMembers;
I don't know much about regular expressions, but my assumption is that somewhere in these two codes, there's something that causes a single whitespace to pick up the entirely wrong contents.
Can someone tell me where the problem is and how to fix it? I'd really like to ensure that a single whitespace won't cause crashes and that the plugin becomes more stable.
Downloads / Referenced Files
Log in to download
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadCreator 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.
0
replies
1
view
Topic Summary
Loading summary...