message with choices in a loop
BMM_Archive · July 15, 2026
Original Source
- Original title: message with choices in a loop
- Original author: Brian87
- Original date: December 29, 2018
- Source thread: https://forums.rpgmakerweb.com/threads/message-with-choices-in-a-loop.103807/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Javascript/Plugin Support
Summary
I am trying to create a javascript function in my custom plugin that initiates a conversation in a loop. Text is displayed, and the user is offered the choice to continue or exit. If the user decides to continue, the text is displayed again with the same two options. This repeats until the user selects to exit, at which point the conversation ends. My final version will of course be more complex, but this example boils down the problem area for me. I have the logic working fine in RPG...
Archived First Post
My final version will of course be more complex, but this example boils down the problem area for me.
I have the logic working fine in RPG Maker MV:
Protected download
However, I cannot get this same functionality from my javascript. Here is my attempt:
Game_System.prototype.endlessConversation = function() {
$gameMessage.add("Start of dialogue:");
while (true) {
$gameMessage.newPage();
$gameMessage.add("Some text that repeats.");
$gameMessage.setChoices(["Continue", "Exit"], 0, -1);
$gameMessage.setChoiceCallback(function(n) {
if (n === 1) {
break;
}
});
}
}
This freezes up because the loop executes infinitely. The loop does not wait for user input between iterations like the one in RPG Maker itself. If I change it to a for loop with a set number of iterations, like 5, it will simply spit out "Some text that repeats." 5 times in a row.
Any ideas on how I can get this javascript code to behave like the RPG Maker logic would be greatly appreciated. Thanks.
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadReferenced Images / Attachments
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...
