[VXA] ATS: Choice Options 1.0.0

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
ATS: Choice Options
Version: 1.0.0
Author: modern algebra
Date: 27 January 2013

Version History


  • <Version 1.0.0> 2013.01.27 - Original Release

Description


This script improves your control over the choice box by permitting more than four choices in a box, each of which you can disable or remove contingent on the value of any given switch. Additionally, it also allows you to extend the length of the choice beyond the editor's spacial limitations, allowing you to have long choices, and it adds an option for a help window to assist in describing the choices. Aside from that dynamic control over choice branches, you are also permitted to set the number of columns in the choice box, its size, and its position. There are other more minor features as well, which you can learn about in the instructions.

Features

  • More than four choices!
  • Hide or disable choices based on switch value
  • Can set size and position of choice box
  • Can set number of columns
  • Multi-line and long choices
  • Help window to assist player in decision

If you are looking for other features from my VX script of the same name, then see some of the other scripts in the ATS series.

Screenshots



Instructions

Paste the script into its own slot in the Script Editor, above Main but below Materials.

See the header for instructions on configuration and use.

Script


Retrieve it from Pastebin.

Credit


  • modern algebra

Support


Please post in this topic at RMRK.net if you have any questions, suggestions, error reports, or comments about this script. It is perfectly fine to post here even if this topic has not been posted in for a very long time.

Please do not message me privately, as any concerns you have are likely shared by others and they will benefit from our correspondence being public. Additionally, I am occasionally absent, and posting publically will allow other members to assist you when I am unable to do so quickly.

Known Compatibility Issues

I am currently unaware of any compatibility issues.

Demo


See attached.

Terms of Use


I adopt RMRK's default Terms of Use.
« Last Edit: September 05, 2016, 10:37:47 PM by modern algebra »

**
Rep: +0/-0Level 53
RMRK Junior
Append choices looks very useful! Would there be any way to work something like that where it auto adds a 'next' choice to the bottom and spreads things out throughout several choice windows? Or a scrolling amount of choices that can fit any number?
I've been on the hunt for some script like that for ages, its annoying how it seems impossible to do this sort of thing. Basically my situation is that I have an idea for being able to access a 'Talk' menu with important NPCs and then it fills up with topics of conversation as you progress in the game. But this is impossible to do since I can't have around 30 variable-locked choices and make them appear together in a natural way. Without choice appending I'd have to set them out in groups of 7 or so with a 'next' option, which is just gonna look ridiculous if you've unlocked one choice in group one and six in group two, so on. (It's be like "Choice 1, Next" *tiny window* "Choice 7, Choice 8, Choice 9.." *giant window*) And then with appending I have no clue how I'd be able to manage if you have too many choices to all show on the screen at once, since if it mashes them all together I have no idea where to put the Next choice. (If I put it as every eighth choice and you haven't unlocked any of the first 16 then you'll get "Next, Next, Choice 17", if I put it right at the end then noone will see it unless they only have seven unlocked..)
It's way more complicated than it should be! XD

A girl on each arm... the life of a cookie is never boring!
.:: TOTAL NEWBIE ::.
Divided between ideas for a norse mythology game and a sandbox romp through an original setting...
Gathering resources and learning in preparation!!
My deviantART account: bunni89.deviantart.com

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Well, there is no feature where it auto-adds a next line, but it certainly will do the scrolling window which can fit any number of choices, and with switch-conditioned choices it will also allow you to enable the entries in whatever order you want. As well, you can set the size, so the window might be only able to fit four choices at a time (if that is the size you choose), but when the player scrolls down the other choices are available. You wouldn't have to have any "Nexts" at all.

**
Rep: +0/-0Level 53
RMRK Junior
That is badass and I now love you forever. FINALLY, A SOLUTION!! *dance* And one better than my hypothetical, lol!
Scrolling choices are a godsend. *prays at the mighty algebra's feet* Once again I'm throwing out piles of jury rigged lesser scripts to make way for your latest ATS.. how DO you keep being so amazing??

A girl on each arm... the life of a cookie is never boring!
.:: TOTAL NEWBIE ::.
Divided between ideas for a norse mythology game and a sandbox romp through an original setting...
Gathering resources and learning in preparation!!
My deviantART account: bunni89.deviantart.com

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Well, I'm pleased that you like it!

**
Rep:
Level 56
RMRK Junior
I tried your script and I am really pleased to be able to put long choices in my game!  :tpg:


I would like to know if it's possible to make a separation line/space or something like this ?


That the choices seem more distinct from one another.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Hmm, well that would require quite an adjustment to the script. If I were to take the request, I would essentially do it as a separate script, though one that is, of course compatible with this one. It would be fun to play with tones to change the colour of the windowskins for selection.

However, I can't see myself taking this request in the near future however. I'm sorry.

**
Rep:
Level 56
RMRK Junior
It's okay, you already did a good jo with your scripts.
Thanks to you my dialogues are appearing smothly in my game. 8)

pokeball YinOfflineFemale
**
Rep:
Level 86
Choice options gives me an error whenever I try to display a message with a face:

---------------------------
Demon's Revenge Ace
---------------------------
RGSSError occurred!
File: Internal Scripts/002 - Message Stuff/010 - MA - ATS - Choice Options.rb
Line: 541
Method: initialize
Message: failed to create bitmap

Trace:
File 'Internal Scripts/002 - Message Stuff/010 - MA - ATS - Choice Options.rb' line 541 (Method new)
File 'Internal Scripts/002 - Message Stuff/010 - MA - ATS - Choice Options.rb' line 541 (Method mapf_calc_line_width)
File 'Internal Scripts/002 - Message Stuff/007 - MA - ATS - Message Options.rb' line 895 (Block in calc_window_size_by_text)
File 'Internal Scripts/002 - Message Stuff/007 - MA - ATS - Message Options.rb' line 893 (Method each)
File 'Internal Scripts/002 - Message Stuff/007 - MA - ATS - Message Options.rb' line 893 (Method calc_window_size_by_text)
File 'Internal Scripts/002 - Message Stuff/007 - MA - ATS - Message Options.rb' line 880 (Method set_text)
File 'Internal Scripts/002 - Message Stuff/007 - MA - ATS - Message Options.rb' line 820 (Method update)
File 'Internal Scripts/002 - Message Stuff/007 - MA - ATS - Message Options.rb' line 972 (Method update_all_windows)
Script 'Window_Message' line 69 (Method update)
Script 'Scene_Base' line 95 (Block in update_all_windows)
Script 'Scene_Base' line 93 (Method each)
Script 'Scene_Base' line 93 (Method update_all_windows)
Script 'Scene_Base' line 49 (Method update_basic)
Script 'Scene_Base' line 41 (Method update)
File 'Internal Scripts/004 - Gameplay Enhancements/039 - SES - Dynamic Time.rb' line 511 (Method update)
Script 'Scene_Map' line 61 (Method update)
File 'Internal Scripts/003 - Added Functionality/015 - Cutscene Skipper.rb' line 151 (Method update)
Script 'Scene_Base' line 14 (Method main)
File 'Internal Scripts/004 - Gameplay Enhancements/040 - MOG - Weather EX.rb' line 652 (Method main)
Script 'SceneManager' line 23 (Method run)
Script 'Main' line 7 (Block in <main>)
Script 'Main' line 7 (In <main>)
File 'Error Parser.rb' line 307 (Method eval)
File 'Error Parser.rb' line 307 (In <main>)
Script 'Inserter' line 756 (Method eval)
Script 'Inserter' line 756 (In <main>)

---------------------------
OK   
---------------------------

Line 547 is:
self.contents = Bitmap.new(contents_width, 24)

Does this happen for anyone else or is it a compatibility issue?

*
死んだばか (Shinda baka)
Rep:
Level 95
誰も
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
What happens if you change

Code: [Select]
self.contents = Bitmap.new(contents_width, 24)

to

Code: [Select]
self.contents = Bitmap.new(24, 24)

pokeball YinOfflineFemale
**
Rep:
Level 86
That did the trick :) Thanks!

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
If you wouldn't mind, I would like to see a demo with that error recreated. It doesn't happen when I test, and the only reason it should happen is if a window's width is less than even its padding, which really ought to have caused an error earlier than that point in the script. Put more plainly, I'm confused, and I would like to make sure it isn't a flaw in the script itself.

*
死んだばか (Shinda baka)
Rep:
Level 95
誰も
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
Did I do bad?

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
No, that fixes the problem and there is no reason for the bitmap to be larger than that. It is probably the most efficent way since it avoids creating a large bitmap and I probably should have done it that way in the first place.

However, I'm still worried about it since Window_Base's create_contents method also uses contents_width to determine the width of a bitmap. If contents_width is returning a number less than 0, then the error may repeat itself at other places in the game.

pokeball YinOfflineFemale
**
Rep:
Level 86
I didn't really try it in a barebones project with just ATS, I just was checking to see if it was a real bug before I did that. I don't know if it happens without the rest of my scripts (I'm using an external text script by SES, Text control script by Victor Sant and the rest of the ATS series, which could be the only things (to my knowledge) messing with the message window to cause this error). I'll try it and see if it happens though.

Edit:
I tested it using only ATS scripts and it works fine. It must have been an incompatibility problem.
« Last Edit: July 14, 2013, 07:42:55 PM by Yin »

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Thanks for testing it out for me Yin!

**
Rep: +0/-0Level 53
RMRK Junior
Is it not possible for us to make the choices blend together with the message window like the VX one?

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Not yet. I suppose it wouldn't be terribly hard to add though.

*
Rep:
Level 81
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
Hmm, I have a minor feature request ... might the ability to disable a choice using evaluated code (with a boolean value) be added to the script? I certainly could use a switch, but I hate using a switch when a code snippet is easier (ie- 'DataManager.save_file_exists?', and so on).
« Last Edit: August 03, 2013, 09:25:08 PM by Exhydra »

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

**
Rep:
Level 72
RMRK Junior
Hmm, I have a minor feature request ... might the ability to disable a choice using evaluated code (with a boolean value) be added to the script? I certainly could use a switch, but I hate using a switch when a code snippet is easier (ie- 'DataManager.save_file_exists?', and so on).

just want to share

Spoiler for:
Code: [Select]
raise "Need MA's ATS: Choice Option" unless($imported||={})[:ATS_ChoiceOptions]
#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    overwritten method - atsco_interpret_command_402
#==============================================================================
class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Append Choice
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def atsco_interpret_command_402(params, index)
    # Accomodate for incorrect configuration of choice_format
    $game_message.choice_format = "" unless $game_message.choice_format.is_a?(String)
    $game_message.choice_format += '%s' unless $game_message.choice_format[/%s/]
    # Choice Plus
    plus_text, help_text = atsco_process_choice_comment(index + 1)
    choice_name = sprintf($game_message.choice_format, @list[index].parameters[1] + plus_text)
    del = false
    # Switch Conditions
    choice_name.gsub!(/\\S(!?)\[\s*(\d+)\s*\]/i) {
      # Set to delete if any condition not met
      cond = $game_switches[$2.to_i]
      del = true if $1.empty? ? !cond : cond
      "" }
    choice_name.gsub!(/\\S#(!?)\{\s*(.+?)\s*\}/i)  {
      cond = eval($2) rescue false
      del = true if $1.empty? ? !cond : cond
      "" }
    if del # If deleting
      @list[index].parameters[0] = -1
      # If cancel branch after this option
      if params[1] > params[0].size && params[1] < 1000
        params[1] -= 1 # Reduce ID of cancel
        params[1] = 0 if params[1] == params[0].size # If this was cancel, disable
      end
    else
      # Set index
      @list[index].parameters[0] = params[0].size
      # Add to choice array
      params[0].push(choice_name)
      # Add to Help Window
      $game_message.choice_help_texts.push(help_text)
    end
    return params, index
  end
end

#==============================================================================
# ** Window_ChoiceList
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - maatsco_choice_enabled?
#==============================================================================

class Window_ChoiceList
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Choice Enabled?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias_method :drg_atsco_choice_enabled, :maatsco_choice_enabled?
  def maatsco_choice_enabled?(index)
    name = command_name(index)
    enabled = drg_atsco_choice_enabled(index)
    name.gsub!(/\e[Dd]#(!?)\{\s*(.+?)\s*\}/i) {
      cond = $game_map.interpreter.send(:eval,$2) rescue false
      enabled = false if $1.empty? ? cond : !cond
      "" }
    enabled
  end
end

to use it :

\s#{ get_character(0).x > 3}
\s#!{ $game_party.members.size > 0 }
\d#{ FileTest.file?('Save003.rvdata2') }
\d#!{ $game_self_switches[[@map_id,@event_id,'A']] }

*
Rep:
Level 81
GIAW 14: 1st Place (Easy Mode)2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
Oh, hey, thank you very much! :)

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

pokeball CJFOffline
*
Rep: +0/-0Level 35
RMRK Junior
First off, I just wanted to say thanks for making such a wonderful script that really adds a ton of value to VXA.

So far the scripts have worked awesomely, except for one thing. I've tried to change the number of lines for the Help Window. Changing the value within the Editable Region works, but using a script in game has no effect. I've tried;

ats_next(:choice_help_win_lines, 4)
and
ats_all(:choice_help_win_lines, 4)

And it has no effect on the number of lines in the Help Window. Any help would be appreciated. Thanks!
« Last Edit: May 15, 2014, 10:21:13 PM by CJF »

**
Rep: +0/-0Level 30
RMRK Junior
I'm using this script with the default settings (I have changed nothing in the script) and am getting this error when I call a certain common event (it seems to be working fine everywhere else I've used it):

Script 'Appended Choices' line 457: NoMethodError occurred.

undefined method `push' for nil:NilClass

The weird thing is, If I call another event that uses appended choices first, this one works fine afterwards.

This is the offending event (I have stripped out all other code and the error still occurs.)

DrunkDorks.com (us)
Facebook.com/DrunkDorks (us)
Twitter.com/OrihimeWarlock (me)

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Hi, it's strange that happens, since that variable should be assigned an array as soon as a new game starts. It may be that you are loading an old save game from before you installed the script.

In any event, you should be able to fix it by pasting the following code into a script call before the choice branch:

Code: [Select]
$game_message.choice_help_texts = []

If it's not from an old save file, then it may be an incompatibility with another script.

*
Rep: +0/-0Level 22
RMRK Junior
I have one question, it is possible with that script to break line of text of choice option?
If not, anyone knows some way to do that?

Att,