The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: modern algebra on January 28, 2013, 01:29:34 AM

Title: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on January 28, 2013, 01:29:34 AM
ATS: Choice Options
Version: 1.0.0
Author: modern algebra
Date: 27 January 2013

Version History



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


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 (http://rmrk.net/index.php/topic,44525.0.html).

Screenshots

(http://s7.postimage.org/604at5h1n/atsco1.png)

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 (http://pastebin.com/iz4kk3Fb).

Credit



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 (http://rmrk.net/index.php?action=dlattach;topic=47593.0;attach=30455).

Terms of Use


I adopt RMRK's default Terms of Use (http://rmrk.net/index.php/topic,45481.0.html).
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Bunni89 on February 06, 2013, 05:51:43 PM
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
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on February 06, 2013, 09:29:00 PM
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.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Bunni89 on February 08, 2013, 03:35:56 AM
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??
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on February 08, 2013, 09:29:53 PM
Well, I'm pleased that you like it!
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Chaos17 on February 12, 2013, 03:02:47 PM
I tried your script and I am really pleased to be able to put long choices in my game!  :tpg:
(http://uppix.net/7/a/3/f73f32e3dfde16bbdb5d48f0525cft.jpg) (http://uppix.net/7/a/3/f73f32e3dfde16bbdb5d48f0525cf.html)

I would like to know if it's possible to make a separation line/space or something like this ?
(http://i217.photobucket.com/albums/cc79/Galveraxe/visual-novel-choices3.jpg)

That the choices seem more distinct from one another.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on February 12, 2013, 09:09:25 PM
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.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Chaos17 on February 12, 2013, 11:49:51 PM
It's okay, you already did a good jo with your scripts.
Thanks to you my dialogues are appearing smothly in my game. 8)
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Yin on July 11, 2013, 09:27:03 PM
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?
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: &&&&&&&&&&&&& on July 11, 2013, 09:53:13 PM
What happens if you change

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

to

Code: [Select]
self.contents = Bitmap.new(24, 24)
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Yin on July 11, 2013, 10:25:29 PM
That did the trick :) Thanks!
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on July 11, 2013, 11:16:15 PM
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.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: &&&&&&&&&&&&& on July 11, 2013, 11:19:12 PM
Did I do bad?
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on July 11, 2013, 11:21:38 PM
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.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Yin on July 11, 2013, 11:41:20 PM
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.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on July 16, 2013, 01:47:42 AM
Thanks for testing it out for me Yin!
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: EmperorAlan on July 29, 2013, 07:13:49 AM
Is it not possible for us to make the choices blend together with the message window like the VX one?
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on August 01, 2013, 12:26:17 PM
Not yet. I suppose it wouldn't be terribly hard to add though.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on August 03, 2013, 09:18:52 PM
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).
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: LiTTleDRAgo on October 20, 2013, 09:37:12 AM
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']] }
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on October 24, 2013, 11:34:03 PM
Oh, hey, thank you very much! :)
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: CJF on March 15, 2014, 03:17:32 AM
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!
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: Japhasca on February 09, 2015, 01:31:07 AM
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.)

(http://i.imgur.com/UE2HLUh.png)
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on February 14, 2015, 04:39:25 AM
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.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: charli3 on June 20, 2015, 05:43:58 PM
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,
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on June 27, 2015, 04:46:03 AM
I'm not sure what you mean. Sorry.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: thechancellor on August 06, 2015, 02:11:09 AM
Is there any way to have the Help text aligned in the center? Not sure how the codes would apply there.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on August 06, 2015, 03:24:49 AM
Just add the following after the 'Choice Options' script, then set the 'choice_help_align_text' value to 1.

EDIT : See my next post.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: thechancellor on August 06, 2015, 01:29:21 PM
Thanks for the quick reply. I've tested it and it seems to work partially, as the text does shift based on the value I use in the module.

I've attached an image that shows the result of what happens when I choose the "Right" alignment. The "Center" alignment moves slightly to the left. And the "Left" alignment moves all the way left. Doesn't seem to be using the entire width of the window to determine the alignment.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on August 06, 2015, 02:21:05 PM
Hmm, I guess I tried to get too fancy. The following should work :

EDIT: Code updated to include an option for a help window dimmed background.

Code: [Select]
#==============================================================================
# ** Game_ATS
#==============================================================================

class Game_ATS
 
  CONFIG[:ats_choice_options].merge!(  {
    #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    #  EDITABLE REGION
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #  :choice_help_align_text
    #   ├ (value) 0 - Left Align
    #   ├ (value) 1 - Center Align
    #   └ (value) 2 - Right Align
    choice_help_align_text: 0,
    #  :choice_help_dim_bg
    #   ├ (value) true  - Display Dim Background
    #   └ (value) false - Display Windowskin
    choice_help_dim_bg: false,
    #  :choice_help_dim_bg_color1
    #   └ (value) Color Object - Color used in background gradient
    choice_help_dim_bg_color1: Color.new(0, 0, 0, 160),
    #  :choice_help_dim_bg_color2
    #   └ (value) Color Object - Color used in background gradient
    choice_help_dim_bg_color2: Color.new(0, 0, 0, 0),
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #  END EDITABLE REGION
    #////////////////////////////////////////////////////////////////////////
  }   )
 
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  CONFIG[:ats_choice_options].keys.each { |key| attr_accessor key }
 
end # Game_ATS



#==============================================================================
# ** Game_Message
#==============================================================================

class Game_Message

  Game_ATS::CONFIG[:ats_choice_options].keys.each { |key| attr_accessor key }

end # Game_Message



#==============================================================================
# ** Window_ChoiceHelp
#==============================================================================

class Window_ChoiceHelp < Window_Base
 
  #--------------------------------------------------------------------------
  # * NEW - Object Initialization
  #--------------------------------------------------------------------------
  def initialize(line_number = 2)
    super(0, 0, Graphics.width, fitting_height(line_number))
   
    create_back_bitmap
    create_back_sprite
  end
 
  #--------------------------------------------------------------------------
  # * SUPER - Free
  #--------------------------------------------------------------------------
  def dispose
    dispose_back_bitmap
    dispose_back_sprite
   
    super
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Set Text
  #--------------------------------------------------------------------------
  def set_text(text)
    update_back_sprite
    update_text_alignment
   
    if text != @text
      @text  = text
      refresh
    end
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Clear
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_text_ex(4, 0, @text)
  end
 
  #--------------------------------------------------------------------------
  # * SUPER - Hide Window
  #--------------------------------------------------------------------------
  def hide
    @back_sprite.visible = false
   
    super
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Create Background Bitmap
  #--------------------------------------------------------------------------
  def create_back_bitmap
    @back_bitmap = Bitmap.new(width, height)
    rect1 = Rect.new(0, 0, width, 12)
    rect2 = Rect.new(0, 12, width, height - 24)
    rect3 = Rect.new(0, height - 12, width, 12)
    @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
    @back_bitmap.fill_rect(rect2, back_color1)
    @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Get Background Color 1
  #--------------------------------------------------------------------------
  def back_color1
    $game_message.choice_help_dim_bg_color1
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Get Background Color 2
  #--------------------------------------------------------------------------
  def back_color2
    $game_message.choice_help_dim_bg_color2
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Create Background Sprite
  #--------------------------------------------------------------------------
  def create_back_sprite
    @back_sprite = Sprite.new
    @back_sprite.bitmap = @back_bitmap
    @back_sprite.visible = false
    @back_sprite.z = z - 1
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Update Background Sprite
  #--------------------------------------------------------------------------
  def update_back_sprite
    @back_sprite.visible = $game_message.choice_help_dim_bg
    @back_sprite.x = x
    @back_sprite.y = y
    @back_sprite.opacity = openness
    @back_sprite.update
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Update Text Alignment
  #--------------------------------------------------------------------------
  def update_text_alignment
    @align = $game_message.choice_help_align_text
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Free Background Bitmap
  #--------------------------------------------------------------------------
  def dispose_back_bitmap
    @back_bitmap.dispose
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Free Background Sprite
  #--------------------------------------------------------------------------
  def dispose_back_sprite
    @back_sprite.dispose
  end

  #--------------------------------------------------------------------------
  # * SUPER - Draw Text with Control Characters
  #--------------------------------------------------------------------------
  def draw_text_ex(x, y, text, *args, &block)
    if @align != 0
      text = convert_escape_characters(text)
      @max_text_width = text_size(text).width
    end

    super(x, y, text, *args, &block)
  end
 
  #--------------------------------------------------------------------------
  # * SUPER - Normal Character Processing
  #--------------------------------------------------------------------------
  def process_normal_character(c, pos, *args, &block)
    if @align != 0
      text_width = text_size(c).width
   
      case @align
        when 1
          draw_text(((width / 2) - (@max_text_width / 2)) - pos[:x], pos[:y], text_width * 2, pos[:height], c)
        when 2
          draw_text((contents.width - @max_text_width) - pos[:x], pos[:y], text_width * 2, pos[:height], c)
      end
       
      pos[:x] -= text_width

    else
      super(c, pos, *args, &block)
    end
     
  end
 
end # Window_ChoiceHelp



#==============================================================================
# ** Window_ChoiceList
#==============================================================================

class Window_ChoiceList
 
  #--------------------------------------------------------------------------
  # * ALIAS - Object Initialization
  #--------------------------------------------------------------------------
  unless method_defined?(:choice_XYJpWTIZ_wcl_initialize)
    alias_method(:choice_XYJpWTIZ_wcl_initialize, :initialize)
  end
 
  def initialize(*args, &block)
    choice_XYJpWTIZ_wcl_initialize(*args, &block)

    create_help_window
  end
 
  #--------------------------------------------------------------------------
  # * ALIAS - Start
  #--------------------------------------------------------------------------
  unless method_defined?(:choice_s23eH7xd_wcl_start)
    alias_method(:choice_s23eH7xd_wcl_start, :start)
  end
 
  def start(*args, &block)
    update_background
   
    choice_s23eH7xd_wcl_start(*args, &block)
  end
 
  #--------------------------------------------------------------------------
  # * SUPER - Free
  #--------------------------------------------------------------------------
  def dispose
    super
    dispose_all_windows
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Free All Windows
  #--------------------------------------------------------------------------
  def dispose_all_windows
    self.help_window.dispose
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Update Window Background
  #--------------------------------------------------------------------------
  def update_background
    @background = $game_message.choice_help_dim_bg
    self.help_window.opacity = @background ? 0 : 255
  end
 
  #--------------------------------------------------------------------------
  # * NEW - Create Help Window
  #--------------------------------------------------------------------------
  def create_help_window
    lines = $game_message.choice_help_win_lines
    self.help_window = Window_ChoiceHelp.new(lines > 0 ? lines : 1)
    help_window.z = self.z
    help_window.hide
  end
 
  #--------------------------------------------------------------------------
  # * OVERWRITE - Update Help Window
  #--------------------------------------------------------------------------
  def update_help
    if index >= 0 && $game_message.choice_help_texts[index].is_a?(String)
      @help_window.set_text($game_message.choice_help_texts[index])
    else
      help_window.clear
    end
  end
 
end # Window_ChoiceList
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: thechancellor on August 07, 2015, 12:48:12 AM
Nailed it. Thank you very very much. This adds a little bit of polish to the help window for sure.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: yuyu! on August 09, 2015, 06:36:46 PM
Is there a way to have the help window appear with a dim background, instead of using the windowskin? :)

Thanks again! I love dis script~ ;o;
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on August 09, 2015, 08:19:29 PM
Updated the above code to include a dim background option.  o:
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: yuyu! on August 09, 2015, 10:25:34 PM
Ahhhhh! That's awesome! :gracie: Thank you, Exhydra!!

Just one little thing I noticed...the text codes (such as \c[1] and stuff) don't seem to work when I added it. o.o They worked before, though... Did I break it? ;~;
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on August 09, 2015, 10:56:21 PM
Mm, where at? In the choice window or help window?  o:
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: yuyu! on August 09, 2015, 11:11:16 PM
Mm, where at? In the choice window or help window?  o:

I had a text code set up to make the font change color in the help window, and it stopped working when I added the add-on. ;_; That's really weird... :o

Spoiler for Nerdy Screenshot:
(http://i.imgur.com/4VDBshT.png?1)
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on August 09, 2015, 11:42:34 PM
Aah, yeah, the new alignment option is not playing well with text codes. I'll have to fiddle with it.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: yuyu! on August 09, 2015, 11:53:27 PM
Aah, yeah, the new alignment option is not playing well with text codes. I'll have to fiddle with it.

Huh... That does make more sense... o.o

Thank you again for that neat little scriptlet and all of your patience and help! ^_^
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: exhydra on August 10, 2015, 10:20:26 PM
Updated the script to parse the text codes while retaining the alignment. Not perfect, and kind of ugly ... but it works.
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: yuyu! on August 10, 2015, 10:24:55 PM
It works!! Thank you so much, exhydra! ^_^
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: shintashi on May 20, 2016, 10:36:03 PM
Concerning this script, I was wondering if there was a way to swap the location of the questions and answers?

Currently, when I use it, my questions appear on the bottom, and the answers appear on the top right of the question.

Is there a way so that my questions appear on the top of the screen, and the answers appear below the questions and to the left?
Title: Re: [VXA] ATS: Choice Options 1.0.0
Post by: modern algebra on September 05, 2016, 10:43:08 PM
Sorry for the delay. Yes, you can change the position of the text box by selecting "Top" or "Middle" when writing your message. If you need more positioning options for the message box, you can try my ATS: Message Options (http://rmrk.net/index.php?topic=46770.0).

With respect to the position of the choice box, that is controlled by the settings described in the portion of the script at lines 116-140:

Code: [Select]
    #  :choice_win_x - This controls the horizontal position of the choice
    # window. It can be set to either :L, :R, :C, or an integer. If an integer,
    # then it is set directly to that x-coordinate. If :L, it is flush with the
    # left side of the message window. If :C, it is in the centre of the
    # message window. If :R, it is flush with the right side of the message
    # window.
    choice_win_x:           :R,
    #  :choice_win_x_offset - This is the number of pixels offset when
    # :choice_win_x is set to :L or :R. When :L, it is added. When :R, it is
    # subtracted.
    choice_win_x_offset:    0,
    #  :choice_win_y - This controls the vertical position of the choice window.
    # It can be set to either :T, :B, or an integer. If an integer, then it is
    # set directly to that y-coordinate. If :T, it is flush with the top of the
    # message window. If :B, it is flush with the bottom of the message window.
    choice_win_y:           :T,
    #  :choice_win_y_offset - This is the number of pixels offset when
    # :choice_win_y is set to :T or :B. When :T, it is added. When :B, it is
    # subtracted.
    choice_win_y_offset:    0,