Yanfly Menu with Moghunter Items

Hello everyone.

I've come across a little snag, and since I am not good at scripting and afraid to tweak settings if they are not super obvious. So I figure I'd ask the pro's here. I've been using Yanfly and Moghunter scripts for my game with no issue. Today I realized I never installed Yanfly's core menu script and added it. But in doing so, two of the main menu options for the Moghunter Gallery and Moghunter Music room have now vanished. I was curious if they could be added back somehow and wasn't sure what to put into the menu settings to do so.


Spoiler: Yanfly Menu Script
#==============================================================================
#
# ▼ Yanfly Engine Ace - Ace Menu Engine v1.10
# -- Modified by: Doogy, The_Fireplace, rstp14
# -- Last Updated: 2018.02.27
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-AceMenuEngine"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2018.02.27 - Made it possible to draw the JP bar
# 2018.01.25 - Fixed drawing bug where the HP bar was drawn over the MP bar
# - Made it possible to draw the MP bar if the TP bar is disabled
# 2016.01.17 - Fixed drawing bug found on the latest update, where the MP bar was drawn behind the HP bar.
# 2015.01.17 - Display update MP gauge behave the same way as TP gauge (hidden if no skill use it).
# 2012.01.03 - Compatibility Update: Ace Item Menu
# 2012.01.01 - Compatibility Update: Kread-EX's Synthesis
# - Compatibility Update: Kread-EX's Grathnode Install
# - Compatibility Update: Yami's Slot Battle
# 2011.12.23 - Script efficiency optimized.
# 2011.12.19 - Compatibility Update: Class System
# 2011.12.15 - Updated for better menu MP/TP gauge management.
# 2011.12.13 - Compatibility Update: Ace Equip Engine
# 2011.12.07 - Update to allow for switches to also hide custom commands.
# 2011.12.06 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# The menu system in RPG Maker VX Ace is great. However, it lacks the user
# customization that RPG Maker 2003 allowed. With this script, you can add,
# remove, and rearrange menu commands as you see fit. In addition to that, you
# can add in menu commands that lead to common events or even custom commands
# provided through other scripts.
#
# This script also provides window appearance management such as setting almost
# all command windows to be center aligned or changing the position of the
# help window. You can also opt to show the TP Gauge in the main menu as well
# as in the skill menu.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Edit the settings in the module below as you see fit.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
module MENU

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Menu Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This changes the way menus appear in your game. You can change their
# alignment, and the location of the help window, Note that any non-Yanfly
# Engine Ace scripts may not conform to these menu styles.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HELP_WINDOW_LOCATION = 0 # 0-Top, 1-Middle, 2-Bottom.
COMMAND_WINDOW_ALIGN = 1 # 0-Left, 1-Middle, 2-Right.

# These settings below adjust the visual appearance of the main menu.
# Change the settings as you see fit.
MAIN_MENU_ALIGN = 0 # 0-Left, 1-Middle, 2-Right.
MAIN_MENU_RIGHT = false # false-Left, true-Right.
MAIN_MENU_ROWS = 10 # Maximum number of rows for main menu.
DRAW_TP_GAUGE = true # If true, draws TP in the main menu.
DRAW_MP_GAUGE = true # If true, draws MP in the main menu.

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Main Menu Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the main menu, the order at which commands appear,
# what text is displayed, and what the commands are linked to. Here's a
# list of which commands do what:
#
# -------------------------------------------------------------------------
# :command Description
# -------------------------------------------------------------------------
# :item Opens up the item menu. Default menu item.
# :skill Opens up the skill menu. Default menu item.
# :equip Opens up the equip menu. Default menu item.
# :status Opens up the status menu. Default menu item.
# :formation Lets player manage party. Default menu item.
# :save Opens up the save menu. Default menu item.
# :game_end Opens up the shutdown menu. Default menu item.
#
# :class Requires YEA - Class System
#
# :gogototori Requires Kread-EX's Go Go Totori! Synthesis
# :grathnode Requires Kread-EX's Grathnote Install
# :sslots Requires Yami's YSA - Slot Battle
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMMANDS =[
:item, # Opens up the item menu. Default menu item.
:skill, # Opens up the skill menu. Default menu item.
:equip, # Opens up the equip menu. Default menu item.
:class, # Requires YEA - Class System.
:status, # Opens up the status menu. Default menu item.
:formation, # Lets player manage party. Default menu item.
# :event_1, # Launches Common Event 1. Common Event Command.
# :event_2, # Launches Common Event 2. Common Event Command.
# :debug, # Opens up debug menu. Custom Command.
# :shop, # Opens up a shop to pawn items. Custom Command.
:save, # Opens up the save menu. Default menu item.
:game_end, # Opens up the shutdown menu. Default menu item.
] # Do not remove this.

#--------------------------------------------------------------------------
# - Common Event Commands -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# If you insert one of the following commands into the COMMANDS array, the
# player can trigger a common event to launch. You can disable certain
# commands in the menu by binding them to a switch. If you don't want to
# disable them, set the switch to 0 and it will always be enabled. The
# ShowSwitch will prevent a command from appear if that switch is false.
# Set it to 0 for it to have no impact.
#--------------------------------------------------------------------------
COMMON_EVENT_COMMANDS ={
# :command => ["Display Name", EnableSwitch, ShowSwitch, Event ID],
:event_1 => [ "Camp", 11, 0, 1],
:event_2 => [ "Synthesis", 0, 0, 2],
} # Do not remove this.

#--------------------------------------------------------------------------
# - Custom Commands -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# For those who use scripts that may lead to other menu scenes, use this
# hash to manage custom commands that run specific script calls. You can
# disable certain commands in the menu by binding them to a switch. If you
# don't want to disable them, set the switch to 0. The ShowSwitch will
# prevent a command from appear if that switch is false. Set it to 0 for
# it to have no impact.
#--------------------------------------------------------------------------
CUSTOM_COMMANDS ={
# :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
:debug => [ "Debug", 0, 0, :command_debug],
:shop => [ "Shop", 12, 0, :command_shop],
:gogototori => ["Synthesis", 0, 0, :command_totori],
:grathnode => [ "Grathnode", 0, 0, :command_install],
} # Do not remove this.

end # MENU
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# This class is kept towards the top of the script to provide easier access.
#==============================================================================

class Window_MenuCommand < Window_Command

#--------------------------------------------------------------------------
# overwrite method: make_command_list
#--------------------------------------------------------------------------
def make_command_list
for command in YEA::MENU::COMMANDS
case command
#--- Default Commands ---
when :item
add_command(Vocab::item, :item, main_commands_enabled)
when :skill
add_command(Vocab::skill, :skill, main_commands_enabled)
when :equip
add_command(Vocab::equip, :equip, main_commands_enabled)
when :status
add_command(Vocab::status, :status, main_commands_enabled)
when :formation
add_formation_command
when :save
add_original_commands
add_save_command
when :game_end
add_game_end_command
#--- Yanfly Engine Ace Commands ---
when :class
next unless $imported["YEA-ClassSystem"]
add_class_command
#--- Imported Commands ---
when :sslots
next unless $imported["YSA-SlotBattle"]
add_sslots_command
when :grathnode
next unless $imported["KRX-GrathnodeInstall"]
process_custom_command(command)
when :gogototori
next unless $imported["KRX-AlchemicSynthesis"]
process_custom_command(command)
#--- Imported Commands ---
else
process_common_event_command(command)
process_custom_command(command)
end
end
end

#--------------------------------------------------------------------------
# new method: process_common_event_command
#--------------------------------------------------------------------------
def process_common_event_command(command)
return unless YEA::MENU::COMMON_EVENT_COMMANDS.include?(command)
show = YEA::MENU::COMMON_EVENT_COMMANDS[command][2]
continue = show <= 0 ? true : $game_switches[show]
return unless continue
text = YEA::MENU::COMMON_EVENT_COMMANDS[command][0]
switch = YEA::MENU::COMMON_EVENT_COMMANDS[command][1]
ext = YEA::MENU::COMMON_EVENT_COMMANDS[command][3]
enabled = switch <= 0 ? true : $game_switches[switch]
add_command(text, command, enabled, ext)
end

#--------------------------------------------------------------------------
# new method: process_custom_command
#--------------------------------------------------------------------------
def process_custom_command(command)
return unless YEA::MENU::CUSTOM_COMMANDS.include?(command)
show = YEA::MENU::CUSTOM_COMMANDS[command][2]
continue = show <= 0 ? true : $game_switches[show]
return unless continue
text = YEA::MENU::CUSTOM_COMMANDS[command][0]
switch = YEA::MENU::CUSTOM_COMMANDS[command][1]
enabled = switch <= 0 ? true : $game_switches[switch]
add_command(text, command, enabled)
end

end # Window_MenuCommand

#==============================================================================
# ■ Menu
#==============================================================================

module Menu

#--------------------------------------------------------------------------
# self.help_window_location
#--------------------------------------------------------------------------
def self.help_window_location
return YEA::MENU::HELP_WINDOW_LOCATION
end

#--------------------------------------------------------------------------
# self.command_window_align
#--------------------------------------------------------------------------
def self.command_window_align
return YEA::MENU::COMMAND_WINDOW_ALIGN
end

#--------------------------------------------------------------------------
# self.main_menu_align
#--------------------------------------------------------------------------
def self.main_menu_align
return YEA::MENU::MAIN_MENU_ALIGN
end

#--------------------------------------------------------------------------
# self.main_menu_right
#--------------------------------------------------------------------------
def self.main_menu_right
return YEA::MENU::MAIN_MENU_RIGHT
end

end # Menu

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.mp_cost > 0
end
return false
end

#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?
return false unless $data_system.opt_display_tp
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.tp_cost > 0
end
return false
end

end # Game_Actor

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window

#--------------------------------------------------------------------------
# overwrite method: draw_actor_simple_status
#--------------------------------------------------------------------------
def draw_actor_simple_status(actor, dx, dy)
dy -= line_height / 2
draw_actor_name(actor, dx, dy)
draw_actor_level(actor, dx, dy + line_height * 1)
draw_actor_icons(actor, dx, dy + line_height * 2)
dw = contents.width - dx - 124
draw_actor_class(actor, dx + 120, dy, dw)
draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)
if YEA::MENU:😀RAW_TP_GAUGE && actor.draw_tp? && (!actor.draw_mp? || !YEA::MENU:😀RAW_MP_GAUGE)
draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw)
elsif YEA::MENU:😀RAW_TP_GAUGE && YEA::MENU:😀RAW_MP_GAUGE && actor.draw_tp? && actor.draw_mp?
if $imported["YEA-BattleEngine"]
draw_actor_tp(actor, dx + 120, dy + line_height * 2, dw/2 - 1)
draw_actor_mp(actor, dx + 120 + dw/2, dy + (line_height * 2), dw/2 + 1)
else
draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw/2 - 1)
draw_actor_tp(actor, dx + 120 + dw/2, dy + line_height * 2, dw/2 + 1)
end
elsif YEA::MENU:😀RAW_MP_GAUGE && actor.draw_mp?
draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)
end
return unless $imported["YEA-JPManager"]
draw_actor_jp(actor, dx + 120, dy, dw)

end

end # Window_Base

#==============================================================================
# ■ Window_Command
#==============================================================================

class Window_Command < Window_Selectable

#--------------------------------------------------------------------------
# overwrite method: alignment
#--------------------------------------------------------------------------
def alignment
return Menu.command_window_align
end

end # Window_Command

#==============================================================================
# ■ Window_MenuCommand
#==============================================================================

class Window_MenuCommand < Window_Command

#--------------------------------------------------------------------------
# alias method: init_command_position
#--------------------------------------------------------------------------
class <<self; alias init_command_position_ame init_command_position; end
def self.init_command_position
init_command_position_ame
@@last_command_oy = nil
end

#--------------------------------------------------------------------------
# overwrite method: visible_line_number
#--------------------------------------------------------------------------
def visible_line_number
return [[item_max, YEA::MENU::MAIN_MENU_ROWS].min, 1].max
end

#--------------------------------------------------------------------------
# overwrite method: alignment
#--------------------------------------------------------------------------
def alignment
return Menu.main_menu_align
end

#--------------------------------------------------------------------------
# alias method: process_ok
#--------------------------------------------------------------------------
alias window_menucommand_process_ok_ame process_ok
def process_ok
@@last_command_oy = self.oy
window_menucommand_process_ok_ame
end

#--------------------------------------------------------------------------
# alias method: select_last
#--------------------------------------------------------------------------
alias window_menucommand_select_last_ame select_last
def select_last
window_menucommand_select_last_ame
self.oy = @@last_command_oy unless @@last_command_oy.nil?
@@last_command_oy = nil
end

end # Window_MenuCommand

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_MenuBase

#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_menu_start_ame start
def start
scene_menu_start_ame
relocate_windows
end

#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
return unless Menu.main_menu_right
@command_window.x = Graphics.width - @command_window.width
@gold_window.x = Graphics.width - @gold_window.width
@status_window.x = 0
end

end # Scene_Menu

#==============================================================================
# ■ Scene_Item
#==============================================================================

class Scene_Item < Scene_ItemBase

#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_item_start_ame start
def start
scene_item_start_ame
return if $imported["YEA-ItemMenu"]
relocate_windows
end

#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@category_window.y = @help_window.height
@item_window.y = @category_window.y + @category_window.height
when 1 # Middle
@category_window.y = 0
@help_window.y = @category_window.height
@item_window.y = @help_window.y + @help_window.height
else # Bottom
@category_window.y = 0
@item_window.y = @category_window.height
@help_window.y = @item_window.y + @item_window.height
end
if $imported["YEA-ItemMenu"]
@types_window.y = @category_window.y
@status_window.y = @category_window.y
end
end

end # Scene_Item

#==============================================================================
# ■ Scene_Skill
#==============================================================================

class Scene_Skill < Scene_ItemBase

#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_skill_start_ame start
def start
scene_skill_start_ame
relocate_windows
end

#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@command_window.y = @help_window.height
@status_window.y = @help_window.height
@item_window.y = @status_window.y + @status_window.height
when 1 # Middle
@command_window.y = 0
@status_window.y = 0
@help_window.y = @status_window.y + @status_window.height
@item_window.y = @help_window.y + @help_window.height
else # Bottom
@command_window.y = 0
@status_window.y = 0
@item_window.y = @status_window.y + @status_window.height
@help_window.y = @item_window.y + @item_window.height
end
end

end # Scene_Skill

#==============================================================================
# ■ Scene_Equip
#==============================================================================

class Scene_Equip < Scene_MenuBase

#--------------------------------------------------------------------------
# alias method: start
#--------------------------------------------------------------------------
alias scene_equip_start_ame start
def start
scene_equip_start_ame
relocate_windows
relocate_aee_windows
end

#--------------------------------------------------------------------------
# new method: relocate_windows
#--------------------------------------------------------------------------
def relocate_windows
return if $imported["YEA-AceEquipEngine"]
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@status_window.y = @help_window.height
@command_window.y = @help_window.height
@slot_window.y = @command_window.y + @command_window.height
@item_window.y = @slot_window.y + @slot_window.height
when 1 # Middle
@status_window.y = 0
@command_window.y = 0
@slot_window.y = @command_window.y + @command_window.height
@help_window.y = @slot_window.y + @slot_window.height
@item_window.y = @help_window.y + @help_window.height
else # Bottom
@status_window.y = 0
@command_window.y = 0
@slot_window.y = @command_window.y + @command_window.height
@item_window.y = @slot_window.y + @slot_window.height
@help_window.y = @item_window.y + @item_window.height
end
end

#--------------------------------------------------------------------------
# new method: relocate_aee_windows
#--------------------------------------------------------------------------
def relocate_aee_windows
return unless $imported["YEA-AceEquipEngine"]
case Menu.help_window_location
when 0 # Top
@help_window.y = 0
@command_window.y = @help_window.height
@slot_window.y = @command_window.y + @command_window.height
when 1 # Middle
@command_window.y = 0
@help_window.y = @command_window.height
@slot_window.y = @help_window.y + @help_window.height
else # Bottom
@command_window.y = 0
@slot_window.y = @command_window.height
@help_window.y = @slot_window.y + @slot_window.height
end
@actor_window.y = @command_window.y
@item_window.y = @slot_window.y
@status_window.y = @slot_window.y
end

end # Scene_Equip

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_MenuBase

#--------------------------------------------------------------------------
# alias method: create_command_window
#--------------------------------------------------------------------------
alias scene_menu_create_command_window_ame create_command_window
def create_command_window
scene_menu_create_command_window_ame
process_common_event_commands
process_custom_commands
end

#--------------------------------------------------------------------------
# new method: process_common_event_commands
#--------------------------------------------------------------------------
def process_common_event_commands
for command in YEA::MENU::COMMANDS
next unless YEA::MENU::COMMON_EVENT_COMMANDS.include?(command)
@command_window.set_handler(command, method🙂command_common_event))
end
end

#--------------------------------------------------------------------------
# new method: command_common_event
#--------------------------------------------------------------------------
def command_common_event
event_id = @command_window.current_ext
return return_scene if event_id.nil?
return return_scene if $data_common_events[event_id].nil?
$game_temp.reserve_common_event(event_id)
return_scene
end

#--------------------------------------------------------------------------
# new method: process_custom_commands
#--------------------------------------------------------------------------
def process_custom_commands
for command in YEA::MENU::COMMANDS
next unless YEA::MENU::CUSTOM_COMMANDS.include?(command)
called_method = YEA::MENU::CUSTOM_COMMANDS[command][3]
@command_window.set_handler(command, method(called_method))
end
end

#--------------------------------------------------------------------------
# new method: command_debug
#--------------------------------------------------------------------------
def command_debug
SceneManager.call(Scene_Debug)
end

#--------------------------------------------------------------------------
# new method: command_shop
#--------------------------------------------------------------------------
def command_shop
goods = []
SceneManager.call(Scene_Shop)
SceneManager.scene.prepare(goods, false)
end

#--------------------------------------------------------------------------
# new method: command_totori
#--------------------------------------------------------------------------
def command_totori
return unless $imported['KRX-AlchemicSynthesis']
SceneManager.call(Scene_Alchemy)
end

end # Scene_Menu

#==============================================================================
#
# ▼ End of File
#
#==============================================================================


Spoiler: Moghunter Gallery
#==============================================================================
# +++ MOG - Picture Gallery ACE (v2.0) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Sistema de galeria de imagens.
#==============================================================================
# Para ativar o script use o comando abaixo através de um evento usando o
# comando chamar script. (Call Script)
#
# picture_gallery
#
#==============================================================================
# Para disponibilizar as imagens na galeria você deverá usar o seguinte
# código através do comando chamar script.
#
# enable_picture(ID)
#
# EX enable_picture(10)
#
# Para desativar a imagem use o código abaixo
#
# disable_picture(ID)
#
#==============================================================================
# Você deverá criar uma pasta com o nome "Gallery" onde as imagens deverão
# ser gravadas.
#
# Graphics/Gallery/
#
# A nomeação das imagens devem ser numéricas. (ID da imagem)
# 0.jpg (Imagem não disponível.)
# 1.jpg
# 2.jpg
# 3.jpg
# ...
#
#==============================================================================
# ● Version History
#==============================================================================
# 2.0 - Compatibilidade com resoluções maiores que o padrão normal.
# - Compatibilidade com imagens de qualquer resolução.
# - Velocidade de movimento baseado no tamanho da imagem.
# - Adições de novos comandos e configurações visando melhor
# versatilidade.
#
#==============================================================================
module MOG_PICTURE_GALLERY
#Quantidade maxima de imagens na galeria.
MAX_PICTURES = 40
#Definição da velocidade no movimento da imagem.
SCROLL_SPEED = [3,3]
#Definição da posição do texto de informação.
HELP_POSITION = [0,0]
#Definição do texto da janela de ajuda.
HELP_TEXT = ["Page - ","Pictures"]
#Definição da fonte da janela de ajuda.
HELP_FONT_NAME = "Roboto"
HELP_FONT_SIZE = 20
HELP_FONT_BOLD = false
#Definição da posição do cursor da página.
# PAGE_CURSOR_POSITION = [X LEFT,Y LEFT ,X RIGHT,Y RIGHT]
PAGE_CURSOR_POSITION = [0,0,0,0]
#Ativar o Scene Picture Gallery no Menu
PICTURE_GALLERY_MENU_COMMAND = true
#Nome do comando apresentado no menu.
PICTURE_GALLERY_COMMAND_NAME = "Scrap Book"
end

$imported = {} if $imported.nil?
$imported[:mog_picture_gallery] = true

#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System

attr_accessor :gallery

#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------
alias art_picture_initialize initialize
def initialize
art_picture_initialize
@gallery = []
end
end

#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter

#------------------------------------------------------------------------------
# ● Picture Gallery
#------------------------------------------------------------------------------
def picture_gallery
SceneManager.call(Scene_Picture_Gallery)
end

#------------------------------------------------------------------------------
# ● Enable Picture
#------------------------------------------------------------------------------
def enable_picture(id, value = true)
$game_system.gallery[id] = value
end

#------------------------------------------------------------------------------
# ● Disable Picture
#------------------------------------------------------------------------------
def disable_picture(id, value = false)
$game_system.gallery[id] = value
end

end

#==============================================================================
# ■ RPG
#==============================================================================
module Cache

#------------------------------------------------------------------------------
# ● Gallery
#------------------------------------------------------------------------------
def self.gallery(filename)
load_bitmap("Graphics/Gallery/", filename)
end

end


#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window

#--------------------------------------------------------------------------
# ● Draw_Thumbnail
#--------------------------------------------------------------------------
def draw_thumbnail(x,y,id)
bitmap = Cache.gallery(id.to_s) rescue nil
return if bitmap == nil
src_rect = Rect.new(0, 0, bitmap.width , bitmap.height )
src_rect2 = Rect.new(x, y, 118, 59)
self.contents.stretch_blt(src_rect2, bitmap, src_rect)
bitmap.dispose
end

end

#==============================================================================
# ■ Window_Picture
#==============================================================================
class Window_Picture < Window_Selectable

#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------
def initialize(page)
super(0, 64, Graphics.width, Graphics.height - 32)
self.opacity = 0
@index = -1
@Page = page
@pic_max = MOG_PICTURE_GALLERY::MAX_PICTURES
@pic_max = 1 if @pic_max <= 0
@pag_max = @pic_max / 9
if @pag_max == page
o = @pag_max * 9
o2 = @pic_max - o
@item_max = o2
else
@item_max = 9
end
@i_max = @item_max
refresh(page)
select(0)
activate
end

#------------------------------------------------------------------------------
# ● Refresh
#------------------------------------------------------------------------------
def refresh(page = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
if @item_max > 0
self.contents = Bitmap.new(width - 32, 6 * 89)
for i in 0...@item_max
draw_item(i,page)
end
end
end

#------------------------------------------------------------------------------
# ● WX
#------------------------------------------------------------------------------
def wx
(Graphics.width ) / 3
end

#------------------------------------------------------------------------------
# ● WY
#------------------------------------------------------------------------------
def wy
(Graphics.height + 64) / 5
end

#------------------------------------------------------------------------------
# ● SX
#------------------------------------------------------------------------------
def sx
(Graphics.width / 96).truncate
end

#------------------------------------------------------------------------------
# ● SY
#------------------------------------------------------------------------------
def sy
(Graphics.height - 416) / 12
end

#------------------------------------------------------------------------------
# ● draw_item
#------------------------------------------------------------------------------
def draw_item(index,page)
np = 9 * page
picture_number = index + 1 + np
x = sx + 16 + index % 3 * wx
y = sy + 12 + index / 3 * wy
s = picture_number
s = 0 if $game_system.gallery[picture_number] == nil
draw_thumbnail(x,y,s)
self.contents.draw_text(x + 30,y + 49, 64, 32, "Picture - " + picture_number.to_s,1)
end

#------------------------------------------------------------------------------
# ● item_rect
#------------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = 150
rect.height = 90
rect.x = sx + (@index % col_max * wx)
rect.y = sy + (@index / col_max * wy)
return rect
end

#------------------------------------------------------------------------------
# ● Col Max
#------------------------------------------------------------------------------
def col_max
return 3
end

#------------------------------------------------------------------------------
# ● Item Max
#------------------------------------------------------------------------------
def item_max
return @item_max == nil ? 0 : @item_max
end

end

#==============================================================================
# ■ Window Help
#==============================================================================
class Window_Help < Window_Base

#--------------------------------------------------------------------------
# * Set Text
#--------------------------------------------------------------------------
def set_text_pic(text)
if text != @text
@text = text
refresh_pic
end
end

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh_pic
contents.clear
draw_text_ex_pic(4, 0, @text)
end

#--------------------------------------------------------------------------
# * Draw Text with Control Characters
#--------------------------------------------------------------------------
def draw_text_ex_pic(x, y, text)
reset_font_settings
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
contents.font.size = MOG_PICTURE_GALLERY::HELP_FONT_SIZE
contents.font.name = MOG_PICTURE_GALLERY::HELP_FONT_NAME
contents.font.bold = MOG_PICTURE_GALLERY::HELP_FONT_BOLD
process_character(text.slice!(0, 1), text, pos) until text.empty?
end

end


#==============================================================================
# ■ Scene_Picture Gallery
#==============================================================================
class Scene_Picture_Gallery
include MOG_PICTURE_GALLERY

#------------------------------------------------------------------------------
# ● Main
#------------------------------------------------------------------------------
def main
setup
execute_dispose
create_image
create_background
create_loading_text
create_window
create_cursor
create_button
execute_loop
execute_dispose
end

#------------------------------------------------------------------------------
# ● Create_Loading
#------------------------------------------------------------------------------
def create_loading_text
@loading = Sprite.new
@loading.bitmap = Bitmap.new(100,32)
@loading.z = 300
@loading.bitmap.font.size = 20
@loading.bitmap.font.bold = true
@loading.bitmap.font.name = "Georgia"
@loading.bitmap.draw_text(0,0, 100, 32, "Loading...",1)
@loading.x = (Graphics.width / 2) - 50
@loading.y = (Graphics.height / 2)
Graphics.transition(20)
end

#------------------------------------------------------------------------------
# ● Setup
#------------------------------------------------------------------------------
def setup
@max_pictures = MAX_PICTURES
@max_pictures = 1 if @max_pictures <= 0
v = (@max_pictures / 9)
v2 = (v - 1) * 9
v3 = (@max_pictures - v2) - 9
if v3 != 0
@max_pages = (@max_pictures / 9) + 1
else
@max_pages = (@max_pictures / 9)
end
@max_pages = 1 if @max_pages == 0
@aw_center = 0
@aw_left = 0
@aw_right = 0
@slide_type = 0
@page_old = 0
@picture_id = 0
@image_active = false
@old_index = 0
@picures_enabled = 0
@comp = 0
@ex = 0
@ey = 0
@ex_max = 0
@ey_max = 0
@ex_max_zoom = 0
@ey_max_zoom = 0
@move_hor = true
@move_ver = true
@scroll_speed = [0,0]
@pic_center_pos = [0,0]
for i in 0..MAX_PICTURES
@picures_enabled += 1 if $game_system.gallery
end
end

#------------------------------------------------------------------------------
# ● create_background
#------------------------------------------------------------------------------
def create_background
@background = Sprite.new
@background.bitmap = Cache.gallery("Background")
@background.z = 0
@background2 = Plane.new
@background2.bitmap = Cache.gallery("Background2")
@background2.z = -1
end

#------------------------------------------------------------------------------
# ● Create Window
#------------------------------------------------------------------------------
def create_window
@info = Window_Help.new
@info.x = HELP_POSITION[0]
@info.y = (Graphics.height - 48) + HELP_POSITION[1]
@info.opacity = 0
@wp_page = 0
@wp_page_old = @wp_page
@wp_index = 0
@wp =[]
for i in 0...@max_pages
@wp = Window_Picture.new(i)
end
check_active_window(true)
refresh_info_window(true)
end

#------------------------------------------------------------------------------
# ● Create_image
#------------------------------------------------------------------------------
def create_image
@picture = Sprite.new
@picture.bitmap = Cache.gallery("")
@picture.z = 100
@picture.opacity = 0
end

#------------------------------------------------------------------------------
# ● Check Active Window
#------------------------------------------------------------------------------
def check_active_window(starting = false)
for i in 0...@max_pages
if i == @wp_page
@wp[@wp_page].active = true
@wp[@wp_page].visible = true
if @slide_type == 0
@wp[@wp_page].x = Graphics.width
else
@wp[@wp_page].x = -Graphics.width
end
elsif i == @page_old and starting == false
@wp[@page_old].active = false
@wp[@page_old].visible = true
@wp[@page_old].visible = false if starting
@wp[@page_old].x = 0
else
@wp.active = false
@wp.visible = false
end
end
end

#------------------------------------------------------------------------------
# ● Create Button
#------------------------------------------------------------------------------
def create_button
@button_image = Cache.gallery("Button")
@button_bitmap = Bitmap.new(@button_image.width, @button_image.height)
@cw = @button_image.width
@ch = @button_image.height / 2
src_rect = Rect.new(0, 0, @cw, @ch)
@button_bitmap .blt(0,0, @button_image, src_rect)
@Button = Sprite.new
@button.bitmap = @button_bitmap
@button.x = 2
@button.y = Graphics.height - @ch
@button.z = 250
@button.opacity = 0
@button_fade_time = 0
end

#------------------------------------------------------------------------------
# ● Create Cursor
#------------------------------------------------------------------------------
def create_cursor
@cx1 = 0
@cx2 = 0
@cursor_speed = 0
image = Cache.gallery("Cursor")
@bitmap = Bitmap.new(image.width, image.height)
cw = image.width / 2
ch = image.height
src_rect = Rect.new(cw, 0, cw, ch)
@bitmap.blt(0,0, image, src_rect)
@cx3 = Graphics.width - cw
@cx_pos = [PAGE_CURSOR_POSITION[0],
PAGE_CURSOR_POSITION[1] - (ch / 2),
PAGE_CURSOR_POSITION[2] + Graphics.width - cw,
PAGE_CURSOR_POSITION[3] - (ch / 2)
]
@cursor1 = Sprite.new
@cursor1.bitmap = @bitmap
@cursor1.x = @cx_pos[0] + @cx1
@cursor1.y = @cx_pos[1] + Graphics.height / 2
@cursor1.z = 200
@bitmap2 = Bitmap.new(image.width, image.height)
src_rect2 = Rect.new(0, 0, cw, ch)
@bitmap2.blt(0,0, image, src_rect2)
@cursor2 = Sprite.new
@cursor2.bitmap = @bitmap2
@cursor2.x = @cx_pos[2] + @cx2
@cursor2.y = @cx_pos[3] + Graphics.height / 2
@cursor2.z = 200
image.dispose
if @max_pages == 1
@cursor1.visible = false
@cursor2.visible = false
end
end

#------------------------------------------------------------------------------
# ● Execute Loop
#------------------------------------------------------------------------------
def execute_loop
loop do
Graphics.update
Input.update
update
if SceneManager.scene != self
break
end
end
end

#------------------------------------------------------------------------------
# ● Execute Dispose
#------------------------------------------------------------------------------
def execute_dispose
return if @background == nil
Graphics.freeze
for i in 0...@max_pages
@wp.dispose
end
@info.dispose
if @picture.bitmap != nil
@picture.bitmap.dispose
end
@picture.dispose
@background.bitmap.dispose
@background.dispose
@background = nil
@background2.bitmap.dispose
@background2.dispose
@bitmap.dispose
@bitmap2.dispose
@cursor1.bitmap.dispose
@cursor1.dispose
@cursor2.bitmap.dispose
@cursor2.dispose
@button_bitmap.dispose
@button.bitmap.dispose
@button.dispose
@button_image.dispose
if @loading != nil
@loading.bitmap.dispose
@loading.dispose
end
end

#------------------------------------------------------------------------------
# ● Update
#------------------------------------------------------------------------------
def update
@wp.each {|wid| wid.update}
@info.update
if @image_active
update_command_image
else
update_command
end
update_slide
update_image_effect
update_cursor_animation
refresh_info_window
end

#------------------------------------------------------------------------------
# ● update_cursor_animation
#------------------------------------------------------------------------------
def update_cursor_animation
@cursor_speed += 1
case @cursor_speed
when 1..20
@cx1 += 1
@cx2 -= 1
when 21..40
@cx1 -= 1
@cx2 += 1
else
@cursor_speed = 0
@cx1 = 0
@cx2 = 0
end
@cursor1.x = @cx_pos[0] + @cx1
@cursor2.x = @cx_pos[2] + @cx2
end

#------------------------------------------------------------------------------
# ● Update Image Effect
#------------------------------------------------------------------------------
def update_image_effect
return if @wp[@wp_page].x != 0
@button_fade_time -= 1 if @button_fade_time > 0
if @image_active
@picture.opacity += 15
if @button_fade_time != 0
@button.opacity += 5
else
if @button.y < Graphics.height
@button.opacity -= 10
@button.y += 1
end
end
@wp[@wp_page].contents_opacity -= 15
@info.contents_opacity -= 15
@background.opacity -= 15
@cursor1.opacity -= 15
@cursor2.opacity -= 15
else
@picture.opacity -= 10
@button.opacity -= 15
@wp[@wp_page].contents_opacity += 15
@info.contents_opacity += 15
@background.opacity += 15
@cursor1.opacity += 15
@cursor2.opacity += 15
end
end

#------------------------------------------------------------------------------
# ● Refresh Info Window
#------------------------------------------------------------------------------
def refresh_info_window(starting = false)
return if @image_active
return if @wp_page_old == @wp_page and starting == false
@wp_page_old = @wp_page
page = @wp_page + 1
@picture_id = (9 * @wp_page) + @wp[@wp_page].index + 1
p_pages = " " + HELP_TEXT[0] + page.to_s + " / " + @max_pages.to_s
comp = " " + "(" +(@picures_enabled.to_f / @max_pictures.to_f * 100).truncate.to_s + "%)"
p_number = " " + HELP_TEXT[1] + " " + @picures_enabled.to_s + " / " + @max_pictures.to_s
@info.set_text_pic(p_pages + p_number + comp)
end

#------------------------------------------------------------------------------
# ● Update Slide
#------------------------------------------------------------------------------
def update_slide
@background2.ox += 1
if @loading != nil
@loading.opacity -= 5
if @loading.opacity <= 0
@loading.bitmap.dispose
@loading.dispose
@loading = nil
end
end
return if @wp[@wp_page].x == 0
slide_speed = 25
@picture.opacity = 0
@background.opacity = 255
if @slide_type == 1
if @wp[@wp_page].x < 0
@wp[@wp_page].x += slide_speed
if @wp[@wp_page].x >= 0
@wp[@wp_page].x = 0
end
end
if @wp[@page_old].x < Graphics.width
@wp[@page_old].x += slide_speed
if @wp[@page_old].x >= Graphics.width
@wp[@page_old].x = Graphics.width
end
end
else
if @wp[@wp_page].x > 0
@wp[@wp_page].x -= slide_speed
if @wp[@wp_page].x <= 0
@wp[@wp_page].x = 0
end
end
if @wp[@page_old].x > -Graphics.width
@wp[@page_old].x -= slide_speed
if @wp[@page_old].x <= -Graphics.width
@wp[@page_old].x = -Graphics.width
end
end
end
if @slide_type == 0
@wp[@wp_page].x = 0 if @wp[@wp_page].x <= 0
else
@wp[@wp_page].x = 0 if @wp[@wp_page].x >= 0
end
end

#------------------------------------------------------------------------------
# ● Check_limite
#------------------------------------------------------------------------------
def check_limit
if @wp_page < 0
@wp_page = @max_pages - 1
elsif @wp_page >= @max_pages
@wp_page = 0
end
check_active_window
end

#------------------------------------------------------------------------------
# ● Update Command Image
#------------------------------------------------------------------------------
def update_command_image
if Input.trigger?(Input::😎 or Input.trigger?(Input::C)
Sound.play_cursor
@image_active = false
@wp[@wp_page].active = true
return
end
if Input.trigger?(Input::R) or Input.trigger?(Input::L)
Sound.play_cursor
execute_zoom
end
update_move_image_hor
update_move_image_ver
end

#------------------------------------------------------------------------------
# ● Update Move Image Hor
#------------------------------------------------------------------------------
def update_move_image_hor
if !@move_hor
@picture.x = @pic_center_pos[0]
else
@ex += @scroll_speed[0] if Input.press?(Input::RIGHT)
@ex -= @scroll_speed[0] if Input.press?(Input::LEFT)
@ex = @ex_max + @ex_max_zoom if @ex > @ex_max + @ex_max_zoom
@ex = 0 if @ex < 0
@picture.x = -@ex
end
end

#------------------------------------------------------------------------------
# ● Update Move Image Ver
#------------------------------------------------------------------------------
def update_move_image_ver
if !@move_ver
@picture.y = @pic_center_pos[1]
else
@ey += @scroll_speed[1] if Input.press?(Input:😀OWN)
@ey -= @scroll_speed[1] if Input.press?(Input::UP)
@ey = @ey_max + @ey_max_zoom if @ey > @ey_max + @ey_max_zoom
@ey = 0 if @ey < 0
@picture.y = -@ey
end
end

#------------------------------------------------------------------------------
# ● Execute Zoom
#------------------------------------------------------------------------------
def execute_zoom
if @picture.zoom_x == 1.0
execute_zoom_in
else
cancel_zoom
end
end

#------------------------------------------------------------------------------
# ● Cancel Zoom
#------------------------------------------------------------------------------
def cancel_zoom
@ex -= @ex_max_zoom / 2
@ey -= @ey_max_zoom / 2
@picture.zoom_x = 1.0
@picture.zoom_y = 1.0
@ex_max_zoom = 0
@ey_max_zoom = 0
@move_hor = @picture.bitmap.width > Graphics.width ? true : false
@move_ver = @picture.bitmap.height > Graphics.height ? true : false
@pic_center_pos = [Graphics.width / 2 - (@picture.bitmap.width / 2),
Graphics.height / 2 - (@picture.bitmap.height / 2)]
refresh_button
end

#------------------------------------------------------------------------------
# ● Execute Zoom In
#------------------------------------------------------------------------------
def execute_zoom_in
@picture.zoom_x = 1.5
@picture.zoom_y = 1.5
zoom_width = (@picture.bitmap.width + (@picture.bitmap.width / 2)) - Graphics.width
if zoom_width.abs < Graphics.width
@ex_max_zoom = zoom_width > 0 ? zoom_width : 0
@move_hor = @ex_max_zoom > 0 ? true : false
@picture.x = Graphics.width / 2 - (@picture.bitmap.width + (@picture.bitmap.width / 2)) if !@move_hor
else
@ex_max_zoom = (@picture.bitmap.width / 2)
@move_hor = true
end
if @ex != @ex_max
@ex += @ex_max_zoom / 2
else
if @ex_max != 0
@ex += @ex_max_zoom
else
@ex += @ex_max_zoom / 2
end
end
zoom_height = (@picture.bitmap.height + (@picture.bitmap.height / 2)) - Graphics.height
if zoom_height.abs < Graphics.height
@ey_max_zoom = zoom_height > 0 ? zoom_height : 0
@move_ver = @ey_max_zoom > 0 ? true : false
else
@ey_max_zoom = (@picture.bitmap.height / 2)
@move_ver = true
end
if @ey != @ey_max
@ey += @ey_max_zoom / 2
else
if @ey_max != 0
@ey += @ey_max_zoom
else
@ey += @ey_max_zoom / 2
end
end
@pic_center_pos = [Graphics.width / 2 - (@picture.bitmap.width) + (@picture.bitmap.width / 4) ,
Graphics.height / 2 - (@picture.bitmap.height) + (@picture.bitmap.height / 4)]
refresh_button
end

#------------------------------------------------------------------------------
# ● check_avaliable_picture?
#------------------------------------------------------------------------------
def check_avaliable_picture?
@picture_id = (9 * @wp_page) + @wp[@wp_page].index + 1
return false if $game_system.gallery[@picture_id] == nil
return true
end

#------------------------------------------------------------------------------
# ● create_bitmap
#------------------------------------------------------------------------------
def create_bitmap
@picture.opacity = 0
@picture.bitmap.dispose
@picture.bitmap = Cache.gallery(@picture_id.to_s) rescue nil
@ex = 0
@ey = 0
@ex_max_zoom = 0
@ey_max_zoom = 0
@picture.zoom_x = 1.0
@picture.zoom_y = 1.0
if @picture.bitmap == nil
@picture.bitmap = Cache.gallery("")
return
end
if @picture.bitmap.width > Graphics.width
@ex_max = @picture.bitmap.width - Graphics.width
@move_hor = true
else
@ex_max = 0
@move_hor = false
end
if @picture.bitmap.height > Graphics.height
@ey_max = @picture.bitmap.height - Graphics.height
@move_ver = true
else
@ey_max = 0
@move_ver = false
end
refresh_button
@pic_center_pos = [Graphics.width / 2 - (@picture.bitmap.width / 2),
Graphics.height / 2 - (@picture.bitmap.height / 2)]
im_size_x = @picture.bitmap.width
im_size_y = @picture.bitmap.height
@scroll_speed[0] = (im_size_x / 240) + SCROLL_SPEED[0]
@scroll_speed[1] = (im_size_y / 240) + SCROLL_SPEED[1]
@scroll_speed[0] = 1 if @scroll_speed[0] < 0
@scroll_speed[1] = 1 if @scroll_speed[1] < 0
end


#------------------------------------------------------------------------------
# ● Refresh Button
#------------------------------------------------------------------------------
def refresh_button(type = 0)
@button.bitmap.clear
if @move_hor or @move_ver
src_rect = Rect.new(0, @ch, @cw, @ch)
else
src_rect = Rect.new(0, 0, @cw, @ch)
end
@button_bitmap .blt(0,0, @button_image, src_rect)
@button.y = Graphics.height - (@ch + 2)
@button_fade_time = 120
@button.opacity = 0 unless @button.y == Graphics.height - (@ch + 2)
end

#------------------------------------------------------------------------------
# ● Update Command
#------------------------------------------------------------------------------
def update_command
return if @wp[@wp_page].x != 0
if Input.trigger?(Input::😎
Sound.play_cancel
SceneManager.return
return
end
if Input.trigger?(Input::C)
if check_avaliable_picture?
Sound.play_ok
@image_active = true
@wp[@wp_page].active = false
create_bitmap
else
Sound.play_buzzer
end
return
end
if Input.trigger?(Input::L) and @max_pages != 1
Sound.play_cursor
@page_old = @wp_page
@wp_page -= 1
@slide_type = 1
check_limit
return
elsif Input.trigger?(Input::R) and @max_pages != 1
Sound.play_cursor
@page_old = @wp_page
@wp_page += 1
@slide_type = 0
check_limit
return
end
end

end

if MOG_PICTURE_GALLERY:😛ICTURE_GALLERY_MENU_COMMAND
#==============================================================================
# ■ Window Menu Command
#==============================================================================
class Window_MenuCommand < Window_Command

#------------------------------------------------------------------------------
# ● Add Main Commands
#------------------------------------------------------------------------------
alias mog_picture_gallery_add_main_commands add_main_commands
def add_main_commands
mog_picture_gallery_add_main_commands
add_command(MOG_PICTURE_GALLERY:😛ICTURE_GALLERY_COMMAND_NAME, 😛icture, main_commands_enabled)
end
end

#==============================================================================
# ■ Scene Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase

#------------------------------------------------------------------------------
# ● Create Command Windows
#------------------------------------------------------------------------------
alias mog_picture_gallery_create_command_window create_command_window
def create_command_window
mog_picture_gallery_create_command_window
@command_window.set_handler🙂picture, method🙂Picture_Gallery))
end

#------------------------------------------------------------------------------
# ● Picture Gallery
#------------------------------------------------------------------------------
def Picture_Gallery
SceneManager.call(Scene_Picture_Gallery)
end

end

end



Spoiler: Moghunter Music Room
#==============================================================================
# +++ MOG - MUSIC ROOM (v2.2) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Sistema que permite escutar as músicas tocadas durante o jogo.
#==============================================================================
#==============================================================================
# UTILIZAÇÃO
#
# 1 - Crie uma pasta com o nome MUSIC COVER
# /Graphics/Music_Room/
#
# 2 - Copie os seguintes arquivos contidos na Demo.
# Layout.png
# Layout2.png
#
#==============================================================================
# OPCIONAL
#
# Para adicionar imagens vinculadas as músicas nomeie a imagem da
# música com o mesmo nome do arquivo de música.
#
# Exemplo (eg)
#
# Nome da música
# Theme5.MP3 (Ogg/mid/etc...)
#
# Nome do imagem
# Theme5.png
#
#==============================================================================
# Para chamar o script use o comando abaixo.
#
# music_room
#
#==============================================================================
# ● Version History
#==============================================================================
# 2.1 - Melhor codificação,
# 2.0 - Verificação da música direto no módulo de áudio, o que deixa
# compátivel praticamente com todos os script que tocam música.
# - Opção de ocultar determinadas músicas na lista músicas.
# - Compatibilidade com resoluções maiores que o padrão normal.
#==============================================================================
module MOG_MUSIC_ROOM
# Ocultar a música na lista.
#
# FORCE_HIDE_MUSIC = ["Battle3","Battle5","Ending"]
#
FORCE_HIDE_MUSIC = []
# Ocultar músicas não disponíveis da lista.
HIDE_UNAVAILABLE_MUSIC = false
#Definição da informação da música apresentada na janela de ajuda.
MUSIC_INFO = {
"Town5" => "Title Screen Theme (by Enterbrain)",
"Field1" => "Town Theme (by Enterbrain)",
"Battle6" => "Battle Theme 3 (by Enterbrain)",
"Boss_Theme" => "Boss Theme (by Freedom House)",
"Battle_Theme" => "Battle Theme 1 (by Freedom House)",
"Battle_Theme2" => "Battle Theme 2 (by Freedom House)",
"Main_Theme" => "Main Theme (by Freedom House)"
}
# Posição da janela da lista de músicas.
MUSIC_LIST_POSITION_TEXT = [0, 200]
# Posição do layout da lista de músicas.
MUSIC_LIST_POSITION_LAYOUT = [0, 195]
# Tempo para ocultar a janela de lista de músicas.
MUSICLIST_FADE_TIME = 1#(Sec)
# Ativar a animação do gráfico do personagem. *(Não é obrigatório ser
# a imagem de um personagem, você pode criar outros efeitos de animações
# no lugar do personagem.
CHARACTER_SPRITE = false
# Velociadade da animação do personagem.
CHARACTER_ANIMATION_SPEED = 30
# Posição do personagem
CHARACTER_POSITION = [300,140]
# Definição da palavra Completado.
COMPLETED_WORD = "Completed"
# Posição do texto de informação.
INFO_POSITION = [0,373]
# Incluir músicas contidas no RTP.
INCLUDE_RTP = false
# Definição do diretório que foi instalado o RTP.
# Por padrão o caminho do diretório foi baseado no Windows 7 (64Bits).
# Outros sistemas operacionais o caminho do diretório é diferente.
RTP_PATH = "C:/Program Files (x86)/Common Files/Enterbrain/RGSS3/RPGVXAce/Audio/BGM/"
# Ativar o comando Music Box no menu principal.
MENU_COMMAND = true
# Nome do comando
MENU_COMMAND_NAME = "Music Box"
end

$imported = {} if $imported.nil?
$imported[:mog_music_room] = true

#===============================================================================
# ■ Game System
#===============================================================================
class Game_System

attr_accessor :music_book_list
attr_accessor :avaliable_music_list
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_music_book_initialize initialize
def initialize
mog_music_book_initialize
music_book_setup
end

#--------------------------------------------------------------------------
# ● Music Book Setup
#--------------------------------------------------------------------------
def music_book_setup
return if !SceneManager.scene_is?(Scene_Title)
@music_book_list = []
@avaliable_music_list = []
@music_book_list.push([$data_system.title_bgm.name,true]) if $data_system.title_bgm.name != ""
path = "Audio/BGM/"
make_music_list(path)
if MOG_MUSIC_ROOM::INCLUDE_RTP
path = MOG_MUSIC_ROOM::RTP_PATH
make_music_list(path)
end
end

#--------------------------------------------------------------------------
# ● Make_Music_List
#--------------------------------------------------------------------------
def make_music_list(path)
return if !File.directory?(path)
list = Dir.entries(path)
for i in 2...list.size
file_name = File.basename(list.to_s, ".*")
@music_book_list.push([file_name,false]) unless repeated_song?(file_name)
end
end

#--------------------------------------------------------------------------
# ● Repeated Song?
#--------------------------------------------------------------------------
def repeated_song?(file_name)
for i in MOG_MUSIC_ROOM::FORCE_HIDE_MUSIC
return true if file_name == i
end
for i in 0...@music_book_list.size
return true if @music_book_list.include?(file_name)
end
return false
end

#--------------------------------------------------------------------------
# ● Make Avaliable Music List
#--------------------------------------------------------------------------
def make_avaliable_music_list
@avaliable_music_list = []
for i in @music_book_list
@avaliable_music_list.push(i) if i[1]
end
end

end

#==============================================================================
# ■ Game Interpreter
#==============================================================================
class Game_Interpreter

#--------------------------------------------------------------------------
# ● Music Room
#--------------------------------------------------------------------------
def music_room
SceneManager.call(Scene_Music_Box)
end

end

#===============================================================================
# ■ RPG Audio
#===============================================================================
class << Audio

#--------------------------------------------------------------------------
# ● Bgm Play
#--------------------------------------------------------------------------
alias mog_music_box_bgm_play bgm_play
def bgm_play(filename, volume, pitch, pos = 0)
mog_music_box_bgm_play(filename, volume, pitch, pos)
check_music_book(filename)
end

#--------------------------------------------------------------------------
# ● Check Music Book
#--------------------------------------------------------------------------
def check_music_book(filename)
return if $game_system.music_book_list == nil
return if filename == nil or filename == ""
path = "Audio/BGM/"
for i in 0...$game_system.music_book_list.size
song_name = path.to_s + $game_system.music_book_list[0].to_s
if song_name.to_s == filename.to_s
$game_system.music_book_list[1] = true
break
end
end
end

end

#===============================================================================
# ■ RPG Cache
#===============================================================================
module Cache

#--------------------------------------------------------------------------
# ● Music Cover
#--------------------------------------------------------------------------
def self.music_cover(filename)
load_bitmap("Graphics/Music_Room/", filename)
end

end

#===============================================================================
# ■ RPG_FileTest
#===============================================================================
module RPG_FileTest

#--------------------------------------------------------------------------
# ● RPG_FileTest.music_cover_exist?
#--------------------------------------------------------------------------
def RPG_FileTest.music_cover_exist?(filename)
return Cache.music_cover(filename) rescue return false
end

end

#==============================================================================
# ■ Window_Picture
#==============================================================================
class Window_Music_List < Window_Selectable

include MOG_MUSIC_ROOM

#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, 155)
self.opacity = 0
@index = -1
if HIDE_UNAVAILABLE_MUSIC
@music_list = $game_system.avaliable_music_list
else
@music_list = $game_system.music_book_list
end
@item_max = @music_list.size
refresh
select(0)
activate
end

#------------------------------------------------------------------------------
# ● Refresh
#------------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
if @item_max > 0
self.contents = Bitmap.new(width - 32, 24 * @item_max)
for i in 0...@item_max
draw_item(i)
end
return
end
self.contents = Bitmap.new(width - 32, 24)
self.contents.draw_text(x,y,Graphics.width - 32,32,"No Data",0)
end

#------------------------------------------------------------------------------
# ● draw_item
#------------------------------------------------------------------------------
def draw_item(index)
x = 0
y = 24 * index
if @music_list[index][1]
change_color(normal_color,true)
music_name = MUSIC_INFO[@music_list[index][0].to_s] rescue nil
music_name = @music_list[index][0].to_s if music_name == nil
music = "Song " + sprintf("%02d", index + 1).to_s + " - " + music_name.to_s
else
change_color(normal_color,false)
music = "Song " + sprintf("%02d", index + 1).to_s + " - Not Available"
end
self.contents.draw_text(x,y,Graphics.width - 32,32,music,0)
end

#------------------------------------------------------------------------------
# ● Col Max
#------------------------------------------------------------------------------
def col_max
return 1
end

#------------------------------------------------------------------------------
# ● Item Max
#------------------------------------------------------------------------------
def item_max
return @item_max == nil ? 0 : @item_max
end

end

#===============================================================================
# ■ Scene Music Box
#===============================================================================
class Scene_Music_Box
include MOG_MUSIC_ROOM

#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
execute_dispose
create_music_list
create_layout
create_sprite_now_playing
create_character
execute_loop
execute_dispose
end

#--------------------------------------------------------------------------
# ● Execute Loop
#--------------------------------------------------------------------------
def execute_loop
Graphics.transition
loop do
Graphics.update
Input.update
update
break if SceneManager.scene != self
end
end

#--------------------------------------------------------------------------
# ● Create Layout
#--------------------------------------------------------------------------
def create_layout
@background = Sprite.new
@background.z = 1
make_background_zero
@layout = Sprite.new
@layout.bitmap = Cache.music_cover("Layout")
@layout.z = 90
@old_index = -1
end

#--------------------------------------------------------------------------
# ● create Sprite now Playing
#--------------------------------------------------------------------------
def create_sprite_now_playing
@now_playing = Plane.new
@now_playing.bitmap = Bitmap.new(Graphics.width,Graphics.height)
@now_playing.z = 100
check_completion
make_now_playing(true)
end

#--------------------------------------------------------------------------
# ● Check Completion
#--------------------------------------------------------------------------
def check_completion
comp = 0
for i in 0...$game_system.music_book_list.size
comp += 1 if $game_system.music_book_list[1]
end
if $game_system.music_book_list.size > 0
@completed = "( " + COMPLETED_WORD + " " + (comp.to_f / $game_system.music_book_list.size * 100).truncate.to_s + "% )"
else
@completed = "( " + COMPLETED_WORD + " )"
end
end

#--------------------------------------------------------------------------
# ● Screen Rev X
#--------------------------------------------------------------------------
def screen_rev_x
Graphics.width - 544
end

#--------------------------------------------------------------------------
# ● Screen Rev Y
#--------------------------------------------------------------------------
def screen_rev_y
Graphics.height - 416
end

#--------------------------------------------------------------------------
# ● Create_Character
#--------------------------------------------------------------------------
def create_character
return if !CHARACTER_SPRITE
@character_index = 0
@character_animation_speed = 0
@character = Sprite.new
@character.z = 80
@character_image = Cache.music_cover("Character")
@character_frame_max = @character_image.width / @character_image.height
@character_width = @character_image.width / @character_frame_max
@character.bitmap = Bitmap.new(@character_width,@character_image.height)
@character.x = CHARACTER_POSITION[0] + screen_rev_x
@character.y = CHARACTER_POSITION[1] + screen_rev_y
make_character_bitmap
end

#--------------------------------------------------------------------------
# ● Make Now Playing
#--------------------------------------------------------------------------
def make_now_playing(init = false)
@now_playing.bitmap.clear
@now_playing.bitmap.font.size = 20
@now_playing.bitmap.font.bold = true
music_name = MUSIC_INFO[song_name.to_s] rescue nil
music_name = song_name if music_name == nil
text = music_name.to_s + " " + @completed
text = @completed if init
@now_playing.bitmap.draw_text(INFO_POSITION[0] + screen_rev_x,INFO_POSITION[1] + screen_rev_y, Graphics.width, 32, text.to_s,1)
@now_playing.opacity = 0
end

#--------------------------------------------------------------------------
# ● Make Background Zero
#--------------------------------------------------------------------------
def make_background_zero
if @background.bitmap != nil
@background.bitmap.dispose
@background.bitmap = nil
end
if RPG_FileTest.music_cover_exist?("Background")
@background.bitmap = Cache.music_cover("Background")
@background.ox = @background.bitmap.width / 2
@background.oy = @background.bitmap.height / 2
@background.x = Graphics.width / 2
@background.y = Graphics.height / 2
else
@background.bitmap = Cache.music_cover("")
end
end

#--------------------------------------------------------------------------
# ● Make Background
#--------------------------------------------------------------------------
def make_background
if @background.bitmap != nil
@background.bitmap.dispose
@background.bitmap = nil
end
if RPG_FileTest.music_cover_exist?(song_name)
@background.bitmap = Cache.music_cover(song_name)
@background.ox = @background.width / 2
@background.oy = @background.height / 2
@background.x = Graphics.width / 2
@background.y = Graphics.height / 2
else
@background.bitmap = Cache.music_cover("")
end
@background.opacity = 0
end

#--------------------------------------------------------------------------
# ● Song Name
#--------------------------------------------------------------------------
def song_name
if @music_list.size == 0
return ""
end
return @music_list[@music_list_window.index][0].to_s
end

#--------------------------------------------------------------------------
# ● Create_Music_List
#--------------------------------------------------------------------------
def create_music_list
$game_system.make_avaliable_music_list
if HIDE_UNAVAILABLE_MUSIC
@music_list = $game_system.avaliable_music_list
else
@music_list = $game_system.music_book_list
end
@stop = true
@layout2 = Sprite.new
@layout2.bitmap = Cache.music_cover("Layout2")
@layout_org_position = [MUSIC_LIST_POSITION_LAYOUT[0],MUSIC_LIST_POSITION_LAYOUT[1] + screen_rev_y ]
@layout2.y = @layout_org_position[1]
@layout2.z = 90
@music_list_window = Window_Music_List.new
@music_list_window.z = 100
@music_list_window_org = [MUSIC_LIST_POSITION_TEXT[0],MUSIC_LIST_POSITION_TEXT[1] + screen_rev_y]
@music_list_window.y = @music_list_window_org[1]
@music_index = @music_list_window.index
@fade_max = 60 + 60 * MUSICLIST_FADE_TIME
@fade_time = @fade_max
@music_list_window.x = -Graphics.width
@music_list_window.contents_opacity = 0
@layout2.x = -Graphics.width
@layout2.opacity = 0
end

#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
BattleManager.save_bgm_and_bgs
RPG::BGM.fade(2 * 1000)
RPG::BGS.fade(2 * 1000)
@w_visible = true
end


#--------------------------------------------------------------------------
# ● Execute Dispose
#--------------------------------------------------------------------------
def execute_dispose
return if @layout == nil
Graphics.freeze
@music_list_window.dispose
if @background.bitmap != nil
@background.bitmap.dispose
end
@background.dispose
@layout.bitmap.dispose
@layout.dispose
@layout = nil
@layout2.bitmap.dispose
@layout2.dispose
@now_playing.bitmap.dispose
@now_playing.dispose
if CHARACTER_SPRITE
@character.bitmap.dispose
@character.dispose
@character_image.dispose
end
RPG::BGM.stop
BattleManager.replay_bgm_and_bgs
end

#--------------------------------------------------------------------------
# ● Hide_Layout
#--------------------------------------------------------------------------
def hide_layout
Sound.play_ok
@w_visible = @w_visible == true ? false : true
@fade_time = @w_visible ? @fade_max : 0
@layout.visible = @w_visible
if CHARACTER_SPRITE
@character.visible = @w_visible
end
end

#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_commands
update_animation
end

#--------------------------------------------------------------------------
# ● Update Animation
#--------------------------------------------------------------------------
def update_animation
@now_playing.opacity += 2
@now_playing.ox += 1
update_list_fade
update_character_animation
update_background_animation
end

#--------------------------------------------------------------------------
# ● Update Background Animation
#--------------------------------------------------------------------------
def update_background_animation
@background.opacity += 1
end

#--------------------------------------------------------------------------
# ● Update Character Animation
#--------------------------------------------------------------------------
def update_character_animation
return if !CHARACTER_SPRITE or @stop
@character_animation_speed += 1
if @character_animation_speed > CHARACTER_ANIMATION_SPEED
@character_animation_speed = 0
@character_index += 1
@character_index = 0 if @character_index >= @character_frame_max
make_character_bitmap
end
end

#--------------------------------------------------------------------------
# ● Make Character_bitmap
#--------------------------------------------------------------------------
def make_character_bitmap
@character.bitmap.clear
src_rect_back = Rect.new(@character_width * @character_index, 0,@character_width,@character_image.height)
@character.bitmap.blt(0,0, @character_image, src_rect_back)
end

#--------------------------------------------------------------------------
# ● Update List Fade
#--------------------------------------------------------------------------
def update_list_fade
@fade_time = @fade_max if moved?
slide_speed = 5
fade_speed = 3
if @fade_time > 0
@fade_time -= 1 unless @stop
@layout2.opacity += fade_speed * 2
@music_list_window.contents_opacity += fade_speed * 2
if @music_list_window.x < @music_list_window_org[0]
@music_list_window.x += slide_speed * 2
@layout2.x += slide_speed * 2
if @music_list_window.x >= @music_list_window_org[0]
@music_list_window.x = @music_list_window_org[0]
@layout2.x = @layout_org_position[0]
end
end
else
@music_list_window.x -= slide_speed
@music_list_window.contents_opacity -= fade_speed
@layout2.x -= slide_speed
@layout2.opacity -= fade_speed
if @music_list_window.x < -Graphics.width
@music_list_window.x = -Graphics.width
@music_list_window.contents_opacity = 0
@layout2.x = -Graphics.width
@layout2.opacity = 0
end
end
end

#--------------------------------------------------------------------------
# ● Moved?
#--------------------------------------------------------------------------
def moved?
return true if Input.trigger?🙂C)
return true if Input.trigger?🙂😎
return true if Input.trigger?🙂X)
return true if Input.trigger?🙂R)
return true if Input.trigger?🙂L)
return true if Input.press?(Input.dir4)
return false
end

#--------------------------------------------------------------------------
# ● Update Commands
#--------------------------------------------------------------------------
def update_commands
@music_list_window.update
if Input.trigger?🙂😎
return_to_scene
elsif Input.trigger?🙂C)
play_song
elsif Input.trigger?🙂X)
stop_song
elsif Input.trigger?🙂Y)
hide_layout
end
end

#--------------------------------------------------------------------------
# ● Return to Scene
#--------------------------------------------------------------------------
def return_to_scene
return if @fade_time == 0 and @layout2.opacity == 0
Sound.play_cancel
SceneManager.return
end

#--------------------------------------------------------------------------
# ● index_changed?
#--------------------------------------------------------------------------
def index_changed?
if @old_index != @music_list_window.index
@old_index = @music_list_window.index
return true
end
return false
end

#--------------------------------------------------------------------------
# ● Play Song
#--------------------------------------------------------------------------
def play_song
return if @music_list.size == 0
return if @fade_time == 0 and @layout2.opacity == 0
if @music_list[@music_list_window.index][1]
if index_changed? or @stop
Sound.play_ok
@stop = false
Audio.bgm_play("Audio/BGM/" + song_name, 100, 100) rescue nil
make_background
make_now_playing
end
else
Sound.play_buzzer
end
end

#--------------------------------------------------------------------------
# ● Stop Song
#--------------------------------------------------------------------------
def stop_song
Sound.play_ok
@stop = true
RPG::BGM.fade(3 * 1000)
make_now_playing(true)
end
end

if MOG_MUSIC_ROOM::MENU_COMMAND
#==============================================================================
# ■ Window Menu Command
#==============================================================================
class Window_MenuCommand < Window_Command

#------------------------------------------------------------------------------
# ● Add Main Commands
#------------------------------------------------------------------------------
alias mog_musicbox_add_main_commands add_main_commands
def add_main_commands
mog_musicbox_add_main_commands
add_command(MOG_MUSIC_ROOM::MENU_COMMAND_NAME, :musicbox, main_commands_enabled)
end
end

#==============================================================================
# ■ Scene Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase

#------------------------------------------------------------------------------
# ● Create Command Windows
#------------------------------------------------------------------------------
alias mog_musicbox_create_command_window create_command_window
def create_command_window
mog_musicbox_create_command_window
@command_window.set_handler🙂musicbox, method🙂Music_Box))
end

#------------------------------------------------------------------------------
# ● Music Box
#------------------------------------------------------------------------------
def Music_Box
SceneManager.call(Scene_Music_Box)
end

end

end

I have moved this thread from RGSS3 Scripts (RMVX Ace) to RGSSx Script Support.
I never installed Yanfly's core menu script and added it. But in doing so, two of the main menu options for the Moghunter Gallery and Moghunter Music room have now vanished. I was curious if they could be added back somehow and wasn't sure what to put into the menu settings to do so.
Do you have Yanfly Menu script below the MOG scripts?
Do you have Yanfly Menu script below the MOG scripts?
No, in the script order it's above the Mog Scripts with all the other Yanfly Scripts.
No, in the script order it's above the Mog Scripts with all the other Yanfly Scripts.
Oh right Yanfly has a custom menu process.
We need to add the commands for the other scripts in.
It would be easier to add them in the custom commands section
Ruby:
    CUSTOM_COMMANDS ={
    # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
      :picture   => [ "Picture Gallery",      0,          0, :Picture_Gallery],
      :musicbox  => [ "Music Room",           0,          0,  :Music_Box],
Oh right Yanfly has a custom menu process.
We need to add the commands for the other scripts in.
It would be easier to add them in the custom commands section
Ruby:
    CUSTOM_COMMANDS ={
    # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
      :picture   => [ "Picture Gallery",      0,          0, :Picture_Gallery],
      :musicbox  => [ "Music Room",           0,          0,  :Music_Box],

Gave that a shot, nothing appears on the menu unfortunately.
Gave that a shot, nothing appears on the menu unfortunately.
Right I forgot about the command section.
Ruby:
    COMMANDS =[
      :item,         # Opens up the item menu. Default menu item.
      :picture,
      :musicbox,
      :skill,        # Opens up the skill menu. Default menu item.
      :equip,        # Opens up the equip menu. Default menu item.
      :class,        # Requires YEA - Class System.
      :status,       # Opens up the status menu. Default menu item.
      :formation,    # Lets player manage party. Default menu item.
    # :event_1,      # Launches Common Event 1. Common Event Command.
    # :event_2,      # Launches Common Event 2. Common Event Command.
    # :debug,        # Opens up debug menu. Custom Command.
    # :shop,         # Opens up a shop to pawn items. Custom Command.
      :save,         # Opens up the save menu. Default menu item.
      :game_end,     # Opens up the shutdown menu. Default menu item.
    ] # Do not remove this.
Right I forgot about the command section.
Ruby:
    COMMANDS =[
      :item,         # Opens up the item menu. Default menu item.
      :Picture_Gallery,
      :Music_Box,
      :skill,        # Opens up the skill menu. Default menu item.
      :equip,        # Opens up the equip menu. Default menu item.
      :class,        # Requires YEA - Class System.
      :status,       # Opens up the status menu. Default menu item.
      :formation,    # Lets player manage party. Default menu item.
    # :event_1,      # Launches Common Event 1. Common Event Command.
    # :event_2,      # Launches Common Event 2. Common Event Command.
    # :debug,        # Opens up debug menu. Custom Command.
    # :shop,         # Opens up a shop to pawn items. Custom Command.
      :save,         # Opens up the save menu. Default menu item.
      :game_end,     # Opens up the shutdown menu. Default menu item.
    ] # Do not remove this.

Hrmmn, afraid nothing happens when I add that in either.
Hrmmn, afraid nothing happens when I add that in either.
I'm afraid I put the wrong text in. I updated the code above. try again
Works perfect, thanks for you all your help 🙂

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-menu-with-moghunter-items.167478/