Tsunokiette
Member
I have to laugh at the topic name.
I haven't done any scripting for a while now. It has nothing to do with school, I just haven't felt like it and have gotten rusty. Who knows what the future will hold.
Anyways, on to the script. A long while ago (about a month or two after I stopped scripting) I was inspired to do this. It's a simple bit of script, and may not even be needed, but I wanted to let people know I was still alive :nya:
Script -
This is the flesh of a Radio/Jukebox.
All you need to do is script the bone.
Erm, let me speak English here.
All you need to do is script a scene that will utilize this in the game, allowing the player to choose songs to play as the bgm.
NOTE: This will only work for songs that have been imported!!!!
INSTRUCTIONS: The only ones that should use this should be those with the understanding of how it works. Making the music list shouldn't be too hard. $jukebox.list anyone?
To play a song, you would do $jukebox.play("EXACT SONG NAME MINUS EXTENSION IN QUOTES").
Oh yeah, you'll also need to initialize $jukebox as an instance of the Jukebox class.
i.e. :
If you use this credit is due to Zeriab and myself. Original script by me, and Zeriab pointed out an error I myself would never have noticed. XD
I haven't done any scripting for a while now. It has nothing to do with school, I just haven't felt like it and have gotten rusty. Who knows what the future will hold.
Anyways, on to the script. A long while ago (about a month or two after I stopped scripting) I was inspired to do this. It's a simple bit of script, and may not even be needed, but I wanted to let people know I was still alive :nya:
Script -
Code:
class Jukebox
attr_reader :list
def initialize
@songs = Dir.entries("Audio/BGM/")
temp = @songs.clone
@list = []
for i in 0..(temp.size)
next if temp[i] == "." or temp[i] == ".." or temp[i] == nil
@list.push(temp[i])
end
for i in 0..(@list.size)
@list[i].gsub!(/\.[^\.]*\Z/) {|s| "" }
end
end
def find(song)
@list.each.do(|i| return i.index if i == song)
end
def play(song)
index = find(song)
Audio.bgm_play(@songs[index + 2], 100, 100)
end
def stop
Audio.bgm_stop
end
end
This is the flesh of a Radio/Jukebox.
All you need to do is script the bone.
Erm, let me speak English here.
All you need to do is script a scene that will utilize this in the game, allowing the player to choose songs to play as the bgm.
NOTE: This will only work for songs that have been imported!!!!
INSTRUCTIONS: The only ones that should use this should be those with the understanding of how it works. Making the music list shouldn't be too hard. $jukebox.list anyone?
To play a song, you would do $jukebox.play("EXACT SONG NAME MINUS EXTENSION IN QUOTES").
Oh yeah, you'll also need to initialize $jukebox as an instance of the Jukebox class.
i.e. :
Code:
$jukebox = Jukebox.new
If you use this credit is due to Zeriab and myself. Original script by me, and Zeriab pointed out an error I myself would never have noticed. XD