Jump to content


Photo

Choice Options


  • Please log in to reply
27 replies to this topic

#1 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 03 December 2012 - 11:54 PM

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, 02 March 2015 - 10:22 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#2 estriole

estriole

    Advanced Member

  • Ace Member
  • 1,999 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 04 December 2012 - 12:47 AM

nice add on to that script. i will use this for my project :D.

#3 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 04 December 2012 - 01:05 AM

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.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#4 estriole

estriole

    Advanced Member

  • Ace Member
  • 1,999 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 04 December 2012 - 03:00 AM

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.

#5 Bunni89

Bunni89

    i shall rise like a phoenix... or a loaf of bread

  • Ace Member
  • 770 posts
  • LocationCardiff, Wales
  • RM Skill - Jack of All Trades

Posted 04 December 2012 - 06:16 AM

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

.:: PERPETUAL NEWBIE ::.
...Like a million ideas but for now I need to practise...
My deviantART account: bunni89.deviantart.com


#6 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 04 December 2012 - 11:10 AM

Yes, this is a standalone script. If you are unsure of any usage or are confused by something feel free to ask.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#7 Bunni89

Bunni89

    i shall rise like a phoenix... or a loaf of bread

  • Ace Member
  • 770 posts
  • LocationCardiff, Wales
  • RM Skill - Jack of All Trades

Posted 04 December 2012 - 10:29 PM

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, 05 December 2012 - 07:29 AM.

.:: PERPETUAL NEWBIE ::.
...Like a million ideas but for now I need to practise...
My deviantART account: bunni89.deviantart.com


#8 Darkdata

Darkdata

    Newbie

  • Ace Member
  • 5 posts
  • RM Skill - Jack of All Trades

Posted 05 December 2012 - 03:34 AM

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?

#9 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 05 December 2012 - 08:07 AM

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, 05 December 2012 - 10:30 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#10 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 06 December 2012 - 08:12 PM

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.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#11 EbonflameChaos

EbonflameChaos

    Newbie

  • Ace Member
  • 3 posts

Posted 23 January 2013 - 08:46 AM

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, 23 January 2013 - 08:47 AM.


#12 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 23 January 2013 - 09:04 AM

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.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#13 EbonflameChaos

EbonflameChaos

    Newbie

  • Ace Member
  • 3 posts

Posted 23 January 2013 - 09:29 AM

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, 23 January 2013 - 09:44 AM.


#14 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 23 January 2013 - 12:16 PM

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, 23 January 2013 - 12:18 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#15 EbonflameChaos

EbonflameChaos

    Newbie

  • Ace Member
  • 3 posts

Posted 23 January 2013 - 12:52 PM

*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, 23 January 2013 - 12:53 PM.


#16 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 23 January 2013 - 01:04 PM

I'm sure others may have learned something from it as well.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#17 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 06 March 2013 - 05:23 PM

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

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#18 shadowblack

shadowblack

    Advanced Member

  • Ace Member
  • 470 posts
  • RM Skill - Jack of All Trades

Posted 18 August 2014 - 11:29 AM

...

Edited by shadowblack, 14 October 2014 - 12:03 PM.


#19 KataiKit

KataiKit

    Member

  • Ace Member
  • 15 posts
  • RM Skill - Jack of All Trades

Posted 21 November 2014 - 12:52 AM

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.

Spoiler

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


Edited by KataiKit, 21 November 2014 - 12:53 AM.


#20 TheYungVxAce

TheYungVxAce

    Advanced Member

  • Ace Member
  • 123 posts
  • RM Skill - Pixel Artist

Posted 17 December 2014 - 06:09 PM

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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users