Conditional Choices [Disable/Hide choice via script] v2.4

Conditional Choices Script v2.4
By Winthorp Darkrites/WinterDream Games Creator​

This plugin let you disable or hide choices in the Show Choice window of RPG Maker based on your conditions!

You can tell the plugin to check for Switches, Variables, Actors, Items and Gold, he will do the rest!

From version 2.0 you can also decide to display a different text when a choice is enabled or disabled

Screenshoot

ChoiceN1.png

ChoiceN2.png


Video



Terms of use​


Refer to the Terms of Use file downloadable below or at this link

Version, bugs and further development​


VERSION 1.0:
  • Initial Release

VERSION 1.1:
  • Fixed the height of the Show Choice Window

VERSION 1.2:
  • Removed the HIDE functionality due to big indexing problems
  • Now using the "escape choice" functionality doesn't ovverride the plugin
  • Using the action button while there is no choice selected no longer cause to skip the Show Choice event
  • Trimming of the <<[ and ]>> tags are now limited to the Show Choice box

VERSION 2.0:
  • 100% rework of the code, it has been rebuilt from scratch
  • Kept retro-compatibility with previous versions
  • Return of the HIDE funtionality, now perfectly working (use (([ and ])) for hide conditions.
  • Plugin now support more conditions check! (Actors in party, Items in inventory, gold carried)
  • Added plugin parameters to personalize buzzer sound and handle default selection in case it falls on an hidden choice.
  • Added the possibility to change the text of a disabled choice

VERSION 2.1:
  • Changed the rules check mechanism from string reader to RegEx
  • Fixed a bug that wouldn't retrieve armors data
  • Fixed a bug that prevents the correct execution of the rule if a negative number was used (Thanks to alistor1213 for the report)
  • Now it allows to use items quantity as second operator
  • Added Error Handling option for wrong or broken formulas
VERSION 2.1.1:
  • Hotfix for v2.1, the rule check were giving the oppostire result (Thanks again to alistor1213)
VERSION 2.2:
  • Added the possibility to check if ANY of the condition is true to validate the hide/disable condition. To do so, instead of separating the conditions with "," separate them with ";". Don't mix the two or the plugin will work as usual (EVERY condition)
VERSION 2.3:
  • Thanks to Jndev9 for the report! The plugin was not checking equipped weapons and armors when running those conditions, now it does (for both has/hasn't and count)! Also the Armor check throw a fatal error due to a typo in the code, this is also fixed.
VERSION 2.4:
  • Changed the tag capture to regular expression instead of string analysis, now you can add the disable or hide tag anywhere in the text instead of the beginning
  • Added an external call for compatibility reason (GALV VN Choices) see help for more informations
  • Fixed Discord link in help section
  • Fixed a bug that would not decolor special choice text when disabled
  • Added the possibility to change active and disabled choices colors, this is especially helpful if you are using custom skins without standard colors pattern

Further developments will include: TBA


Downloadfor free on Itch.io
Known bug:
It seem that the HIDE condition sometimes doesn't allow a correct DISABLE of the choice right below it. I'm trying to figure out a fix but it won't be easy as it doesn't seem to happen all the times. If you are using the plugin please try to avoid stacking a DISABLE below an HIDE
Version 1.1 is out

- The Plugin now correctly generates the Show Choice box that was too short



IMPORTANT BUG NOTICE:

It looks like the HIDE mechanic doesn't work as intended and disrupt the Show Choice indexing, causing troubles with the plugin AND the choice functionalities. I'm working on it but this means I'll have to write a new part of code that re-order the Choices. For now please limit the use of the HIDE feature, best if kept at the bottom of the choices and limited to 1 per Show Choice
VERSION 1.2 is out now:
- Removed the HIDE functionality due to big indexing problems
- Now using the "escape choice" functionality doesn't ovverride the plugin
- Using the action button while there is no choice selected no longer cause to skip the Show Choice event
- Trimming of the <<[ and ]>> tags are now limited to the Show Choice box

As you may have noticed there "hide" function has been removed from the title because it has been removed from the script.

I'll need to make a total rework on how the Display Choice is populated to make "Hide" work and I'll probably challenge this in a total new plugin as I need a total new structure.

BUT

With the Hide option gone I managed to bring some important bug fixes to the Disable condition, in the form of the sneaky "Ok pressed when no choice is selected" and "Cancel Choice would override a Disabled Choice if they matched"... NO MORE!

Also, now the tag trim works only in the choices window, in case you wanna <<[write like that your adventure elsewhere]>>
It has been a while from my last post but I didn't stop coding for MZ plugins. With more experience I came to realize that this plugin... ok, I'll be honest, it was really bad coded.
So here I am, to post version 2.0, with a code rebuilt from zero in a proper way, bringing some BIG improvement to the script (but keeping it retro-compatible with older version, yes, yes, you are welcome)

VERSION 2.0:
  • 100% rework of the code, it has been rebuilt from scratch
  • Kept retro-compatibility with previous versions
  • Return of the HIDE funtionality, now perfectly working (use (([ and ])) for hide conditions.
  • Plugin now support more conditions check! (Actors in party, Items in inventory, gold carried)
  • Added plugin parameters to personalize buzzer sound and handle default selection in case it falls on an hidden choice.
  • Added the possibility to change the text of a disabled choice
Another underrated plugin, I don't understand why no one has thanked you yet, so... thank you!
Another underrated plugin, I don't understand why no one has thanked you yet, so... thank you!

Much appreciated 🙏
Also just dropping in to say thank you! This will be super helpful in my project.
Also just dropping in to say thank you! This will be super helpful in my project.
Thanks, and happy to hear it was useful! Best of luck with your project!
This plugin may be just what my story needs. I really enjoy games where your choices affect how the story plays out. I'm in the brainstorming,planning,preping
stage before I jump into working on the game in rpg maker. Thank you for sharing your plugin
This plugin may be just what my story needs. I really enjoy games where your choices affect how the story plays out. I'm in the brainstorming,planning,preping
stage before I jump into working on the game in rpg maker. Thank you for sharing your plugin
My pleasure, I love to play those kind of game so all my best wishes for your project!
Today I worked on some bugfix / new features for this plugin after a report from alistor1213 who discovered that negative numbers wouldn't work.

Instead of doing a bugfix on that single problem I decided to step the game up and recreated the whole rules validator process, going from a string analyser method to a RegEx method.

Oddly enough I also found that the check on the "armors" data wasn't working in the old version, I guess it's not a fan favourite as I never got a complaint about it!

So here is the bugfix for both the problems, a newer version of the validator plus a missing feature of 2.0 (now you can use item quantities as second operator)

I also decided to add HOW you want to handle errors in the plugin (for now it applies only to single rules), you want to ignore the error and get a semi-silent warn? You want to fail the rule check to be sure no erroneous True comes out? Or you want an hard error that stops the game and slaps you in the face? Your choice!

VERSION 2.1:

  • Changed the rules check mechanism from string reader to RegEx
  • Fixed a bug that wouldn't retrieve armors data
  • Fixed a bug that prevents the correct execution of the rule if a negative number was used (Thanks to alistor1213 for the report)
  • Now it allows to use items quantity as second operator
  • Added Error Handling option for wrong or broken formulas
Looks like I misplaced a negative value and the plugin worked in a reversed way!

Thanks for alistor again for the report, please update to 2.1.1 if you downloaded 2.1
You ask! I deliver! If I can ^_^

As Furiousmonke99 pointed out, the plugin checked only if ALL conditions were met to hide or deactivate a choice, but what if you just want that ANY of the conditions are met?

You couldn't, no no... until now!

With Version 2.2 it comes a new way to check on the conditions!

If you separate them using semicolon instead of commas now the plugin with check if AT LEAST ONE of the conditions is true, instead of ALL of them!

Enjoy this new feature!



VERSION 2.2:

  • Added the possibility to check if ANY of the condition is true to validate the hide/disable condition. To do so, instead of separating the conditions with "," separate them with ";". Don't mix the two or the plugin will work as usual (EVERY condition)
Good bug reports creates efficient patches!

VERSION 2.3:

  • Thanks to Jndev9 for the report! The plugin was not checking equipped weapons and armors when running those conditions, now it does (for both has/hasn't and count)! Also the Armor check throw a fatal error due to a typo in the code, this is also fixed.

v2.4 is here: Back-End performance tweaks, a little new feature and compatibility patch​


So it happened that a dev had GALV VN Choices plugin and it kind compete for the same RPG Maker MZ functions making a little mess! With this update I brought a little compatibility patch (it needs a little text editing but nothing major) and while at it I fixed a long time problem: tag reading.

Before 2.4 tag reading was done manually and just a space before the text could blow everything up, now regular expressions takes care of it and will detect the tag anywhere in the text.

Doing the debug run I noticed a bug that went under the radars, special Text disabled choice weren't colored to look disabled and that made me think, what if the devs are using special skins that don't use RMMZ classic colors? My disabled dark gray could be a bright blue to them, so here it is, I added a colors selection forboth active and disabled choices!



Enjoy!



VERSION 2.4:

  • Changed the tag capture to regular expression instead of string analysis, now you can add the disable or hide tag anywhere in the text instead of the beginning
  • Added an external call for compatibility reason (GALV VN Choices) see help for more informations
  • Fixed Discord link in help section
  • Fixed a bug that would not decolor special choice text when disabled
  • Added the possibility to change active and disabled choices colors, this is especially helpful if you are using custom skins without standard colors pattern
Thank you sir for this neat plugin. I found it easy to use once I got the hang of it.

It seems to have a conflict with this plugin:


Whenever I enable that plugin. part of the condition remains visible in the choice selection.
1762339950175.png


It doesn't seem to affect the actually working of the plugin tho. 2nd choice in this example has no conditional choice.

1762340115009.png
Thank you sir for this neat plugin. I found it easy to use once I got the hang of it.

It seems to have a conflict with this plugin:


Whenever I enable that plugin. part of the condition remains visible in the choice selection.
View attachment 352553

It doesn't seem to affect the actually working of the plugin tho. 2nd choice in this example has no conditional choice.

View attachment 352554

Have you tried changing the priority of the plugins, maybe that's all it's needed
Have you tried changing the priority of the plugins, maybe that's all it's needed
Yes, I've moved around the plugins. The phone plugin was before conditional choices script. Just to make sure I tested it again, I moved phone plugin below the conditional choices script, but no change in behavior. As soon as I disable the phone plugin the issue is gone.

I also just disabled every other plugin so these two are the only ones that are active in attempt to rule out other plugins.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-choices-disable-hide-choice-via-script-v2-4.158750/