(Solved)Custom options for Yanflys options

Status
Not open for further replies.

AgentN107

Bringer of laughter
Member
Joined
Aug 21, 2018
Messages
24
Reaction score
3
First Language
English
Primarily Uses
RMVXA
I am looking for a way to add custom options to yanflys system options that are like how the switch and dashing work but with more options than off or on. like for a difficulty option, it would have easy med hard. I would like them to still be able to be variable just not like the bar it currently is in this picture

options help.png

the original script
https://yanflychannel.wordpress.com/rmvxa/menu-scripts/system-options/
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
The bar is a variable.

You can add switches, like the commentary, or variables (the bars)
But I understand what you mean. That would be a big adjustment as it would display text for the variable.
Maybe someone can do it? I might tinker and see if it can be done.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
upload_2019-6-21_14-28-29.png
Finished addon

Code:
#==============================================================================
#
# ▼ Yanfly Engine Ace - System Options v1.00 Add-on++
# -- Last Updated: 2019.06.21
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
# ▼ EDITED by Roninator2
# -- Variable text lists add-on for System Options
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script adds onto Yanfly's System Options menu
# Custom lists for variables have been added.
# You can specify in the Custom_Lists below which variable you
# want to use and the text to be displayed.
# The text must be short, otherwise you will have to adjust the script.
#==============================================================================
module YEA
  module SYSTEM

    CUSTOM_LISTS ={
    # -------------------------------------------------------------------------
    # :list    => [Variable, Name, minimum, maximum, Color1, Color2,
    #               Help Window Description, Value1, Value2, Value3, etc
    #               ], # Do not remove this.
    # -------------------------------------------------------------------------
      :list_1  => [ 25, "Challenge Level", 0, 3, 28, 7, "Change Difficulty?",
                      "Easy", "Normal", "Hard  ", "Awesome"
                    ],
    # -------------------------------------------------------------------------
      :list_2  => [ 27, "test text", 0, 2, 2, 0, "This is what shows up.\n"+ "second line",
                      "one", "two", "three"
                    ],
    # -------------------------------------------------------------------------
    } # Do not remove this.
  end
end

class Window_SystemOptions < Window_Command
  #--------------------------------------------------------------------------
  # update_help
  #--------------------------------------------------------------------------
  def update_help
    if current_symbol == :custom_switch || current_symbol == :custom_variable ||
      current_symbol == :custom_list
      text = @help_descriptions[current_ext]
    else
      text = @help_descriptions[current_symbol]
    end
    text = "" if text.nil?
    @help_window.set_text(text)
  end
  #--------------------------------------------------------------------------
  # process_custom_list
  #--------------------------------------------------------------------------
  def process_custom_list(command)
    return unless YEA::SYSTEM::CUSTOM_LISTS.include?(command)
    name = YEA::SYSTEM::CUSTOM_LISTS[command][1]
    add_command(name, :custom_list, true, command)
    @help_descriptions[command] = YEA::SYSTEM::CUSTOM_LISTS[command][6]
  end
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  alias r2_draw_item_823gf  draw_item
  def draw_item(index)
    reset_font_settings
    rect = item_rect(index)
    contents.clear_rect(rect)
    r2_draw_item_823gf(index)
    case @list[index][:symbol]
    when :custom_list
      draw_custom_list(rect, index, @list[index][:ext])
    end
  end

  #--------------------------------------------------------------------------
  # Overwrite * make_command_list
  #--------------------------------------------------------------------------
  def make_command_list
    @help_descriptions = {}
    for command in YEA::SYSTEM::COMMANDS
      case command
      when :blank
        add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
        @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
      when :window_red, :window_grn, :window_blu
        add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
        @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
      when :volume_bgm, :volume_bgs, :volume_sfx
        add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
        @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
      when :autodash, :instantmsg, :animations
        add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
        @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
      when :cancel, :shutdown
        add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
        @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
      when :fullscreen
        add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
        @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
      else
        process_custom_list(command)
        process_custom_switch(command)
        process_custom_variable(command)
      end
    end
  end

  #--------------------------------------------------------------------------
  # draw_custom_list
  #--------------------------------------------------------------------------
  def draw_custom_list(rect, index, ext)
    name = @list[index][:name]
    change_color(normal_color)
    draw_text(0, rect.y, contents.width/2, line_height, name, 1)
    #---
    value = $game_variables[YEA::SYSTEM::CUSTOM_LISTS[ext][0]]
    minimum = YEA::SYSTEM::CUSTOM_LISTS[ext][2]
    maximum = YEA::SYSTEM::CUSTOM_LISTS[ext][3]
    if minimum > value
      value = minimum
      $game_variables[YEA::SYSTEM::CUSTOM_LISTS[ext][0]] = value
    end
    if maximum < value
      value = maximum
      $game_variables[YEA::SYSTEM::CUSTOM_LISTS[ext][0]] = value
    end
    pos = 0
    for i in minimum...maximum + 1
      dx = -250
      entry = YEA::SYSTEM::CUSTOM_LISTS[ext][pos + 7]
      color1 = text_color(YEA::SYSTEM::CUSTOM_LISTS[ext][5].to_i)
      change_color(color1)
      draw_text(dx + 75*pos, rect.y, contents.width, line_height, entry, 2)
      if value == i
        color2 = text_color(YEA::SYSTEM::CUSTOM_LISTS[ext][4].to_i)
        change_color(color2)
        entry = YEA::SYSTEM::CUSTOM_LISTS[ext][pos + 7]
        draw_text(dx + 75*pos, rect.y, contents.width, line_height, entry, 2)
      end
      pos += 1
    end

  end
  #--------------------------------------------------------------------------
  # cursor_change
  #--------------------------------------------------------------------------
  alias r2_cursor_change_92fkw  cursor_change
  def cursor_change(direction)
    r2_cursor_change_92fkw(direction)
    case current_symbol
    when :custom_list
      change_custom_lists(direction)
    end
  end

  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  alias r2_draw_item_9713g  draw_item
  def draw_item(index)
    reset_font_settings
    rect = item_rect(index)
    contents.clear_rect(rect)
    r2_draw_item_9713g(index)
    case @list[index][:symbol]
    when :custom_list
      draw_custom_list(rect, index, @list[index][:ext])
    end
  end
  #--------------------------------------------------------------------------
  # change_custom_lists
  #--------------------------------------------------------------------------
  def change_custom_lists(direction)
    Sound.play_cursor
    value = direction == :left ? -1 : 1
    ext = current_ext
    var = YEA::SYSTEM::CUSTOM_LISTS[ext][0]
    minimum = YEA::SYSTEM::CUSTOM_LISTS[ext][2]
    maximum = YEA::SYSTEM::CUSTOM_LISTS[ext][3]
    $game_variables[var] += value
    $game_variables[var] = [[$game_variables[var], minimum].max, maximum].min
    draw_item(index)
  end

end # Window_SystemOptions
Commands must be in yanfly's script.
upload_2019-6-21_14-30-10.png
upload_2019-6-21_14-32-35.png
It is your responsibility to adjust either script for your needs.
 
Last edited:

AgentN107

Bringer of laughter
Member
Joined
Aug 21, 2018
Messages
24
Reaction score
3
First Language
English
Primarily Uses
RMVXA
Thank you so much for the help.

P.S. is the return to title option suppossed to dissaper for curosity
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
return to title option
If you want the return to title then you need to add it into the script for the command to show up.
I may have removed it not thinking it is there by default.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
@AgentN107 I updated the script. Found a bug that let you move the cursor extra spaces to the right past the options.
Script posted above is corrected.
 

AgentN107

Bringer of laughter
Member
Joined
Aug 21, 2018
Messages
24
Reaction score
3
First Language
English
Primarily Uses
RMVXA
@AgentN107 I updated the script. Found a bug that let you move the cursor extra spaces to the right past the options.
Script posted above is corrected.
hm, interesting never noticed that this script had this bug but thanks for letting me know and
fixing it
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,839
Reaction score
5,222
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top