Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ╔═════════════════════════════════════╦════════════════════╗
- # ║ Title: List Options ║ Version: 1.00 ║
- # ║ Author: Roninator2 ║ ║
- # ╠═════════════════════════════════════╬════════════════════╣
- # ║ Function: ║ Date Created ║
- # ║ Yanfly System Options - ╠════════════════════╣
- # ║ Allows you to create lists ║ 21 Jun 2019 ║
- # ╚═════════════════════════════════════╩════════════════════╝
- # ╔══════════════════════════════════════════════════════════╗
- # ║ Normally you can use switches or variables for the ║
- # ║ various custom options. ║
- # ║ But what if you wanted to write text instead of numbers ║
- # ║ for the variables? ║
- # ║ ║
- # ║ Create a list as detailed below and add it to Yanfly's ║
- # ║ script to have it show up. ║
- # ║ ║
- # ║ Supports up to 4 words on screen ║
- # ║ And they need to be short ║
- # ╚══════════════════════════════════════════════════════════╝
- # ╔═════════════════════════════════════╗
- # ║ Terms of use: ║
- # ║ Follow the Original Authors terms ║
- # ╚═════════════════════════════════════╝
- module YEA
- module SYSTEM
- CUSTOM_LISTS ={
- # -------------------------------------------------------------------------
- # :list => [Variable, Name, Color1, Color2, minimum, maximum,
- # Help Window Description, Value1, Value2, Value3, etc
- # ], # Do not remove this.
- # -------------------------------------------------------------------------
- :list_1 => [ 67, "Difficulty", 0, 7, 0, 3, "Change Difficulty?",
- "Easy", "Normal", "Heroic", "Legendary"
- ],
- # -------------------------------------------------------------------------
- :list_2 => [ 127, "Cursor", 0, 7, 0, 3, "Change the cursor for the menu.\n"+
- "Exit screen for change to take effect.",
- "Magic", "Crystal", "Hand", "None"
- ],
- # -------------------------------------------------------------------------
- :list_3 => [ 150, "Font", 0, 7, 0, 3, "Change the font for the game messages.\n"+
- "Not the menu",
- "Philosopher", "Duel", "Immortal", "Almendra",
- ],
- # -------------------------------------------------------------------------
- :list_4 => [ 151, "Font Size", 0, 7, 0, 3, "Change the font size for the game messages.\n"+
- "Not the menu",
- "18", "20", "22", "24",
- ],
- # -------------------------------------------------------------------------
- } # Do not remove this.
- end
- end
- class Window_SystemOptions < Window_Command
- #--------------------------------------------------------------------------
- # Overwrite * 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
- #--------------------------------------------------------------------------
- # new * 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
- def item_height
- line_height
- end
- def line_height
- return 21
- 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 :encyclopedia, :achievement, :cancel, :to_title, :shutdown, :stats, :varmenu
- add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
- @help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
- when :fullscreen, :ratio
- 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
- #--------------------------------------------------------------------------
- # New * draw_custom_list
- #--------------------------------------------------------------------------
- def draw_custom_list(rect, index, ext)
- name = @list[index][:name]
- change_color(normal_color)
- draw_text(-40, rect.y, contents.width/2, line_height, name, 1)
- #---
- value = $game_variables[YEA::SYSTEM::CUSTOM_LISTS[ext][0]].to_i
- minimum = YEA::SYSTEM::CUSTOM_LISTS[ext][4].to_i
- maximum = YEA::SYSTEM::CUSTOM_LISTS[ext][5].to_i
- 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 0..maximum
- dx = maximum <= 2 ? -40 : maximum >= 4 ? 100 : 40
- entry = YEA::SYSTEM::CUSTOM_LISTS[ext][pos + 7]
- color1 = text_color(YEA::SYSTEM::CUSTOM_LISTS[ext][3].to_i)
- change_color(color1)
- d = i + 1
- draw_text(dx + contents.width*d/maximum/2, rect.y, contents.width/maximum, line_height, entry, 1)
- if value == i
- color2 = text_color(YEA::SYSTEM::CUSTOM_LISTS[ext][2].to_i)
- change_color(color2)
- entry = YEA::SYSTEM::CUSTOM_LISTS[ext][pos + 7]
- draw_text(dx + contents.width*d/maximum/2, rect.y, contents.width/maximum, line_height, entry, 1)
- 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
- #--------------------------------------------------------------------------
- # Overwrite * draw_item
- #--------------------------------------------------------------------------
- alias r2_draw_item_9713g draw_item
- def draw_item(index)
- reset_font_settings
- contents.font.size = 20
- 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
- #--------------------------------------------------------------------------
- # new * 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement