Message and Choices not showing up for JS plugin

Necessarily

Villager
Member
Joined
Dec 13, 2015
Messages
6
Reaction score
0
First Language
English
So this part of my code isn't showing up when I call the scene.  Developer console not displaying any errors since it's not crashing, so I think I may be missing a line or two since this is my first time using the $ RMMV Script commands.


CardGame_Scene.prototype.playMessage = function() {

$gameMessage.setFaceImage('Actor1',0)
$gameMessage.setBackground(1)
$gameMessage.setPositionType(1)
$gameMessage.add('Wanna play?')
choices = [];
params = [];
$gameMessage.setChoices(["Yes", "No"], 0, -1)
$gameMessage.setChoiceCallback(function (choice) {
if (choice == 1) {
SoundManager.playCancel();
SceneManager.goto(Scene_Map);
};
if (choice == 0) {
$gameMessage.add("You currently have \G\$")
var bet;
$gameMessage.setNumberInput(bet, 5);
$gameMessage.setChoices(["I got the cash","Nevermind",0,-1]);
$gameMessage.setChoiceCallback(function (choice) {
if (choice == 1) {
SoundManager.playCancel();
SceneManager.goto(Scene_Map);
};
if (choice == 0) {
$gameParty.gainGold(-bet);
};
});
}; /
});
};


Some lines are deliberately missing semi-colons as per the format of the RMMV script calls list. When I tried having each line end with a semicolon, it doesn't change the effect - the scene pops up fine, but the playMessage doesn't display. 

I started JS just a couple weeks ago, and I'm new to coding in general so any help or tips will be appreciated. 
 
Last edited by a moderator:

Sarkilas

Villager
Member
Joined
Jun 8, 2014
Messages
16
Reaction score
7
First Language
Norwegian
You are using $gameMessage in a scene that doesn't implement the message system, is my bet.


Scene_Map and Scene_Battle by default are the only ones that implements it.


Here's the default code snippet:


Scene_Map.prototype.createMessageWindow = function() {
this._messageWindow = new Window_Message();
this.addWindow(this._messageWindow);
this._messageWindow.subWindows().forEach(function(window) {
this.addWindow(window);
}, this);
};


To clarify, if there's no Window_Message, $gameMessage calls only sets a bunch of values to that object, and displays nothing.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top