More that 6 Show Choice script

Hello, I use actualy HIME LargeChoices to have more than 6 show choices, but it's not compatible with HIME disable/hide choice plugin.
I looked for example of script which use show choice, but it's just terrible:

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()

It's don't explain anything and I just have a error message when I used it (SyntaxError: Invalid or unexpected token). I find it's unbelievable there is not concrete example of show choice script.

Also after that the show choice window works how I manage to active switch/variable/etc.. in function of the selected choice, I found the following script to do it but I cannot test it because the previous script don't work.

$gameMessage.setChoiceCallback(function(responseIndex) {
if (responseIndex === 0) $gameSwitches.value(x) == true}
if (responseIndex === 1) $gameSwitches.value(x) == true}
if (responseIndex === 2) $gameSwitches.value(x) == true}
if (responseIndex === 3) $gameSwitches.value(x) == true}
if (responseIndex === 4) $gameSwitches.value(x) == true}
if (responseIndex === 5) $gameSwitches.value(x) == true}
if (responseIndex === 6) $gameSwitches.value(x) == true}
if (responseIndex === 7) $gameSwitches.value(x) == true}
if (responseIndex === 8) $gameSwitches.value(x) == true}
{setTimeout(function(){});
What is the point of the params.push() line if nothing is in it?
What is the point of the params.push() line if nothing is in it?
That's just the point, in this example there is no explanation ;_;
That example is wrong in many ways. That specific error is because you've used “open-close” quotes instead of "neutral" quotes. But you're also setting an empty array for the choices, and you have some strange params thing floating around that never gets used. Maybe you mis-copied it, or maybe you need to find a better source. (E.g. today's chatbots make stuff up all the time: they're suited for creativity & entertainment, not giving advice or teaching.)

I also think a variable would be a more intuitive way to track which choice was selected, rather than...whatever that's trying to do. You could use switches, though, if that really is better suited to your situation. Here's the correct code to set a switch's value:
JavaScript:
$gameSwitches.setValue(123, true);  // turn on switch ID 123
I'll use a variable in my following example~

Here's the Show Choices info from the MV / MZ Script Call List (click to enlarge):

scl-showchoices.png
So for your case, you might want something like:
JavaScript:
// Choices A~H, start on choice index 0 (first choice), disable cancel.
$gameMessage.setChoices(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], 0, -1);
$gameMessage.setChoiceBackground(0);  // Normal
$gameMessage.setChoicePositionType(1);  // Center
$gameMessage.setChoiceCallback(function(index) {
  // Store the selected choice's index (0~7) in variable ID 10.
  $gameVariables.setValue(10, index);
});
this.setWaitMode('message');  // pause event until message ends

Edit: wait, this is false:
Hello, I use actualy HIME LargeChoices to have more than 6 show choices, but it's not compatible with HIME disable/hide choice plugin.
As noted on the page for Hime's Hidden Choice Conditions:
Due to the way this plugin works, this plugin must be placed below other choice-related plugins!
The order plugins are listed in the Plugin Manager ("load order") is often important. Try this:
  • HIME_LargeChoices
  • HIME_DisabledChoiceConditions
  • HIME_HiddenChoiceConditions
I.e. the choices get merged, then disabled & hidden where appropriate.
HIME LargeChoices to have more than 6 show choices, but it's not compatible with HIME disable/hide choice plugin.
did you mistype one of the names?
Tsukihime usually wrote scripts and plugins that were highly compatible with everything, and I strongly doubt that any of his MV plugins are incompatible to each other.

And especially those plugins are intended to be used together, they are even listed as such on himeworks.

So I suspect that if you had problems combining them, that the cause is something you did wrong.
and it might be easier to find out how to use them correctly together than the other tries above.
That example is wrong in many ways. That specific error is because you've used “open-close” quotes instead of "neutral" quotes. But you're also setting an empty array for the choices, and you have some strange params thing floating around that never gets used. Maybe you mis-copied it, or maybe you need to find a better source. (E.g. today's chatbots make stuff up all the time: they're suited for creativity & entertainment, not giving advice or teaching.)

I also think a variable would be a more intuitive way to track which choice was selected, rather than...whatever that's trying to do. You could use switches, though, if that really is better suited to your situation. Here's the correct code to set a switch's value:
JavaScript:
$gameSwitches.setValue(123, true);  // turn on switch ID 123
I'll use a variable in my following example~

Here's the Show Choices info from the MV / MZ Script Call List (click to enlarge):

View attachment 330280

So for your case, you might want something like:
JavaScript:
// Choices A~H, start on choice index 0 (first choice), disable cancel.
$gameMessage.setChoices(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], 0, -1);
$gameMessage.setChoiceBackground(0);  // Normal
$gameMessage.setChoicePositionType(1);  // Center
$gameMessage.setChoiceCallback(function(index) {
  // Store the selected choice's index (0~7) in variable ID 10.
  $gameVariables.setValue(10, index);
});
this.setWaitMode('message');  // pause event until message ends
Nope it doesn't work I have again (SyntaxError: Invalid or unexpected token).
I know that in the title thread I say "more that 6" and in the example I use it's go until 8 (and it's probably why you go to 8 too with your script), but in theory can I go with more that 8 choice with your method? I remind the point is to not have to use LargerChoice because it's not compatible with disable/hide choice plugin.
Yes, the number of choices is effectively unlimited via script call.

But like Andar says, and like I mention in the recent edit of my previous post, I think you should check your plugin load order. I'm pretty certain I used all of Hime's choice plugins together in a project some years ago.
did you mistype one of the names?
Tsukihime usually wrote scripts and plugins that were highly compatible with everything, and I strongly doubt that any of his MV plugins are incompatible to each other.

And especially those plugins are intended to be used together, they are even listed as such on himeworks.

So I suspect that if you had problems combining them, that the cause is something you did wrong.
and it might be easier to find out how to use them correctly together than the other tries above.
LargerChoice work in combaning show choice window who directly follow.
But for disable/hide work, they need to be placed before the choice window with a condition to disable/hide one of the choice:

hide_choice(1, "xxxx") -> if the condition xxxx is fulfil then the 1st choice is hide
hide_choice(2, "yyyy") -> if the condition yyyy is fulfil then the 2nd choice is hide
etc...

So first you need to put disable/hide plugin between your show choice window, but also your show choice window can only display 6 choice so except if you only want to disable/hide the first 6 choice it's not satifactory.
Yes, the number of choices is effectively unlimited via script call.

But like Andar says, and like I mention in the recent edit of my previous post, I think you should check your plugin load order. I'm pretty certain I used all of Hime's choice plugins together in a project some years ago.
Ok it's work, the problem was the plugin order 🙂
But I think it's a necessity to have a way to make a proper choice window via a script
But I think it's a necessity to have a way to make a proper choice window via a script
That is a debatable opinion.

events and scripts work on different levels, and there are quite a number of things that are easier to do on the event level than on the script level.

with event commands you'll have an entire framework ensuring that everything fits together.
script commands allow you to bypass the event framework, but require you to correctly replace that framework in those cases where it is needed.

and whenever such a replacement framework is needed to function, it is usually better to use the event commands (despite their limitations) rather than taking care of everything by script.
I know that HimeWorks HideChoices and LargeChoices work together because I have used them together. (I didn't need the one that disables the choice and greys it out.) Can't remember which one has to be before the other, though.
I think it's a necessity to have a way to make a proper choice window via a script
The code I gave in my previous post, for choices A~H, works fine for me in an MV project with no plugins active. It should be placed in a Script command in an event. My test event looked like this:

◆Script:$gameMessage.setChoices(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], 0, -1); : :$gameMessage.setChoiceBackground(0); // Normal : :$gameMessage.setChoicePositionType(1); // Center : :$gameMessage.setChoiceCallback(function(index) { : : $gameVariables.setValue(10, index); // Store selected choice (0~7) in var 10 : :}); : :this.setWaitMode('message'); // pause event until message ends ◆Text:None, Window, Bottom : :Selected choice \v[10].
Nope it doesn't work I have again (SyntaxError: Invalid or unexpected token).
This means you mistyped something: there is a character some place it should not be. Check your quotes. Note that by default many word-processing apps will automatically convert 'neutral/straight' quotes to ‘open-close/curly’ quotes. You do not want that for code: the different quote types are different characters that mean different things.

Original thread: https://forums.rpgmakerweb.com/threads/more-that-6-show-choice-script.175068/