############################# ########## # # # # #######
# Juke Box Script # # # # # # #
# created by: Polraudio # # # # ## #####
# created on: June 16, 2006 # # # # # # # #
# version: 2.0 # ###### ####### # # #######
# credits: Polraudio #
# modern algebra #
################################################################################
# If you want to add your own Music just look through the script for comments #
# I have instrusctions there #
# Any questions, comments or bugs E-mail me at polraudio@Gmail.com #
################################################################################
# THE SANTAX FOR NON SCRIPTERS #
# $scene=Scene_Juke.new
################################################################################
# ITEM SANTAX #
# $game_party.item_number(@item.id) == 1 #
# 1^ 2^ 3^ #
# 1: replace "@item.id" with the item number #
# 2: replace 1st "=" with ">" or "<" or leave it "==" to make it have to equal #
# >: if higher or equal to that item #
# <: if lower or equal to #
# 3: how many of that item #
################################################################################
# PRINT SYNTAX #
# print("text") #
# 1^ #
# 1: replace "text" with what ever text you want #
################################################################################
# MUSIC SYNTAX #
# Audio.bgm_play("Audio/BGM/" + "name", bgm.volume, bgm.pitch) #
# 1^ 2^ 3^ 4^ 5^ #
# 1: replace with "se", "me", "bgs", "bgm" what ever one you want to play #
# 2: what ever you put for "1^" put the same here but make it all CAPS #
# 3: replace "name" with what ever your song name is(NOTE:Not case sensitive) #
# 4: replace "bgm.volume" with a value from 0-100 #
# 5: replace "bgm.pitch" with a value from 0-100 #
################################################################################
# DRAW_TEXT SYNTAX #
# self.contents.draw_text(4, 0, 128, 30, "Exit Juke Box") #
# 1^ 2^ 3^ 4^ 5^ #
# 1: how far to the right the text is #
# 2: how far down the text is #
# 3: how much the text is streched to the right #
# 4: how much the text is streched down #
# 5: replace "Exit Juke Box" with what ever text you want #
################################################################################
class Window_Juke < Window_Selectable
def initialize
super(0, 64, 640, 414) # super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 36
@column_max = 3
@row_max = 33
@commands = ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",]
refresh
self.index = 0
end
def refresh
self.contents.clear
@music = ["EXIT", "013-Theme02", "008-Boss04", "029-Town07"]
@item_max = @music.size
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
self.contents.draw_text(4 + 216*(index%3), 32*(index/3), 128, 30, @music[index])
end
end
class Scene_Juke
def main
#You can change the name of the songs here
$command_window = Window_Juke.new
$help_window = Window_Help.new
$help_window.set_text("Play Music")
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
$help_window.dispose
$command_window.dispose
if $scene.is_a?(Scene_Juke)
Graphics.transition
Graphics.freeze
end
end
def update
$help_window.update
$command_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
case $command_window.index
when 0
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
when 1...3
Audio.bgm_play("Audio/BGM/" + @music[$command_window.index], 100, 50)
end
return
end
end
end
...when you select a song to play from the Jukebox menu. So therefore the line "Audio.bgm_play("Audio/BGM/" + @music[$command_window.index], 100, 100)" has a problem. I've pinpointed the problem to be with "@music[$command_window.index]". This makes absolutely no sense whatsoever as @music is clearly defined as an array up above, and the reference $command_window.index is clearly a readable variable as evidenced by the functioning lines about the whencase statements.
The problem was that @music should have been changed to $music in every case, but the original authors overlooked this problem. Therefore, the script couldn't work.
Now the only question is how to let RGSS determine the filetype of an audio file as to whether it's an mp3 or a midi, and how to append to arrays.