Hime-Works / Requests

Bug reports and requests that may require longer discussions and is not suitable to leave on the blog
http://himeworks.com/
GNU General Public License v2.0
7 stars 9 forks source link

BUG Hidden Choice Conditions does not work well with plugin command hide_choice. #355

Open Bombermans opened 6 years ago

Bombermans commented 6 years ago

The plugin for RPG Maker MV Hidden Choice Conditions ( http://himeworks.com/2015/11/hidden-choice-conditions/ ) does not seem to work when using the plugin command "hide_choice 1". (Or 2, or 3, or 4).

Either using self.switches or using normal switches, only one option out of four is hidden, even when there should be at least 2 options hidden. Thereforce, the plugin only disables one choice. It seems to be the last one which was ordered to be disabled, ignoring the previous ones.

I've uploaded a sample project in which this error is recreated, and is attached here.

SuperSmallDemo - Bug with Hidden Choice Conditions.zip

If however I use a script call like this:

Script:hide_choice(1, "$gameSwitches.value(1)") : :hide_choice(2, "$gameSwitches.value(2)") : :hide_choice(3, "$gameSwitches.value(3)") : :hide_choice(4, "$gameSwitches.value(4)")

The plugin DOES work. So I guess the problem is with the plugin command hide_choice.

HimeWorks commented 6 years ago

Thank you for the bug report and for setting up the demo. The bug occurs due to the way messages and choices are processed during events.

Basically, all custom choice options such as hidden choices are temporary. They are used for the next message, and then they are cleared out. A single message is a Show Text command, possibly followed by a Show Choices command, or a Show Number Input command, or a Select Key Item command.

The reason why this is done this way is because otherwise, it would be difficult to determine which message the options should be applied to.

For example, if you had something like

hide_choice 1
Show Text: "pick a choice"
Show Choice: 1, 2, 3, 4

This works...because the game combines the choices and message together.

HOWEVER, if you had something like this

hide_choice 1
Show Text: "pick a choice"
### Comment, just a comment  ####
Show choices: 1, 2, 3, 4

This would not work, because when the text is displayed, all the hide options are cleared out. However, because the choices do not come immediately after the text, it's treated as a separate message with its own hide options (in this case, no hide options_

In your demo example, in between each hide_choice plugin command, you display a message beforehand, which wipes out the hiding options.

The reason why the single script call works is because there aren't any messages being shown in between each hide choice call.

If you would like to display messages based on a set of conditions, and hide options inside those conditions, you may need to separate the messages from the hide_choice commands, even though this would result in redundancy. Something like

### First our messages 

If self-switch 1
   Show Message
end
if self-switch 2
   Show Another message
end

### Then we hide options...

if self-switch 1
   hide_choice 1
end
if self-switch 2
   hide_choice 2
end

### And then show our choices...

Show Message: Pick a choice
Show Choices: 1 2 3 4