[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
I'm not sure what you mean. Sorry.

**
Rep: +0/-0Level 72
RMRK Junior
Is there any way to have the Help text aligned in the center? Not sure how the codes would apply there.

*
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
Just add the following after the 'Choice Options' script, then set the 'choice_help_align_text' value to 1.

EDIT : See my next post.
« Last Edit: August 09, 2015, 10:20:19 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: +0/-0Level 72
RMRK Junior
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.

*
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 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
« Last Edit: August 10, 2015, 10:19:19 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: +0/-0Level 72
RMRK Junior
Nailed it. Thank you very very much. This adds a little bit of polish to the help window for sure.

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
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;
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
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
Updated the above code to include a dim background option.  o:

UPDATED 05-29-14


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

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

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
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? ;~;
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
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
Mm, where at? In the choice window or help window?  o:

UPDATED 05-29-14


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

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

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
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:

« Last Edit: August 09, 2015, 11:14:04 PM by yuyu! »
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
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
Aah, yeah, the new alignment option is not playing well with text codes. I'll have to fiddle with it.

UPDATED 05-29-14


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

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

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
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! ^_^
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


*
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
Updated the script to parse the text codes while retaining the alignment. Not perfect, and kind of ugly ... but it works.
« Last Edit: August 10, 2015, 10:22:59 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

*
The Hero of Rhyme
Rep:
Level 82
( ͡° ͜ʖ ͡°)
2014 Best RPG Maker User - StoryProject of the Year 20142014 Queen of RMRK2011 Best Newbie2014 Best RPG Maker User - Creativity2014 Kindest Member2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best Yuyubabe Smiley2012 Best RPG Maker User (Creativity);o
It works!! Thank you so much, exhydra! ^_^
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]


***
Rep:
Level 81
We learn by living...
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?

*
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
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.

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,