Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Crazyninjaguy

JukeBox

Recommended Posts

Battle/Map BGM Selector

v1.0

By Crazyninjaguy

 

Intro:

 

Some of you may remember my old music selector waaay back when i first got into scripting. Well this is a complete redo of it.

If you get the script from the post, please download the image attached below and put it in your Graphics/Pictures folder.

 

Features:

 

  • Play the music before you change anything
  • Finds all music in the Audio/BGM/ folder automatically
  • Plug'n'play (Except for the image)
  • Set the map BGM
  • Set the battle music

 

Screenshots:

 

Not really needed, just download the demo.

 

Demo:

 

http://www.mediafire.com/?wmmyqnmmyz4

 

Script:

 

 

#===============================================================================
#						 * Battle/Map BGM Selector *
#	 By Crazyninjaguy with quite a bit of easy help from Piejamas :P
#						  http://www.planetdev.net
#===============================================================================

module Cng_Music_Setup

 #=====================================================
 # Jukebox image
 #=====================================================
 JUKEBOX = "jukebox"

end

class Scene_Musicbox < Scene_Base
 def initialize(menu_index = 0)
@menu_index = menu_index
 end
 def start
super
create_command_window
create_menu_background
@jukebox = Sprite.new
@jukebox.bitmap = Cache.picture(Cng_Music_Setup::JUKEBOX)
@options = Window_Music_Options.new
hide_options_window
 end
 def terminate
super
@command_window.dispose
@jukebox.dispose
@options.dispose
 end
 def create_command_window
bgms = []
  Dir.chdir("Audio/BGM/"){
	Dir.glob("*.mp3"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.MP3"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.mid"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.MID"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.ogg"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.OGG"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.wav"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.WAV"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.midi"){|f| bgms.push(f.chop.chop.chop.chop.chop) }
	Dir.glob("*.MIDI"){|f| bgms.push(f.chop.chop.chop.chop.chop) }
	}
@command_window = Window_Command.new(230, bgms)
@command_window.height = 60
@command_window.y = 262
@command_window.x = 163
@command_window.index = @menu_index
@command_window.opacity = 0
@command_window.back_opacity = 0
 end
 def hide_options_window
@options.visible = false
@options.active = false
@command_window.active = true
 end
 def show_options_window
@options.visible = true
@options.active = true
@command_window.active = false
 end
 def update
@command_window.update
@options.update
if @command_window.active
  update_command
  return
end
if @options.active
  update_options
  return
end
 end  
 def update_command
bgms = []
  Dir.chdir("Audio/BGM/"){
	Dir.glob("*.mp3"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.MP3"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.mid"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.MID"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.ogg"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.OGG"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.wav"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.WAV"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.midi"){|f| bgms.push(f.chop.chop.chop.chop.chop) }
	Dir.glob("*.MIDI"){|f| bgms.push(f.chop.chop.chop.chop.chop) }
	}
if Input.trigger?(Input::C)
  case @command_window.index
  when 0...99999
	Audio.bgm_play("Audio/BGM/" + bgms[@command_window.index], 100, 100)
	show_options_window
  end
end
if Input.trigger?(Input::B)
  $scene = Scene_Map.new
end
 end
 def update_options
if Input.trigger?(Input::B)
  hide_options_window
end
if Input.trigger?(Input::C)
  case @options.index
  when 0
	Audio.bgm_stop
  when 1
	bgms = []
  Dir.chdir("Audio/BGM/"){
	Dir.glob("*.mp3"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.MP3"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.mid"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.MID"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.ogg"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.OGG"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.wav"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.WAV"){|f| bgms.push(f.chop.chop.chop.chop) }
	Dir.glob("*.midi"){|f| bgms.push(f.chop.chop.chop.chop.chop) }
	Dir.glob("*.MIDI"){|f| bgms.push(f.chop.chop.chop.chop.chop) }
	}
	$game_system.battle_bgm = RPG::BGM.new(bgms[@command_window.index])
	$scene = Scene_Map.new
	Audio.bgm_stop
  when 2
	$scene = Scene_Map.new
  end
end
 end
end

class Window_Music_Options < Window_Selectable
 def initialize
super(170, 180, 230, 110)
@options = ["Stop", "Set as battle BGM", "Play on map"]
@item_max = 3
self.index = 0
self.active = false
refresh
 end
 def refresh
self.contents.clear
for i in 0...@options.size
  x = 4
  y = i * 24
  self.contents.draw_text(x, y, 198, 27, @options[i])
end
 end
end

 

 

Credits:

 

PLEASE GIVE CREDIT :)

As scripts take a while to write.

 

Piejamas - Helping with various things

post-5485-126356493661_thumb.png

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...