Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

In-Game Music Library (Request)

Thank you for taking the time and effort to read this request, i am indeed truly thankful.

I am basically near the end of my game, Heroes of Everforge, just adding the finishing touchest, latest bug checks, minor details, ect ect.

So, i thought, of having a Piano, in a room, say.. a church, that you can play music on, the BGM music from the game but you have to unlock them. since I'm crap at doing any scripting (I mean I screwed up that really simple HUD scripting tutorial thing) i was wondering, if some brave hero may come help me out?

What I want, is a script that brings up a menu, in game, that you can select BGM songs from the database to play, but I want to be able to add a feature to unlock the songs, like after you go into an area.


Scripts I want:
The library script, that brings up the library of songs.

Unlock script, a script that would unlock a piece of music (I put it in an EVENT)

OH! and I want this on Xp. Haha, almost forgot.

Thanks for listening.
Best Regards



Wankstain (squirt)
 

Atoa

Member

I have this one, the music unlocks once you heard it.
And you can add only the musics you want.
Code:
#==============================================================================

# Music Library

# by momo

#==============================================================================

 

module MoMo_Sound_Test

  NO_GET_SOUND_SHOW = false

  USE_SWITCH = true

#==============================================================================

# Total music number display

# 0 = don't show

# 1 = total numbers

# 2 = show %

#==============================================================================

  SHOW_COMPLETE_TYPE = 1

  COMMENT_SYSTEM = false

  SYSTEM_DATA_SAVE = false

  SYSTEM_DATA_LOAD = false

  sound = [nil]

#==============================================================================

# sound[ID] = ["Name in Menu", "Archive name", 100, 100, 0]

#

# the musics are added to the menu, when you hear them in game.

#==============================================================================

  sound[1] = ["Overworld", "018-Field01", 100, 100, 0]

  sound[2] = ["Cave", "001-Battle01", 100, 100, 0]

  sound[3] = ["Battle", "035-Dungeon01", 100, 100, 0]

  sound[4] = ["Boss", "005-Boss01", 100, 100, 0]

  ################################################################

  SOUND_DATA = sound

end

  

module MoMo_Sound_Test

  module_function

  def sound_info_switch_judge(id, form_title=false)

    return true if !USE_SWITCH or form_title

    sw = get_need_switch(id)

    if sw == 0

      return true

    else

      return $game_switches[sw]

    end

  end

  def get_sound_name(id)

    return SOUND_DATA[id][0]

  end

  def get_file_name(id)

    return SOUND_DATA[id][1]

  end

  def get_sound_volume(id)

    return SOUND_DATA[id][2]

  end

  def get_sound_pitch(id)

    return SOUND_DATA[id][3]

  end

  def get_need_switch(id)

    return SOUND_DATA[id][4]

  end

  def get_sound_comment(id)

    return nil if !COMMENT_SYSTEM 

    if MoMo_S_Test_Comment::S_TEST_COMMENT[id] == nil

      return MoMo_S_Test_Comment::S_TEST_COMMENT[0]

    else

      return MoMo_S_Test_Comment::S_TEST_COMMENT[id]

    end

  end

  def add_sound_info(file_name)

    sound_info_path(false)[file_name] = 1 if sound_info_path(false) != nil

    if need_system_save? and sound_info_path(false) != nil

      sound_info_path(true)[file_name] = 1

    end

  end

  def del_sound_info(file_name)

    sound_info_path(false)[file_name] = 0

    if need_system_save?

      sound_info_path(true)[file_name] = 0

    end

  end

  def have_sound_info?(id, from_title=false)

    return true if NO_GET_SOUND_SHOW

    return (sound_info_path(from_title)[get_file_name(id)] == 1)

  end

  def need_system_save?

    return (SYSTEM_DATA_SAVE and $system_data != nil)

  end

  def sound_data_max

    return SOUND_DATA.size - 1

  end

  def sound_data_now(from_title=false)

    num = 0

    for i in 1...SOUND_DATA.size

      sound = SOUND_DATA[i]

      if sound != nil and

         (NO_GET_SOUND_SHOW or have_sound_info?(i, from_title)) and

         (from_title or !USE_SWITCH or sound[4] == 0 or $game_switches[sound[4]])

        num += 1

      end

    end

    return num

  end

  def sound_data_complete_percentage(from_title=false)

    s_max = sound_data_max.to_f

    s_now = sound_data_now(from_title).to_f

    comp = s_now / s_max * 100

    return comp.truncate

  end

  def sound_info_path(from_title=false)

    if (!from_title and !SYSTEM_DATA_LOAD)

      return nil if $game_party == nil

      return $game_party.sound_info

    else

      return nil if $system_data == nil

      return $system_data.sound_info

    end

  end

end

 

class Sound_Test_Data

  attr_reader   :id

  attr_reader   :soundname

  attr_reader   :filename

  attr_reader   :volume

  attr_reader   :pitch

  attr_reader   :need_switch

  def initialize(id)

    @id = id

    @soundname = MoMo_Sound_Test.get_sound_name(id)

    @filename = MoMo_Sound_Test.get_file_name(id)

    @volume = MoMo_Sound_Test.get_sound_volume(id)

    @pitch = MoMo_Sound_Test.get_sound_pitch(id)

    @need_switch = MoMo_Sound_Test.get_need_switch(id)

    @comment = MoMo_Sound_Test.get_sound_comment(id)

  end

end

 

class Game_System

  alias game_system_sound_test_bgm_play bgm_play

  def bgm_play(bgm)

    if bgm != nil and bgm.name != ""

      MoMo_Sound_Test.add_sound_info(bgm.name)

    end

    game_system_sound_test_bgm_play(bgm)

  end

end

 

class Game_Party

  include MoMo_Sound_Test

  attr_accessor :sound_info

  alias game_party_sound_test_initialize initialize

  def initialize

    game_party_sound_test_initialize

    @sound_info = {}

  end

end

 

class Interpreter

  def sound_data_max

    return MoMo_Sound_Test.sound_data_max

  end

  def sound_data_now

    return MoMo_Sound_Test.sound_data_now

  end

  def sound_data_comp

    return MoMo_Sound_Test.sound_data_complete_percentage

  end

end

 

class Window_Sound_Test < Window_Selectable

  def initialize(index=0, from_title=false)

    @from_title = from_title

    if MoMo_Sound_Test::COMMENT_SYSTEM

      super(0, 64, 640, 416 - 128)

    else

      super(0, 64, 640, 416)

    end

    @column_max = 2

    self.index = index

    refresh

  end

  def set_data

    for i in 1...MoMo_Sound_Test::SOUND_DATA.size

      @data.push(Sound_Test_Data.new(i))

    end

  end

  def show?(id)

    bool = (MoMo_Sound_Test.have_sound_info?(id, @from_title) and

            MoMo_Sound_Test.sound_info_switch_judge(id, @from_title))

    return bool

  end

  def item

    return @data[self.index]

  end

  def refresh

    if self.contents != nil

      self.contents.dispose

      self.contents = nil

    end

    @data = []

    set_data

    @item_max = @data.size

    self.contents = Bitmap.new(width - 32, row_max * 32)

    if @item_max > 0

      for i in 0...@item_max

       draw_item(i)

      end

    end

  end

  def draw_item(index)

    sound = @data[index]

    x = 4 + index % 2 * (288 + 32)

    y = index / 2 * 32

    rect = Rect.new(x, y, self.width / @column_max - 32, 32)

    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

    self.contents.font.color = normal_color

    self.contents.draw_text(x, y, 32, 32, sound.id.to_s)

    if show?(sound.id)

      self.contents.draw_text(x + 28+16, y, 212, 32, sound.soundname, 0)

    else

      self.contents.draw_text(x + 28+16, y, 212, 32, "------", 0)

      return

    end

  end

end

 

class Scene_Sound_Test

  def initialize(from_title=false)

    @from_title = from_title

  end

  #--------------------------------------------------------------------------

  def main

    @map_bgm = $game_system.playing_bgm

    @title_window = Window_Base.new(0, 0, 640, 64)

    @title_window.contents = Bitmap.new(640 - 32, 64 - 32)

    @title_window.contents.draw_text(4, 0, 320, 32, "Livro de Música", 0)

    if MoMo_Sound_Test::SHOW_COMPLETE_TYPE != 0

      case MoMo_Sound_Test::SHOW_COMPLETE_TYPE

      when 1

        s_now = MoMo_Sound_Test.sound_data_now(@from_title)

        s_max = MoMo_Sound_Test.sound_data_max

        text = s_now.to_s + "/" + s_max.to_s

      when 2

        comp = MoMo_Sound_Test.sound_data_complete_percentage(@from_title)

        text = comp.to_s + "%"

      when 3

        s_now = MoMo_Sound_Test.sound_data_now(@from_title)

        s_max = MoMo_Sound_Test.sound_data_max

        comp = MoMo_Sound_Test.sound_data_complete_percentage(@from_title)

        text = s_now.to_s + "/" + s_max.to_s + " " + comp.to_s + "%"

      end

      if text != nil

        @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)

      end

    end

    @main_window = Window_Sound_Test.new(0, @from_title)

    @main_window.active = true

    if MoMo_Sound_Test::COMMENT_SYSTEM

      @comment_window = Window_Sound_Test_Comment.new

      @comment_window.z = 120

      draw_comment

    end

    Graphics.transition

    loop do

      Graphics.update

      Input.update

      update

      if $scene != self

        break

      end

    end

    Graphics.freeze

    @main_window.x -= 10

    @main_window.dispose

    @title_window.dispose

    @comment_window.dispose if @comment_window != nil

  end

  def update

    @main_window.update

    if @main_window.active

      update_main

      return

    end

  end

  def update_main

    if MoMo_Sound_Test::COMMENT_SYSTEM and @last_index != @main_window.index

      @last_index = @main_window.index

      draw_comment

    end

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      $game_system.bgm_play(@map_bgm)

      if @from_title

        $scene = Scene_Title.new

      else

        $scene = Scene_Map.new

      end

      return

    end

    if Input.trigger?(Input::C)

      if @main_window.item == nil or @main_window.show?(@main_window.item.id) == false

        $game_system.se_play($data_system.buzzer_se)

        return

      end

      $game_system.se_play($data_system.decision_se)

      filename = @main_window.item.filename

      volume = @main_window.item.volume

      pitch = @main_window.item.pitch

      Audio.bgm_play("Audio/BGM/" + filename, volume, pitch)

      return

    end

  end

  def draw_comment

    if @main_window.show?(@main_window.item.id)

      @comment_window.draw_comment(@main_window.item.id)

    else

      @comment_window.clear_comment

    end

  end

end
 
Thanks a lot! I am grateful and really appreciate this, thanks for taking the time out of your life :). it's a shame you couldn't 'show' me how it works really, plus i would like to know if it is what i requested or something similar. thanks a lot, i will have a good look through it.
 
Hey, I was thinking...

If a player unlocks a song they really like, are they just going to have to sit in the church and listen while they play it?  Why not unlock an ocarina, or a flute, or something along those lines that plays the music wherever they want.  That way, if they really like a song, they can play it while monster hunting or just exploring.  Just a thought...

Good luck finding your script.  I can't script either!
 
Hmm, well that idea sounds great too, I'm guessing if i really tried hard i could do that with conditional branches and what not. But even you all must admit, doing them with scripts is a lot easier, just a base script in the archive and a line in the event? wouldn't you say? If it doesn't work out and no one helps me, I'll try it out on conditional branches ect.
 
This is very basic, the script is pretty self expanitory, requires SDK 2.0 or higher, and Aleworks Library.

[#]SDK Part 1
[#]Aleworks Library
[#]RGSS.RTP
[#]Music Player
[#]main

You can actually place the Music Player script anywhere as long as it is below MACL and Aleworks, above main.

Current Features
[#]Lists audiofiles from RTP directories, as well as game folder
[#]Select which audio kinds to show
[#]An easy module to handle the script

Features Being Implemented (WIPs)
[#]The 'JukeBox' scene can cost you a little money (optional)
[#]Audio is memorized when it is played
[#]Options to restrict people to playing only previously heard tracks from the game
[#]An option to override normal audio play
[#]Add the option of placing the scene into the Menu
[#]Remove the command window entirely if only one audio type is available for menu
[#]Add something so you can change volume/pitch in the menu, maybe?

And then maybe...
[#]Change it so it doesn't absolutely require my RGSS.RTP script (it'll just list from game folder in that case)
[#]Make the script less generic and give it a fancy makeover.
[#]Perhaps I'll make it look "Mog styled" but who knows...

Code:
#===============================================================================
# ** RGSS.RTP
#-------------------------------------------------------------------------------
# Written by  : Kain Nobel
# Version     : 1.0
# Last Update : 08/19/2008
# Created On  : 08/16/2008
#-------------------------------------------------------------------------------
# * Description :
#
#   This script reads the GameINI and the Window's Registry to return the data
#   information of the Run Time Package(s) the game has assigned. You can list
#   files from a single RTP, or all RTP files, with ease.
#-------------------------------------------------------------------------------
# * Requirements :
#
#   This script requires the Aleworks Library to read the Window's Registry.
#   You can find what you need by visiting this topic
#
#   - http://www.rmxp.org/forums/index.php?topic=28392.0
#-------------------------------------------------------------------------------
# * Instructions :
#
#   Place The Script Below the SDK and Above Main.
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
if Object.const_defined?(:SDK)
  SDK.log('MACL::RGSS.RTP', 'Kain Nobel', 2.0, '11.05.2008')
end
#-------------------------------------------------------------------------------
# * MACL Loading
#-------------------------------------------------------------------------------
if Object.const_defined?(:MACL)
  MACL::Loaded << 'RGSS.RTP'
end
#===============================================================================
# ** GameINI
#-------------------------------------------------------------------------------
#   This module simply reads Game.ini file located in the parent Game folder.
#===============================================================================

module GameINI
  def self.read(entry)
    File.open("Game.ini").each{ |row|
    if row =~ Regexp.new("^" + entry + "=.*$")
      str = (row.scan(Regexp.new("^" + entry + "=(.*)$"))[0]).to_s
      return str == "" ? '(none)' : str
    end
    }
    File.close("Game.ini")
  end
end

#===============================================================================
# ** RTP
#-------------------------------------------------------------------------------
#   This class simply sets up RTP information for use in other scripts.
#===============================================================================

module RTP
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_reader :files
  #-----------------------------------------------------------------------------
  # * RTP.files(n)
  #-----------------------------------------------------------------------------
  def RTP.files(n = 1)
    requirement_test
    return if !n.is_a?(Numeric)
    filepaths = []
    n = n.to_s unless n.is_a?(String)
    key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Enterbrain\\RGSS\\RTP\\'
    data = Aleworks::Registry.read_entry(key, GameINI.read('RTP'+n))
    data.gsub!('\\', '/') unless data.nil?
    return data
  end
  #-----------------------------------------------------------------------------
  # * RTP.list_all(directory)
  #-----------------------------------------------------------------------------
  def RTP.list(directory)
    requirement_test
    return if !directory.is_a?(String)
    files = Dir.new(directory).entries
    files[0,2] = nil, nil
    [1, 2, 3].each do |i|
      unless RTP.files(i).nil?
        dir = Dir.new(RTP.files(i)+directory).entries
        dir[0,2] = nil, nil
        files += dir
      end
    end
    files.compact!
  end
  #-----------------------------------------------------------------------------
  # * RTP.requirement_test
  #-----------------------------------------------------------------------------
  def RTP.requirement_test
    unless defined?(Aleworks) && Aleworks.is_a?(Module)
      print("Please install the Aleworks Library to read the Windows Registry,",
      "you can find it @\n http://www.rmxp.org/forums/index.php?topic=28392.0")
      exit
    end
  end
end
Code:
#===============================================================================
# ** Music Player Script                                        (by Kain Nobel)
#-------------------------------------------------------------------------------
#   This script creates a scene that allows you to freely play the game's audio.
#===============================================================================

#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Systems.MusicPlayer', 'Kain Nobel', 2.0, '08.24.2008')
SDK.check_requirements(2.0, [1])
#-------------------------------------------------------------------------------
# * SDK Enabled Test - BEGIN
#-------------------------------------------------------------------------------
if SDK.enabled?('Systems.MusicPlayer')

#===============================================================================
# ** SDK::Vocab::JukeBox
#-------------------------------------------------------------------------------
#   ...
#===============================================================================

module SDK::Vocab::JukeBox
  #-----------------------------------------------------------------------------
  # * BGM Command
  #-----------------------------------------------------------------------------
  BGM = 'BGM'
  #-----------------------------------------------------------------------------
  # * BGS Command
  #-----------------------------------------------------------------------------
  BGS = 'BGS'
  #-----------------------------------------------------------------------------
  # * SE Command
  #-----------------------------------------------------------------------------
  SE  = 'SE'
  #-----------------------------------------------------------------------------
  # * ME Command
  #-----------------------------------------------------------------------------
  ME  = 'ME'
end

#===============================================================================
# ** Music Player Script
#-------------------------------------------------------------------------------
#   ...
#===============================================================================

module JukeBox
  #-----------------------------------------------------------------------------
  # * Is all music currently unlocked?
  #-----------------------------------------------------------------------------
  All_Content_Unlocked = false
  #-----------------------------------------------------------------------------
  # * Does the JukeBox system play Background Music?
  #-----------------------------------------------------------------------------
  Play_BGM = true
  #-----------------------------------------------------------------------------
  # * Does the JukeBox system play Background Sounds?
  #-----------------------------------------------------------------------------
  Play_BGS = true
  #-----------------------------------------------------------------------------
  # * Does the JukeBox system play Sound Effects?
  #-----------------------------------------------------------------------------
  Play_SE = false
  #-----------------------------------------------------------------------------
  # * Does the JukeBox system play Music Effects?
  #-----------------------------------------------------------------------------
  Play_ME = false
  #-----------------------------------------------------------------------------
  # * Whats the cost to play song? (Must be a numeric equal or greater than 0)
  #-----------------------------------------------------------------------------
  Cost_To_Play = 0
  #-----------------------------------------------------------------------------
  # * JukeBox.open (Opens the JukeBox scene)
  #-----------------------------------------------------------------------------
  def self.open
    $scene = Scene_JukeBox.new
  end
end

#===============================================================================
# ** Game_AudioLog
#-------------------------------------------------------------------------------
#   This class handles logging Audio of different types for the JukeBox module.
#===============================================================================

class Game_AudioLog
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize
    @unlocked_bgm = Array.new
    @unlocked_bgs = Array.new
    @unlocked_se  = Array.new
    @unlocked_me  = Array.new
  end
  #-----------------------------------------------------------------------------
  # * BGM Unlocked?
  #-----------------------------------------------------------------------------
  def bgm_unlocked?(filename)
    return !@unlocked_bgm.include?(filename)
  end
  #-----------------------------------------------------------------------------
  # * BGS Unlocked?
  #-----------------------------------------------------------------------------
  def bgs_unlocked?(filename)
    return @unlocked_bgs.include?(filename)
  end
  #-----------------------------------------------------------------------------
  # * SE Unlocked?
  #-----------------------------------------------------------------------------
  def se_unlocked?(filename)
    return @unlocked_se.include?(filename)
  end
  #-----------------------------------------------------------------------------
  # * ME Unlocked?
  #-----------------------------------------------------------------------------
  def me_unlocked?(filename)
    return @unlocked_me.include?(filename)
  end
  #-----------------------------------------------------------------------------
  # * Unlock BGM
  #-----------------------------------------------------------------------------
  def unlock_bgm(title)
    unless @unlocked_bgm.include?(title)
      @unlocked_bgm << title
      @unlocked_bgm.sort!
    end
  end
  #-----------------------------------------------------------------------------
  # * Unlock BGS
  #-----------------------------------------------------------------------------
  def unlock_bgs(title)
    unless @unlocked_bgs.include?(title)
      @unlocked_bgs << title
      @unlocked_bgs.sort!
    end
  end
  #-----------------------------------------------------------------------------
  # * Unlock BGM
  #-----------------------------------------------------------------------------
  def unlock_se(title)
    unless @unlocked_se.include?(title)
      @unlocked_se << title
      @unlocked_se.sort!
    end
  end
  #-----------------------------------------------------------------------------
  # * Unlock BGM
  #-----------------------------------------------------------------------------
  def unlock_me(title)
    unless @unlocked_me.include?(title)
      @unlocked_me << title
      @unlocked_me.sort!
    end
  end
end

#===============================================================================
# ** Window_AudioList
#-------------------------------------------------------------------------------
#   This window lists all audio files in certain directories
#===============================================================================

class Window_AudioList < Window_Selectable
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize(type)
    super(0, 64, 640, 416)
    self.active = false
    self.visible = false
    self.index = 0
    @data = get_audiolist(type)
    @item_max = @data.size
    @item_max = 1 if @item_max.zero?
    self.contents = Bitmap.new(width - 32, row_max * 32)
    refresh_audio
  end
  #-----------------------------------------------------------------------------
  # * Audio
  #-----------------------------------------------------------------------------
  def audio
    return @data[self.index]
  end
  #-----------------------------------------------------------------------------
  # * Get Audio List
  #-----------------------------------------------------------------------------
  def get_audiolist(type)
    list = RTP.list("Audio/#{type}")
    unless JukeBox::All_Content_Unlocked
      for i in 0...list.size
        case type
        when 'BGM'
          unless $game_audiolog.bgm_unlocked?(list[i])
            list.delete(list[i])
          end
        when 'BGS'
          unless $game_audiolog.bgs_unlocked?(list[i])
            list.delete(list[i])
          end
        when 'SE'
          unless $game_audiolog.se_unlocked?(list[i])
            list.delete(list[i])
          end
        when 'ME'
          unless $game_audiolog.me_unlocked?(list[i])
            list.delete(list[i])
          end
        end
      end
    end
    return list
  end
  #-----------------------------------------------------------------------------
  # * Create AudioList
  #-----------------------------------------------------------------------------
  def refresh_audio
    for i in 0...@data.size
      unless @data[i].nil?
        @data[i].slice!('.mp3')
        @data[i].slice!('.mid')
        @data[i].slice!('.ogg')
        @data[i].slice!('.wma')
        @data[i].slice!('.wav')
        @data[i].slice!('.psf2')
        @data[i].slice!('.minipsf2')
        @data[i].slice!('.psf')
        @data[i].slice!('.minipsf')
        w = self.contents.text_size(@data[i]).width
        self.contents.draw_text(0, i * 32, w, 32, @data[i])
      end
    end
  end
end

#===============================================================================
# ** Scene_JukeBox
#-------------------------------------------------------------------------------
#   This scene handles the Audio Playing scene a/k/a 'Scene_JukeBox'
#===============================================================================

class Scene_JukeBox < SDK::Scene_Base
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_reader :volume, :pitch
  #-----------------------------------------------------------------------------
  # * Main Variable
  #-----------------------------------------------------------------------------
  def main_variable
    super
    @volume = 100
    @pitch  = 100
  end
  #-----------------------------------------------------------------------------
  # * Main Window
  #-----------------------------------------------------------------------------
  def main_window
    super
    main_window_command
    @window_bgm = Window_AudioList.new('BGM')
    @window_bgs = Window_AudioList.new('BGS')
    @window_se  = Window_AudioList.new('SE')
    @window_me  = Window_AudioList.new('ME')
  end
  #-----------------------------------------------------------------------------
  # * Main Window Command
  #-----------------------------------------------------------------------------
  def main_window_command
    commands = Array.new
    commands << SDK::Vocab::JukeBox::BGM if JukeBox::Play_BGM
    commands << SDK::Vocab::JukeBox::BGS if JukeBox::Play_BGS
    commands << SDK::Vocab::JukeBox::SE  if JukeBox::Play_SE
    commands << SDK::Vocab::JukeBox::ME  if JukeBox::Play_ME
    @window_command = Window_HorizCommand.new(640, commands)
    @window_command.active = true
  end
  #-----------------------------------------------------------------------------
  # * Update
  #-----------------------------------------------------------------------------
  def update
    super
    @window_bgm.visible = (@window_command.command == SDK::Vocab::JukeBox::BGM)
    @window_bgs.visible = (@window_command.command == SDK::Vocab::JukeBox::BGS)
    @window_se.visible  = (@window_command.command == SDK::Vocab::JukeBox::SE)
    @window_me.visible  = (@window_command.command == SDK::Vocab::JukeBox::ME)
    if @window_command.active
      update_command
      return
    elsif @window_bgm.active
      update_audio('BGM')
      return
    elsif @window_bgs.active
      update_audio('BGS')
      return
    elsif @window_se.active
      update_audio('SE')
      return
    elsif @window_me.active
      update_audio('ME')
      return
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Command
  #-----------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      update_command_cancel
      return
    elsif Input.trigger?(Input::C)
      update_command_decision
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Command : Cancel
  #-----------------------------------------------------------------------------
  def update_command_cancel
    $game_system.se_play($data_system.decision_se)
    $scene = @previous_scene.new
  end
  #-----------------------------------------------------------------------------
  # * Update Command : Decision
  #-----------------------------------------------------------------------------
  def update_command_decision
    $game_system.se_play($data_system.decision_se)
    case @window_command.command
    when SDK::Vocab::JukeBox::BGM then @window_bgm.active = true
    when SDK::Vocab::JukeBox::BGS then @window_bgs.active = true
    when SDK::Vocab::JukeBox::SE  then @window_se.active  = true
    when SDK::Vocab::JukeBox::ME  then @window_me.active  = true
    end
    @window_command.active = false
  end
  #-----------------------------------------------------------------------------
  # * Update Audio
  #-----------------------------------------------------------------------------
  def update_audio(type = 'BGM')
    if Input.trigger?(Input::B)
      update_audio_cancel(type)
      return
    elsif Input.trigger?(Input::C)
      update_audio_decision(type)
      return
    elsif Input.trigger?(Input::A)
      update_audio_stop(type)
      return
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Audio : Cancel
  #-----------------------------------------------------------------------------
  def update_audio_cancel(type)
    $game_system.se_play($data_system.cancel_se)
    case type
    when 'BGM' then @window_bgm.active, @window_bgm.index = false, 0
    when 'BGS' then @window_bgs.active, @window_bgs.index = false, 0
    when 'SE'  then @window_se.active,  @window_se.index  = false, 0
    when 'ME'  then @window_me.active,  @window_me.index  = false, 0
    end
    @window_command.active = true
  end
  #-----------------------------------------------------------------------------
  # * Update Audio : Decision
  #-----------------------------------------------------------------------------
  def update_audio_decision(type)
    case type
    when 'BGM' then Audio.bgm_play("Audio/BGM/#{@window_bgm.audio}")
    when 'BGS' then Audio.bgs_play("Audio/BGS/#{@window_bgs.audio}")
    when 'SE'  then Audio.bgs_play("Audio/SE/#{@window_bgs.audio}")
    when 'ME'  then Audio.bgs_play("Audio/ME/#{@window_bgs.audio}")
    end
  end
  #-----------------------------------------------------------------------------
  # * Update Audio : Stop
  #-----------------------------------------------------------------------------
  def update_audio_stop(type)
    case type
    when 'BGM' ; Audio.bgm_stop
    when 'BGS' ; Audio.bgs_stop
    when 'SE'  ; Audio.se_stop
    when 'ME'  ; Audio.me_stop
    end
  end
end

#===============================================================================
# ** Scene_Title
#-------------------------------------------------------------------------------
#   This class has been modified to create a new $game_audiolog global.
#===============================================================================

class Scene_Title < SDK::Scene_Base
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :battlelog_scnttl_commandnewgamedata,:commandnewgame_gamedata
  #-----------------------------------------------------------------------------
  # * Command New Game : Data
  #-----------------------------------------------------------------------------
  def commandnewgame_gamedata
    battlelog_scnttl_commandnewgamedata
    $game_audiolog = Game_AudioLog.new
  end
end

#===============================================================================
# ** Scene_Save
#-------------------------------------------------------------------------------
#   This class has been modified to save the $game_audiolog global
#===============================================================================

class Scene_Save < Scene_File
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :battlelog_scnsave_writedata, :write_save_data
  #-----------------------------------------------------------------------------
  # * Write Data
  #-----------------------------------------------------------------------------
  def write_save_data(file)
    battlelog_scnsave_writedata(file)
    Marshal.dump($game_audiolog, file)
  end
end

#===============================================================================
# ** Scene_Load
#-------------------------------------------------------------------------------
#   This class has been modified to load the $game_audiolog global
#===============================================================================

class Scene_Load < Scene_File
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :battlelog_scnload_readdata, :read_save_data
  #-----------------------------------------------------------------------------
  # * Write Data
  #-----------------------------------------------------------------------------
  def read_save_data(file)
    battlelog_scnload_readdata(file)
    $game_audiolog = Marshal.load(file)
  end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test - END
#-------------------------------------------------------------------------------
end

I wasn't too sure if your request has already been filled, but I made this a couple months ago, you give me a reason to work on it again in my spare time I'll add all the extra features. This script is very basic and works absolutely fine the way it is, but I want to implement alot of the same features you're talking about in your request so that motivates me to dust this script off.

I'll try and look for this topic again in a week and finish these other features for you.
 
GB, you are correct, Sir!

I suspect in the migration to the new phpBB server, the default post length chopped it off.
I'll ask Atoa if he can update it with the full script.

Be Well

Ok, Atoa was nice enough to repost the script.

It looks like you just use the command:

$scene = Scene_Sound_Test.new
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top