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.

Help me make this script work?

Here's the script I'm using. It should pull the songs directly from the Audio/BGM file and display them to choose from.

#==============================================================================
# â–  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?
 
bump

just to reiterate... is there a way, using this script or another script, to make it so that the script will make you go to the next song in the BGM file instead of just repeating the song you selected?
 

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