Hiya, I've been searching the forums since I know this is a confusing script but I'm still lost and I can't make it work.
From what I've gathered I think I got the first part:
Code:
choices = []; // make an empty array
$gameMessage.setChoices(choices, 0, -1); // 0 is the first choice pre-selected, -1 to disallow cancel,
// And push the strings on the choices array.
choices.push("hello"); // would be index 0
choices.push("bye"); // // would be index 1
I still don't get what does the
params = []; array does, or the
params.push() does on the script call Google Sheet.
I've seen the code and it also includes this:
this._index++;
this.setWaitMode('message');
Is it necessary to implement them on the script call too? Do I have to switch the "this." with $gameMessage.? I don't really get what that Index++ does there, isn't it to increase the number?
Even without the params the choices show up on the screen so at least that first part works.
Now for the callBack, this is the part that I can't figure out:
Code:
$gameMessage.setChoiceCallback(function(n) {
this._branch[this._indent] = n; // THIS
}.bind(this));
// I guess this one is the function that stores the index chosen?
Game_Message.prototype.setChoiceCallback = function(callback) {
this._choiceCallback = callback;
};
// And this one the ones that makes it null if no choice is called? Perhaps this is why nothing happens when I choose an option?
Game_Message.prototype.onChoice = function(n) {
if (this._choiceCallback) {
this._choiceCallback(n);
this._choiceCallback = null;
}
};
If I do something like this it doesn't work, it returns me to the map normally:
Code:
$gameMessage.setChoiceCallback(function(n) {
if (n === 0) {
$gameMessage.add("Say hello");
} else {
$gameMessage.add("Say bye");
}
});
I guess I'm missing something with
this._branch[this._indent] = n;, I don't understand how it works or how to call back the index of the choices.
Any help on this matter would be appreciated, my brain is a mess right now.
(I'm trying all of this on a new project without plugins).