Sound Test ScriptVersion 1.4
by badnomis (me)
Release Date: 19/03/2009
Exclusive Script at RPG RPG RevolutionIntroductionIt's my first script and I hope that you will like. If you have comments or suggestions, let me know.
FeaturesVersion 1.4- The Sound List Data Base make automatically
- Fix the saves bug
Version 1.2- You can display all sounds (Without having to hear sounds)
Version 1.1- The possibility to know if the actors has all sounds (with a conditions)
Screenshots
Script VXCODE
#==============================================================================
# [VX] < Sound Test > by badnomis
#------------------------------------------------------------------------------
# ◦ by badnomis [badnomis@hotmail.com]
# ◦ Released on: 19/03/2009 (D-M-Y)
# ◦ Version: 1.4
#---------------------------------------------------------------------------
#+++ [FEATURES] ++++
# - Reintegrates bgm and bgs memorize function from RPGXP (not used for the vehicles)
# + Audio.bgm_memorize (for memorize BGM)
# + Audio.bgs_memorize (for memorize BGS)
# + Audio.bgm_and_bgs_memorize (for memorize BGM and BGS)
# + Audio.play_music_memorize (for play memorize music)
# - Automatically adds the music in the database as soon as the music is played
# - Compatible with a different size screen
# - The possibility to know if the actors has all sounds (with a conditions)
# - You can display all sounds (Without having to hear sounds)
# - Automatically puts the music in the database (No Sound List Data Base in Script)
#------------------------------------------------------------------------------
#### Instruction ####
# Go to line 115 and change the path of your rgss directory!
# For call Sound Test script, write in event, Event Commands, third page,
# Script... (in Advanced) :
# $scene = Scene_SoundTest.new
# You can display all sounds, you need write this
# $scene = Scene_SoundTest.new(true)
#
# For put a condition for know if you have all sounds or not, #have_all_sounds?
# 1. Go on event
# 2. Put a condition branch where you want it
# 3. In condion, go to page 4 and check script box
# 4. Write in box :
# have_all_sounds?
# 5. The first branch => if you have all sounds
# The second branch => if you not have all sounds
#
# -The buttons in Sound Test-
# + Space © : To choose music
# + Shift (A) : To stop music
# + ESC : To quit Sound Test
#------------------------------------------------------------------------------
#==============================================================================<
# If you want the music of the RGSS, write true. If not, write false
#==============================================================================
module SOUNDTESTOPT
RGSS_MUSIC = true
end
#==============================================================================
# ** Audio
#------------------------------------------------------------------------------
# This module add audio functions and modifies existing functions.
#------------------------------------------------------------------------------
# (-) = Modified Function
# (+) = New Function
#==============================================================================
module Audio
#--------------------------------------------------------------------------
# * Memorize BGM (+)
#--------------------------------------------------------------------------
def self.bgm_memorize
@memorized_bgm = @playing_bgm
end
#--------------------------------------------------------------------------
# * Memorize BGS (+)
#--------------------------------------------------------------------------
def self.bgs_memorize
@memorized_bgs = @playing_bgs
end
#--------------------------------------------------------------------------
# * Memorize BGM and BGS (+)
#--------------------------------------------------------------------------
def self.bgm_and_bgs_memorize
self.bgm_memorize
self.bgs_memorize
end
#--------------------------------------------------------------------------
# * Play Memorize BGM (+)
#--------------------------------------------------------------------------
def self.play_music_memorize
Audio.bgm_play(@memorized_bgm.name, @memorized_bgm.volume,
@memorized_bgm.pitch) if @memorized_bgm != nil
Audio.bgs_play(@memorized_bgs.name, @memorized_bgs.volume,
@memorized_bgs.pitch) if @memorized_bgs != nil
end
#--------------------------------------------------------------------------
# * Return Playing BGM (+)
#--------------------------------------------------------------------------
def self.playing_bgm
return @playing_bgm
end
#--------------------------------------------------------------------------
# * Erase the extansion Audio Files (+)
#--------------------------------------------------------------------------
def self.erase_extansion_file(sound)
string = sound.gsub(/\.mp3/) {""} if sound.include?(".mp3")
string = sound.gsub(/\.wav/) {""} if sound.include?(".wav")
string = sound.gsub(/\.mid/) {""} if sound.include?(".mid")
string = sound.gsub(/\.ogg/) {""} if sound.include?(".ogg")
return string
end
#--------------------------------------------------------------------------
# * Explore Folder (+) By Krosk
#--------------------------------------------------------------------------
def self.explore(folder = "Audio/BGM/")
if not(FileTest.exist?(folder))
return ["Nil"]
end
rgssfolder = ENV['ProgramFiles'] + '\Common Files\Enterbrain\RGSS2\RPGVX\Audio\BGM\\'
command = []
dir = []
if FileTest.exist?(rgssfolder) and SOUNDTESTOPT::RGSS_MUSIC
d = Dir.open(rgssfolder)
d = d.sort - [".", ".."]
d.each {|file|
command.push(file)
dir.push(false)}
end
d = Dir.open(folder)
d = d.sort - [".", ".."]
d.each {|file|
command.push(file)
dir.push(false)}
temp = []
for i in 0..command.length-1
if dir[i]
command[i] += "/"
temp.push(command[i])
end
end
dir.delete(true)
for element in temp
command.delete(element)
end
temp.reverse!
for element in temp
dir.unshift(true)
command.unshift(element)
end
return [command, dir]
end
#--------------------------------------------------------------------------
# * Play Memorize BGM (-)
#--------------------------------------------------------------------------
# Module to class
class << self
# Fix a Stack Level too deep problems
if @Audio.nil?
# Renames bgm and bgs functions
alias bgm_play_alias bgm_play
alias bgm_stop_alias bgm_stop
alias bgm_fade_alias bgm_fade
alias bgs_play_alias bgs_play
alias bgs_stop_alias bgs_stop
alias bgs_fade_alias bgs_fade
@Audio = true
end
#-----------BGM-----------
# Defines a new bgm_play
def Audio.bgm_play(*arg)
# Run the basic method
bgm_play_alias(*arg)
@playing_bgm = RPG::AudioFile.new(*arg)
if not $scene.is_a?(Scene_SoundTest)
name = @playing_bgm.name.gsub(/Audio\/BGM\//) {""}
$game_party.played_bgm = {} if $game_party.played_bgm == nil
$game_party.played_bgm[name] = true
end
end
# Defines a new bgm_stop
def Audio.bgm_stop
# Run the basic method
bgm_stop_alias
@playing_bgm = nil
end
# Defines a new bgm_fade
def Audio.bgm_fade(arg)
# Run the basic method
bgm_fade_alias(arg)
@playing_bgm = nil
end
#-----------BGS-----------
def Audio.bgs_play(*arg)
# Run the basic method
bgs_play_alias(*arg)
@playing_bgs = RPG::AudioFile.new(*arg)
end
# Defines a new bgm_stop
def Audio.bgs_stop
# Run the basic method
bgs_stop_alias
@playing_bgs = nil
end
# Defines a new bgm_fade
def Audio.bgs_fade(arg)
# Run the basic method
bgs_fade_alias(arg)
@playing_bgs = nil
end
end
end
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
attr_accessor :played_bgm
alias initialize_game_party_alias initialize
def initialize
initialize_game_party_alias
@played_bgm = {}
end
end
#==============================================================================
# ** Game_Interpreter
#==============================================================================
class Game_Interpreter
def have_all_sounds?
list = Audio.explore
@data = list[0]
@item_max = @data.size
pc_complete = 0
$game_party.played_bgm = {} if $game_party.played_bgm == nil
for i in 0...@item_max
sound = @data[i]
stext = Audio.erase_extansion_file(sound)
pc_complete += 1 if $game_party.played_bgm[stext]
end
return true if pc_complete == @item_max
return false if pc_complete != @item_max
return
end
end
#==============================================================================
# ** Window_SoundTest
#------------------------------------------------------------------------------
# This window displays a list of sounds
#==============================================================================
class Window_SoundTest < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height, allsongs)
super(x, y, width, height)
@column_max = 1
@width = width
@allsongs = allsongs
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# * Get Sound
#--------------------------------------------------------------------------
def sound
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Get %
#--------------------------------------------------------------------------
def pcomplete(condition = false)
pc_complete = 0
$game_party.played_bgm = {} if $game_party.played_bgm == nil
for i in 0...@item_max
sound = @data[i]
stext = Audio.erase_extansion_file(sound)
pc_complete += 1 if $game_party.played_bgm[stext]
end
text = pc_complete * 100 / @item_max if @item_max != 0
text = "Complete: " + text.to_s + "%"
return text if condition == false
return true if pc_complete == @item_max and condition == true
return false if pc_complete != @item_max and condition == true
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
list = Audio.explore
@data = list[0]
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Sound
# index : sound number
#--------------------------------------------------------------------------
def draw_item(index)
sound = @data[index]
rect = item_rect(index)
text = Audio.erase_extansion_file(sound)
$game_party.played_bgm = {} if $game_party.played_bgm == nil
if $game_party.played_bgm[text] or @allsongs
self.contents.font.color = normal_color
self.contents.draw_text(rect, text, 1)
else
self.contents.font.color = text_color(7)
self.contents.draw_text(rect, "? ? ? ? ? ? ? ?", 1)
end
end
end
#==============================================================================
# ** Scene_SoundTest
#------------------------------------------------------------------------------
# SoundTest Scene
#==============================================================================
class Scene_SoundTest < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(allsongs = false)
@allsongs = allsongs
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
Audio.bgm_and_bgs_memorize
Audio.bgm_stop
Audio.bgs_stop
create_menu_background
@help_window = Window_Base.new(Graphics.width/2, 0, Graphics.width/2, 24+32)
@help_window.contents = Bitmap.new(Graphics.width/2-32, 24)
set_text(@help_window, "- None -", 1)
@complete_window = Window_Base.new(Graphics.width/2,
Graphics.height - (24+32), Graphics.width/2, 24+32)
@complete_window.contents = Bitmap.new(Graphics.width/2-32, 24)
@complete_window.visible = false if @allsongs
@pi = 3.14159265
@cd = Sprite.new
@cd.bitmap = Cache.picture("CD")
@cd.ox = @cd.bitmap.width/2
@cd.oy = @cd.bitmap.height/2
@cd.zoom_x = 0
@cd.y = Graphics.height/2 - @cd.bitmap.height/2 + 120
@zoom_cd = 0
@turn_cd = 0
@cd_play = false
@sound_window = Window_SoundTest.new(0, 0, Graphics.width/2, Graphics.height, @allsongs)
set_text(@complete_window, @sound_window.pcomplete, 1)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@complete_window.dispose
@cd.dispose
@sound_window.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Set_text
#--------------------------------------------------------------------------
def set_text(window, text, align = 0)
window.contents.clear
window.contents.draw_text(0,0, window.width - 32, 24, text, align)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@complete_window.update
@cd.update
@zoom_cd += 1
if @cd_play == true
@turn_cd += 14
@cd.zoom_x = 1
@cd.angle = @turn_cd
else
@cd.angle = 0
@turn_cd = 0
@cd.zoom_x = (1 * Math.sin(@zoom_cd/120.0*@pi)).abs
@cd.x = (Graphics.width/1.33) - @cd.bitmap.width/2 * (Math.sin(@zoom_cd/@cd.bitmap.width/2*@pi).abs)
end
@sound_window.update
# If input B
if Input.trigger?(Input::B)
Sound.play_cancel
Audio.bgm_stop
Audio.play_music_memorize
return_scene
end
# If input A
if Input.trigger?(Input::A)
# Play SE (Decision)
Sound.play_decision
# Stop BGM
Audio.bgm_stop
@cd_play = false
set_text(@help_window, "- None -", 1)
end
# If input C
if Input.trigger?(Input::C)
sound = @sound_window.sound
# If not playing
stext = Audio.erase_extansion_file(sound)
if !$game_party.played_bgm[stext] and @allsongs == false
# SE play (Buzzer)
Sound.play_buzzer
return
end
Graphics.update
# Play SE (Decision)
Sound.play_decision
# Play BGM
Audio.bgm_play("Audio/BGM/" + sound, 100, 100)
@cd_play = true
text = sprintf("%02d", @sound_window.index + 1) + ":" + stext
set_text(@help_window, text, 1)
return
end
end
end
Script XPCODE
#==============================================================================
# [XP] < Sound Test > by badnomis
#------------------------------------------------------------------------------
# ◦ by badnomis [badnomis@hotmail.com]
# ◦ Released on: 17/02/2009 (D-M-Y)
# ◦ Version: 1.4
#---------------------------------------------------------------------------
#+++ [FEATURES] ++++
# - Automatically adds the music in the database as soon as the music is played
# - The possibility to know if the actors has all sounds (with a conditions)
# - You can display all sounds (Without having to hear sounds)
# - Automatically puts the music in the database (No Sound List Data Base in Script)
#------------------------------------------------------------------------------
#### Instruction ####
# For call Sound Test script, write in event, Event Commands, third page,
# Script... (in Advanced) :
# $scene = Scene_SoundTest.new
# You can display all sounds, you need write this
# $scene = Scene_SoundTest.new(true)
#
# For put a condition for know if you have all sounds or not, #have_all_sounds?
# 1. Go on event
# 2. Put a condition branch where you want it
# 3. In condion, go to page 4 and check script box
# 4. Write in box :
# have_all_sounds?
# 5. The first branch => if you have all sounds
# The second branch => if you not have all sounds
#
# -The buttons in Sound Test-
# + Space © : To choose music
# + Shift (A) : To stop music
# + ESC : To quit Sound Test
#------------------------------------------------------------------------------
#==============================================================================<
# If you want the music of the RGSS, write true. If not, write false
#==============================================================================
module SOUNDTESTOPT
RGSS_MUSIC = true
end
#==============================================================================
# ** Audio
#------------------------------------------------------------------------------
# This module add audio functions and modifies existing functions.
#------------------------------------------------------------------------------
# (-) = Modified Function
# (+) = New Function
#==============================================================================
module Audio
#--------------------------------------------------------------------------
# * Memorize BGM (+)
#--------------------------------------------------------------------------
def self.bgm_memorize
@memorized_bgm = @playing_bgm
end
#--------------------------------------------------------------------------
# * Memorize BGS (+)
#--------------------------------------------------------------------------
def self.bgs_memorize
@memorized_bgs = @playing_bgs
end
#--------------------------------------------------------------------------
# * Memorize BGM and BGS (+)
#--------------------------------------------------------------------------
def self.bgm_and_bgs_memorize
self.bgm_memorize
self.bgs_memorize
end
#--------------------------------------------------------------------------
# * Play Memorize BGM (+)
#--------------------------------------------------------------------------
def self.play_music_memorize
Audio.bgm_play(@memorized_bgm.name, @memorized_bgm.volume,
@memorized_bgm.pitch) if @memorized_bgm != nil
Audio.bgs_play(@memorized_bgs.name, @memorized_bgs.volume,
@memorized_bgs.pitch) if @memorized_bgs != nil
end
#--------------------------------------------------------------------------
# * Return Playing BGM (+)
#--------------------------------------------------------------------------
def self.playing_bgm
return @playing_bgm
end
#--------------------------------------------------------------------------
# * Erase the extansion Audio Files (+)
#--------------------------------------------------------------------------
def self.erase_extansion_file(sound)
string = sound.gsub(/\.mp3/) {""} if sound.include?(".mp3")
string = sound.gsub(/\.wav/) {""} if sound.include?(".wav")
string = sound.gsub(/\.mid/) {""} if sound.include?(".mid")
string = sound.gsub(/\.ogg/) {""} if sound.include?(".ogg")
return string
end
#--------------------------------------------------------------------------
# * Explore Folder (+) By Krosk
#--------------------------------------------------------------------------
def self.explore(folder = "Audio/BGM/")
if not(FileTest.exist?(folder))
return ["Nil"]
end
rgssfolder = ENV['ProgramFiles'] + '\Common Files\Enterbrain\RGSS\Standard\Audio\BGM\\'
command = []
dir = []
if FileTest.exist?(rgssfolder) and SOUNDTESTOPT::RGSS_MUSIC
d = Dir.open(rgssfolder)
d = d.sort - [".", ".."]
d.each {|file|
command.push(file)
dir.push(false)}
end
d = Dir.open(folder)
d = d.sort - [".", ".."]
d.each {|file|
command.push(file)
dir.push(false)}
temp = []
for i in 0..command.length-1
if dir[i]
command[i] += "/"
temp.push(command[i])
end
end
dir.delete(true)
for element in temp
command.delete(element)
end
temp.reverse!
for element in temp
dir.unshift(true)
command.unshift(element)
end
return [command, dir]
end
#--------------------------------------------------------------------------
# * Play Memorize BGM (-)
#--------------------------------------------------------------------------
# Module to class
class << self
# Fix a Stack Level too deep problems
if @Audio.nil?
# Renames bgm and bgs functions
alias bgm_play_alias bgm_play
alias bgm_stop_alias bgm_stop
alias bgm_fade_alias bgm_fade
alias bgs_play_alias bgs_play
alias bgs_stop_alias bgs_stop
alias bgs_fade_alias bgs_fade
@Audio = true
end
#-----------BGM-----------
# Defines a new bgm_play
def Audio.bgm_play(*arg)
# Run the basic method
bgm_play_alias(*arg)
@playing_bgm = RPG::AudioFile.new(*arg)
if not $scene.is_a?(Scene_SoundTest)
name = @playing_bgm.name.gsub(/Audio\/BGM\//) {""}
if $game_party != nil
$game_party.played_bgm = {} if $game_party.played_bgm == nil
$game_party.played_bgm[name] = true
end
end
end
# Defines a new bgm_stop
def Audio.bgm_stop
# Run the basic method
bgm_stop_alias
@playing_bgm = nil
end
# Defines a new bgm_fade
def Audio.bgm_fade(arg)
# Run the basic method
bgm_fade_alias(arg)
@playing_bgm = nil
end
#-----------BGS-----------
def Audio.bgs_play(*arg)
# Run the basic method
bgs_play_alias(*arg)
@playing_bgs = RPG::AudioFile.new(*arg)
end
# Defines a new bgm_stop
def Audio.bgs_stop
# Run the basic method
bgs_stop_alias
@playing_bgs = nil
end
# Defines a new bgm_fade
def Audio.bgs_fade(arg)
# Run the basic method
bgs_fade_alias(arg)
@playing_bgs = nil
end
end
end
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title
alias command_new_game_alias command_new_game
def command_new_game
command_new_game_alias
$game_party.played_bgm = {} if $game_party.played_bgm == nil
$game_party.played_bgm[$data_system.title_bgm.name] = true
end
end
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
attr_accessor :played_bgm
alias initialize_game_party_alias initialize
def initialize
initialize_game_party_alias
@played_bgm = {}
end
end
#==============================================================================
# ** Interpreter
#==============================================================================
class Interpreter
def have_all_sounds?
list = Audio.explore
@data = list[0]
@item_max = @data.size
pc_complete = 0
$game_party.played_bgm = {} if $game_party.played_bgm == nil
for i in 0...@item_max
sound = @data[i]
stext = Audio.erase_extansion_file(sound)
pc_complete += 1 if $game_party.played_bgm[stext]
end
return true if pc_complete == @item_max
return false if pc_complete != @item_max
return
end
end
#==============================================================================
# ** Window_SoundTest
#------------------------------------------------------------------------------
# This window displays a list of sounds
#==============================================================================
class Window_SoundTest < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height, allsongs)
super(x, y, width, height)
@column_max = 1
@width = width
@allsongs = allsongs
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# * Get Sound
#--------------------------------------------------------------------------
def sound
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Get %
#--------------------------------------------------------------------------
def pcomplete(condition = false)
pc_complete = 0
$game_party.played_bgm = {} if $game_party.played_bgm == nil
for i in 0...@item_max
sound = @data[i]
stext = Audio.erase_extansion_file(sound)
pc_complete += 1 if $game_party.played_bgm[stext]
end
text = pc_complete * 100 / @item_max
text = "Complete: " + text.to_s + "%"
return text if condition == false
return true if pc_complete == @item_max and condition == true
return false if pc_complete != @item_max and condition == true
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
list = Audio.explore
@data = list[0]
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Sound
# index : sound number
#--------------------------------------------------------------------------
def draw_item(index)
sound = @data[index]
x = index % @column_max * (288 + 32)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
text = Audio.erase_extansion_file(sound)
$game_party.played_bgm = {} if $game_party.played_bgm == nil
if $game_party.played_bgm[text] or @allsongs
self.contents.font.color = normal_color
self.contents.draw_text(rect, text, 1)
else
self.contents.font.color = text_color(7)
self.contents.draw_text(rect, "? ? ? ? ? ? ? ?", 1)
end
end
end
#==============================================================================
# ** Scene_SoundTest
#------------------------------------------------------------------------------
# SoundTest Scene
#==============================================================================
class Scene_SoundTest
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(allsongs = false)
@allsongs = allsongs
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def main
#super
Audio.bgm_and_bgs_memorize
Audio.bgm_stop
Audio.bgs_stop
@help_window = Window_Base.new(640/2, 0, 640/2, 24+32)
@help_window.contents = Bitmap.new(640/2-32, 24)
set_text(@help_window, "- None -", 1, true)
@complete_window = Window_Base.new(640/2,
480 - (24+32), 640/2, 24+32)
@complete_window.contents = Bitmap.new(640/2-32, 24)
@complete_window.visible = false if @allsongs
@pi = 3.14159265
@cd = Sprite.new
@cd.bitmap = RPG::Cache.picture("CD")
@cd.ox = @cd.bitmap.width/2
@cd.oy = @cd.bitmap.height/2
@cd.zoom_x = 0
@cd.y = 480/2 - @cd.bitmap.height/2 + 120
@zoom_cd = 0
@turn_cd = 0
@cd_play = false
@sound_window = Window_SoundTest.new(0, 0, 640/2, 480, @allsongs)
set_text(@complete_window, @sound_window.pcomplete, 1, true)
# Run transition
Graphics.transition
# Main loop
loop do
# Update the game screen
Graphics.update
# Update input information
Input.update
# Update frame
update
# When screen is switched, interrupt loop
if $scene != self
break
end
end
# Prepare Transition
Graphics.freeze
# Free the window
@help_window.dispose
@complete_window.dispose
@cd.dispose
@sound_window.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Set_text
#--------------------------------------------------------------------------
def set_text(window, text, align = 0, make = false)
if make
window.contents.font.name = $fontface
window.contents.font.size = $fontsize
window.contents.font.color = window.normal_color
end
window.contents.clear
window.contents.draw_text(0,0, window.width - 32, 24, text, align)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@help_window.update
@complete_window.update
@cd.update
@zoom_cd += 1
if @cd_play == true
@turn_cd += 16
@cd.zoom_x = 1
@cd.angle = @turn_cd
else
@cd.angle = 0
@turn_cd = 0
@cd.zoom_x = (1 * Math.sin(@zoom_cd/90.0*@pi)).abs
@cd.x = (640/1.33) - @cd.bitmap.width/2 * (Math.sin(@zoom_cd/@cd.bitmap.width/2*@pi).abs)
end
@sound_window.update
# If input B
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
Audio.bgm_stop
Audio.play_music_memorize
return_scene
end
# If input A
if Input.trigger?(Input::A)
# Play SE (Decision)
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
@cd_play = false
set_text(@help_window, "- None -", 1)
end
# If input C
if Input.trigger?(Input::C)
sound = @sound_window.sound
# If not playing
stext = Audio.erase_extansion_file(sound)
if !$game_party.played_bgm[stext] and @allsongs == false
# SE play (Buzzer)
$game_system.se_play($data_system.buzzer_se)
return
end
Graphics.update
# Play SE (Decision)
$game_system.se_play($data_system.decision_se)
# Play BGM
Audio.bgm_play("Audio/BGM/" + sound, 100, 100)
@cd_play = true
text = sprintf("%02d", @sound_window.index + 1) + ":" + stext
set_text(@help_window, text, 1)
return
end
end
end
Demo VXHere (1.1)InstructionPut the script in materials and rename it SoundTest.
The other instruction to setup script is included in the script.
Image need
Rename the picture :
CD.png
And put it in the pictures folder.
Terms and Conditions-Please, credit me.
This post has been edited by badnomis: Jun 1 2010, 07:43 PM