• Announcements

    • RagingHobo

      Forum Upgraded!   07/17/2017

      We have successfully upgraded our forum to the latest version! Some things have moved around but don't worry everything is still there, we still need to find updated versions of the plugins we were using previously to restore everything to the way it was. There will be a running topic in the Feedback and Support in case you notice something wrong. Before you do so please clear your browser cache and close your browser completely to rule out a caching issue. Thank you for your patience during the outage and while we get everything back to 150%  
Tsukihime

Choice Options

28 posts in this topic

This script provides "choice options" that provide finer control over your choices.

 

You can now hide choices that should not be shown using a few simple conditions rather than duplicating a choice list several times using conditional branches.

 

You can disable choices from being selected, which is simply impossible under normal circumstances.

Additional options may be added in the future

 

choice_options1.jpg

 

Get it at Hime Works

 

Usage

 

In your event, before the show choices commands, use script calls to set each choice option

 

The general format of the script call is

method_name(choice_number, arguments, ... )
You can look up the available methods in the reference section of the script.

The choice_number is 1 for the first choice, 2 for the second choice, and so on.

The arguments are specified in in the reference.

 

Hidden Choice

 

When the condition is true, the specified choice will not be shown on the list. Use a script call

hide_choice(choice_num, condition)
Where the `condition` is a string representing your conditional statement.

 

Disabled Choice

 

When the condition is true, the specified choice will not be selectable, though it will be shown on the list. Use a script call

disable_choice(choice_num, condition)
Colored Choice

 

The text of the specified choice will be drawn with the selected color. The color is currently a number from 0 to 32, which is not very useful.

 

color_choice(choice_num, color_num)
Edited by Tsukihime
Galv, Sughayyer, sokita and 1 other like this

Share this post


Link to post
Share on other sites

It's not really an add-on. I am not particularly satisfied with the conditional choice implementation that I did on the multiple choice script and think this is a more feasible way to handle options.

Share this post


Link to post
Share on other sites

ah sorry. i thought this is add on. i thought i still need raizen script to make this works. but this works independently. the correct one is rewrite :D.

Share this post


Link to post
Share on other sites

So to confirm this works standalone without needing the other guy's multiple choices thing?

It's a little confusing so thanks for the neat tutorial section, totally idiotproof if someone like ME managed to understand it XD

Share this post


Link to post
Share on other sites

Would it be possible to use this script to make other things happen when hovering over a choice option, like running a common event? if so it'd be awesome for the character creation system I'm working on. If not its still awesome :D

EDIT: Ah, ignore this I accidentely misposted. Meant to be in the 'help window for choices' topic..

Edited by Bunni89

Share this post


Link to post
Share on other sites

So, if a choice is hidden, does it still keep the variable correct as you choose an option?

 

Dog

Cat

Mouse

 

Choose, Cat. It's stored as 2.

 

Dog

<<Cat>> hidden

Mouse

 

If I choose Mouse, is it stored as 2, or does it keep it at 3?

Share this post


Link to post
Share on other sites

Mouse will always be 3, even if cat is hidden.

This is because the choices are hardcoded.

 

The options allow you to hide or disable choices, but the choice numbers remain the same regardless of however many choices there are (and it is important to be able to number your choices because otherwise you would not be able to accurately set your options)

Edited by Tsukihime

Share this post


Link to post
Share on other sites

I have re-written this script and removed the multiple choice implementation in order to make it more flexible.

 

Use the Large Choices script to provide multiple choices, or use Raizen's or Fomar's scripts which achieve the same results.

 

The script is free for use in commercial and non-commercial projects with appropriate attribution.

Share this post


Link to post
Share on other sites

Hey Tsukihime, I realize this is a bit of a necro post, but is there a way to phrase the conditional statement (not the hidden one) to eval a string instead of an integer? I've been able to use /Literal String/ === $game_variable[x], but that gives the exact opposite of what I'm aiming for - it enables the choice if it finds the string in the variable, disables it if it doesn't. I want to disable the choice if it finds that string in the variable, and enable it if it doesn't, while still keeping the option visible. 

 

Basically, I want to be able to use a conditional statement that would give the same results as $game_variable[x] != "String" would give me, if I could use the double quotes.

 

Sorry if this is a bit of a silly request, but porting my rad LSL skills over to Ruby just isn't working, and I can't find the correct way to parse/eval it.

Edited by EbonflameChaos

Share this post


Link to post
Share on other sites

Hidden is not working properly I will be removing it until further notice.

 

For your conditional, I am simply evaluating some arbitrary statement that you pass in, so at this point it is really just whether you can find a way to phrase it or not.

 

What is wrong with double quotes?

There are probably lots of ways to check whether a substring exists in a given string.

Share this post


Link to post
Share on other sites

If I try to use double quotes inside the choice_options script call, it throws an "unexpected tCONSTANT, expecting ')'" error message. I'm assuming it's because the double quotes are used to indicate the statement that needs to be eval'd, or possibly that it's the next item in the array, not sure.

And nod, there should be. I've tried .match - it either always returns TRUE (when passed through the eval) and enables the option or always returns FALSE (when passed through the eval) and disables the option, irregardless of whether or not the match was successful. I haven't found one that can be used yet, but I'll keep looking. Honestly I should probably give up and just use integers, but I'm stubborn and like my strings... >.>

 

Edit: I have also tried $game_variables[x] == /String/ and != /String/, it also always returns true or false, regardless.

Edited by EbonflameChaos

Share this post


Link to post
Share on other sites

There is nothing special about double quotes it is just standard string syntax.

 

"p 2" and 'p 2' both do the same thing when you eval them.

I think.

 

Anyways you should be able to mix your double quotes and single quotes, or if necessary escape your quotes. eg:

"$game_variables = \"some_string\""

I honestly have no idea how else I should be implementing this conditional check, because I want it to be evaluated when you call the event, not when the event is created or something.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

*facepalms* yeah, the escape made it work as expected. More than likely when I tried that last night I wasn't focusing and used the forward slashes - sorry about that! But on the bright side, I, umm, learned how to do a pattern match? A little? I guess?

 

>.>

 

Sorry, again.

Edited by EbonflameChaos

Share this post


Link to post
Share on other sites

I have fixed a bug involving hidden choice.

I have also provided a new script interface that should be easier to use for your events.

 

The following choice options are currently available

hide_choice(num, condition)
disable_choice(num, condition)
color_choice(num, color_id)
I have left the `choice_option` method available in case anyone is using that, but for new users just go with these shorter method calls.

 

choice_options1.jpg

 

This script is compatible with Large Choices

Share this post


Link to post
Share on other sites

I had a friend help me with this snippet so you can simply run a check to see if an actor is in your party. Choice is hidden or disabled (as you define) if they are not in your party.

 

Put this under Game_Objects, Game_Party

 #--------------------------------------------------------------------------
  # * Check if a particular ID is in the party
  #--------------------------------------------------------------------------
  def has_member(id)
    return @actors.include? id
  end 

 

Then you can just check if an actor is in the party with script call like this:
method(choice_num, "!$game_party.has_member(x)")  where x is the actor id.
hide_choice(1, "!$game_party.has_member(1)")
hide_choice(2, "!$game_party.has_member(13)")
hide_choice(3, "!$game_party.has_member(14)")
hide_choice(4, "!$game_party.has_member(15)")
hide_choice(5, "!$game_party.has_member(16)")
hide_choice(6, "!$game_party.has_member(20)")
hide_choice(7, "!$game_party.has_member(21)")

 

 

Seemed useful (least it was for me) so I thought I'd share.

Edited by KataiKit
Tsukihime likes this

Share this post


Link to post
Share on other sites

How would I disable a choice if the player do not have enough of a certain items?

This formula will return true if the number of item 1 is less than 3.

 

$game_party.item_number($data_items[1]) < 3
You may need to break it into two lines

disable_choice(1, "i = $data_items[1];
$game_party.item_number(i) < 3")
Edited by Tsukihime

Share this post


Link to post
Share on other sites

Thanks it works!  But how you do you disable a choice when you have a certain class unlock/available? (I'm using YEA Class System) I've tried other methods based on what I saw so far but I keep getting the error message 

This is most recent I tried:
 

          disable_choice(1, "i = $data_classes[@class_id];
          $game_actors[1].class(10)")

Share this post


Link to post
Share on other sites

I want the text to be different (with the text_choice command) only if a switch is turned off. And when the switch is turned on, I want the text to return to normal. How could I go about that?

Share this post


Link to post
Share on other sites

Well I figured out the last post, so nevermind that. However, I'm stuck with something new now.

 

2s6a7as.png

 

As you can see here, I have an event set up to where the player can choose to "craft" monsters. And what I'm aiming for here is, when the player does not have the required ingredients, the monster names appear as "???" and are disabled. But when the player does have the required ingredients of a monster, the choice will return to its original text, and will be select-able. So when the player has no ingredients in their inventory, there will be five "???"'s and the only thing they'll be able to do is hit Cancel.

 

So, with the provided script, I tested it, and after atttempting to select [Craft] in-game, I get this error:

 

Script 'Game_Interpreter' line 1409: SyntaxError occurred.

 

unexpected ')', expecting ':'

 

And so I thought, oh, that seems easy to fix. I just have to go into the script and change, in example, (1, "game_switches[63]") to (1, "game_switches[63]": true).

 

But when I did that, I got this error instead:

 

Script 'Game_Interpreter' line 1409: SyntaxError occurred.

 

unexpected ':', expecting ')'

disable_choice (1, "$game_switches[63]": true)

 

How can I fix this?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.