Here's the script I'm using. It should pull the songs directly from the Audio/BGM file and display them to choose from.
I have it just about the way I want it now, but is there a way to make it so that if you have Song 1, Song 2 and Song 3 in BGM folder and then you select Song 1, that when Song 1 ends it will go to Song 2, then to Song 3, and back to Song 1?
#==============================================================================
# â– Window_SoundTest
#------------------------------------------------------------------------------
# thanks to ccoa from rmxp.net for the help
# credits to squall@loeher.zzn.com
#==============================================================================
class Window_SoundTest < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize()
super(0, 0, 640, 480)
refresh
self.index = 0
self.active = true
end
#--------------------------------------------------------------------------
# â— sound
#--------------------------------------------------------------------------
def sound
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
files = Dir.new("Audio/BGM/").entries
files[0, 2] = nil
for i in 0...files.size
if files.include?(".psflib")
files = nil
break
end
end
files.compact!
@item_max = files.size
if @item_max == 0
@item_max = 1
end
self.contents = Bitmap.new(width - 32, row_max * 32)
@data = []
for i in 0...@item_max
unless files == nil
@data.push(files)
files.slice!(".mp3")
files.slice!(".mid")
files.slice!(".ogg")
files.slice!(".wma")
files.slice!(".wav")
files.slice!(".psf2")
files.slice!(".minipsf2")
files.slice!(".psf")
files.slice!(".minipsf")
self.contents.draw_text(0, i * 32, 640, 32, files)
end
end
end
end
#==============================================================================
# â– Scene_SoundTest
#==============================================================================
class Scene_SoundTest
#--------------------------------------------------------------------------
# â— main
#--------------------------------------------------------------------------
def main
@window = Window_SoundTest.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window.dispose
end
#--------------------------------------------------------------------------
# â— update
#--------------------------------------------------------------------------
def update
@window.update
if Input.trigger?(Input::C)
unless @window.sound == nil
Audio.bgm_play("Audio/BGM/" + @window.sound, 255, 100)
if Audio.methods.include?("psf_play")
Audio.psf_play("Audio/BGM/" + @window.sound, 255)
end
return
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
end
# â– Window_SoundTest
#------------------------------------------------------------------------------
# thanks to ccoa from rmxp.net for the help
# credits to squall@loeher.zzn.com
#==============================================================================
class Window_SoundTest < Window_Selectable
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize()
super(0, 0, 640, 480)
refresh
self.index = 0
self.active = true
end
#--------------------------------------------------------------------------
# â— sound
#--------------------------------------------------------------------------
def sound
return @data[self.index]
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
files = Dir.new("Audio/BGM/").entries
files[0, 2] = nil
for i in 0...files.size
if files.include?(".psflib")
files = nil
break
end
end
files.compact!
@item_max = files.size
if @item_max == 0
@item_max = 1
end
self.contents = Bitmap.new(width - 32, row_max * 32)
@data = []
for i in 0...@item_max
unless files == nil
@data.push(files)
files.slice!(".mp3")
files.slice!(".mid")
files.slice!(".ogg")
files.slice!(".wma")
files.slice!(".wav")
files.slice!(".psf2")
files.slice!(".minipsf2")
files.slice!(".psf")
files.slice!(".minipsf")
self.contents.draw_text(0, i * 32, 640, 32, files)
end
end
end
end
#==============================================================================
# â– Scene_SoundTest
#==============================================================================
class Scene_SoundTest
#--------------------------------------------------------------------------
# â— main
#--------------------------------------------------------------------------
def main
@window = Window_SoundTest.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@window.dispose
end
#--------------------------------------------------------------------------
# â— update
#--------------------------------------------------------------------------
def update
@window.update
if Input.trigger?(Input::C)
unless @window.sound == nil
Audio.bgm_play("Audio/BGM/" + @window.sound, 255, 100)
if Audio.methods.include?("psf_play")
Audio.psf_play("Audio/BGM/" + @window.sound, 255)
end
return
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
end
I have it just about the way I want it now, but is there a way to make it so that if you have Song 1, Song 2 and Song 3 in BGM folder and then you select Song 1, that when Song 1 ends it will go to Song 2, then to Song 3, and back to Song 1?