Show Choices

Hey guys, I am so sorry for posting such a simple question, but since I'm a total beginner...

How do I make plugin which simply shows a message and choices?

I think it should look a little bit like this:

var window = new Window_Base(200, 400, 200, 400);
window.drawText("Which one?", 10, 20, 300, 20, l);
choices = []; params = [];
$gameMessage.setChoices(choices, 0)
choices.push("I love you1");choices.push("I love you2");
choices.push("I love you3");choices.push("I love you4");
choices.push("I love you5");choices.push("I love you6");
choices.push("I love you7");choices.push("I love you8");
params.push()
SceneManager._scene.addWindow(window);

But that doesn't work at all... help
Why can't you just use the "show choice" event for it?
Well, basically I need 15,000 choice options and most of them will be hidden by using hide choice commands, so the player will only see about 10 choices at a time. It would be too much work to create all those options in the editor...

Is that even possible that way...?
OK, after some tutorials it works now the way I need it, however there is one last thing:



(function() {

Game_Player.prototype.executeMove = function(direction) {
this.moveStraight(direction);

$gameMessage.add("Which one...?");
choices = []; params = [];
$gameMessage.setChoices(choices, 0);
if ($gameActors.actor(1)._unlockedClasses.contains(16) == true && $gameActors.actor(1)._unlockedClasses.contains(17) == true && $gameActors.actor(1)._unlockedClasses.contains(18) == false) {choices.push('miau!');}
choices.push('Cancel');
params.push();
$gameMessage.setChoiceCallback(function(responseIndex) {
$gameVariables.setValue(100, (responseIndex+1));
if(responseIndex == 1) {$gameVariables.setValue(18, 18);}
$gameTemp.reserveCommonEvent(28);
});
this.setWaitMode('message');
};

})();

It only works if I delete the red text, otherwise it says: "Undefined is not a function" (in the red line).

But I think the setWaitMode thing is important... So why doesn't it work?
Are you sure you have the right 'this' object? Because that error sounds like 'setWaitMode' is not actually defined in whatever object you're operating on.

Actually, on analysis of the code, I'm not sure what 'this' is even supposed to be- it looks like it's a function being run directly, instead of as an object method.
In your case the "this" refers to the game player because that's the current context. However the game player object has no said function therefore you are getting the undefined is not a function error.
That function is part of the game interpreter class, so you can only call it there.
You don't have to use that function in your code anyways. The wait modes are only for the game interpreter that's responsible for executing event commands. Because there is different behavior depending on which command the interpreter executes, he has different wait modes.
So just delete that line.
In your case the "this" refers to the game player because that's the current context. However the game player object has no said function therefore you are getting the undefined is not a function error.
That function is part of the game interpreter class, so you can only call it there.
You don't have to use that function in your code anyways. The wait modes are only for the game interpreter that's responsible for executing event commands. Because there is different behavior depending on which command the interpreter executes, he has different wait modes.
So just delete that line.

Thank you. I love you. Have a great day

Original thread: https://forums.rpgmakerweb.com/threads/show-choices.83869/