Hello there ladies and gentlemen,
since I'm going to use alot of music in my game that actually can be called music, I'd like to let the player know what track he is listening to. This would be a little popup window with variable transparency in the lower right corner of the screen which pops up evertime the music changes and by script call and would display either the tags of the mp3 files (if possible) or the file name, parted in to three parts, so when the file would be named "TheUprising-fallen into ruin-Endzeit Soundtrack.mp3" it would show it like this:
fallen into ruin
TheUprising
Endzeit Soundtrack
Optional would be a picture for each song or album, which would be located in the pictures folder and look like an album cover. I'll make a mockup if needed.^^
It should be compatible with the following scripts:
Sprite_Shadow
Sprite_Sun
Light Effects
Sprite_Mirror
Particle System
Ccoa Weather Script
Slanted Bars
text shadow
Autoswitch
Credits
Ccoa Tileset Swap
Light Cones
F12 Pause
Quicksave
theory's advanced map layers
Chaos Project Debug System
MOG Interface Scripts
BlizzABS + custom mods
Mouse Imput
Pathfinding
Autotargeting
Fluctuating Experience
Ring Menu
Blizz-ABS Action Recharge Time
Touch Damage
Actor Change
Secondary Weapon
Dialogue in txt
...
Holy shit, those are many o.O
Also, it should cause terrible crashes with the SDK.
Whoever does this will of course be credited.
Seems easy enough. Hope it's what you were looking for. (BTW, couldn't get album covers to work. Going to keep trying, though.)
#==============================================================================
# ** Now Playing by LilBrudder917
#------------------------------------------------------------------------------
# This window displays which music is being played now.
#
# TO USE:
# Use "Call Script" and add
#
# "$lmusic = ["SONG TITLE"]
# $lauthor = ["AUTHOR/BAND NAME"]
# $lalbum = ["ALBUM TITLE"]
# @nowplaying = Window_LMusic.new
# @nowplaying.x = 2
# @nowplaying.y = 2
# @nowplaying.opacity = $game_variables[1]"
#
# Of course, you can change the X and Y positions as you please, aswell as
# the variable ID.
#
#
# To remove the Window, use "Call Script" and add
#
# "@nowplaying.dispose
# @nowplaying = nil"
#
#==============================================================================
$lmusic = []
$lauthor = []
$lalbum = []
class Window_LMusic < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(2, 2, 400, 115)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 1200, 32, "Now Playing: " + $lmusic.to_s)
self.contents.draw_text(4, 20, 120, 32, "by " + $lauthor.to_s)
self.contents.draw_text(4, 40, 1200, 32, "from the album " + $lalbum.to_s)
self.contents.font.color = normal_color
end
if defined?(SDK)
raise "SDK's fault, I swear."
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
refresh
end
end
Includes variable-controlled opacity, song title, song author/band, song album, and causes crashes with SDK ;). I know you were probably joking about that part, but I found it too funny to resist. If you want to remove the SDK crashing, delete this part:
if defined?(SDK)
raise "SDK's fault, I swear."
end
lol lvl for the script lb
That just earned you a custom title. :D
lol nice blizz
Quote from: lilbrudder917 on December 31, 2009, 09:49:16 pm
Seems easy enough. Hope it's what you were looking for. (BTW, couldn't get album covers to work. Going to keep trying, though.)
#==============================================================================
# ** Now Playing by LilBrudder917
#------------------------------------------------------------------------------
# This window displays which music is being played now.
#
# TO USE:
# Use "Call Script" and add
#
# "$lmusic = ["SONG TITLE"]
# $lauthor = ["AUTHOR/BAND NAME"]
# $lalbum = ["ALBUM TITLE"]
# @nowplaying = Window_LMusic.new
# @nowplaying.x = 2
# @nowplaying.y = 2
# @nowplaying.opacity = $game_variables[1]"
#
# Of course, you can change the X and Y positions as you please, aswell as
# the variable ID.
#
#
# To remove the Window, use "Call Script" and add
#
# "@nowplaying.dispose
# @nowplaying = nil"
#
#==============================================================================
$lmusic = []
$lauthor = []
$lalbum = []
class Window_LMusic < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(2, 2, 400, 115)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 1200, 32, "Now Playing: " + $lmusic.to_s)
self.contents.draw_text(4, 20, 120, 32, "by " + $lauthor.to_s)
self.contents.draw_text(4, 40, 1200, 32, "from the album " + $lalbum.to_s)
self.contents.font.color = normal_color
end
if defined?(SDK)
raise "SDK's fault, I swear."
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
refresh
end
end
Includes variable-controlled opacity, song title, song author/band, song album, and causes crashes with SDK ;). I know you were probably joking about that part, but I found it too funny to resist. If you want to remove the SDK crashing, delete this part:
if defined?(SDK)
raise "SDK's fault, I swear."
end
WOW, thanks ^^
That just earned you 2 level ups and some credits in a hopefully awesome game, lol.
I'll test it as soon as possible, I'm quite busy hitting things with a hammer right now though to sample it for my music. o.O
PS: Can I haz custom title, too? =3
Sure, which do you want?
*surprises you*
HEY THERE!
I just tested your script and I must say, it just works perfectly and does what it's supposed to do - so you got another lvl ++ xD
But I still have some small requests (yes, I'm an annoying bastard.)
1. Could you make it so that it gets automatically called when the bgm changes and then fades out after some time?
2. Is it possible that it reads the song info out of the file name, divided by a special sign? Like "fallen into ruin*theUprising*Endzeit Soundtrack.mp3" becomes
fallen into ruin
theUprising
Endzeit Soundtrack
?
3. A noob request... how do I change the text colour? lol
Thanks so far!
Quote from: Subsonic_Noise on February 06, 2010, 11:18:36 am
HEY THERE!
I just tested your script and I must say, it just works perfectly and does what it's supposed to do - so you got another lvl ++ xD
But I still have some small requests (yes, I'm an annoying bastard.)
1. Could you make it so that it gets automatically called when the bgm changes and then fades out after some time?
2. Is it possible that it reads the song info out of the file name, divided by a special sign? Like "fallen into ruin*theUprising*Endzeit Soundtrack.mp3" becomes
fallen into ruin
theUprising
Endzeit Soundtrack
?
3. A noob request... how do I change the text colour? lol
Thanks so far!
1. Not sure if it's possible to make it so that it automatically appears but I'll try, and fading could work with:
Quote from: Script Call@nowplaying.opacity = 250
(wait 4 or so frames)
@nowplaying.opacity = 245 (etc.)
but the text wouldn't fade with it, at least, not when I tried it.
EDIT: Also, if you'd like, I think I could make a fade effect directly in the script.
2. No promises, but I'll try.
3. Line 47 :
self.contents.font.color = system_color
Change that. If you'd like, I think I could make it so you can change that with a script call, too.
Quote from: lilbrudder917 on February 06, 2010, 11:34:49 am
Quote from: Subsonic_Noise on February 06, 2010, 11:18:36 am
HEY THERE!
I just tested your script and I must say, it just works perfectly and does what it's supposed to do - so you got another lvl ++ xD
But I still have some small requests (yes, I'm an annoying bastard.)
1. Could you make it so that it gets automatically called when the bgm changes and then fades out after some time?
2. Is it possible that it reads the song info out of the file name, divided by a special sign? Like "fallen into ruin*theUprising*Endzeit Soundtrack.mp3" becomes
fallen into ruin
theUprising
Endzeit Soundtrack
?
3. A noob request... how do I change the text colour? lol
Thanks so far!
1. Not sure if it's possible to make it so that it automatically appears but I'll try, and fading could work with:
Quote from: Script Call@nowplaying.opacity = 250
(wait 4 or so frames)
@nowplaying.opacity = 245 (etc.)
but the text wouldn't fade with it, at least, not when I tried it.
EDIT: Also, if you'd like, I think I could make a fade effect directly in the script.
2. No promises, but I'll try.
3. Line 47 :
self.contents.font.color = system_color
Change that. If you'd like, I think I could make it so you can change that with a script call, too.
1. Would be awesome, since I'll have the window at low / zero opacity most of the time, fading text would be good, too.^^
2. Thanks. Sorry for requesting difficult stuff, lol
3. Thanks, but you don't need to implement it with the script call, I just need the same colour for everything.^^
Quote from: Subsonic_Noise on February 06, 2010, 11:43:03 am
1. Would be awesome, since I'll have the window at low / zero opacity most of the time, fading text would be good, too.^^
2. Thanks. Sorry for requesting difficult stuff, lol
3. Thanks, but you don't need to implement it with the script call, I just need the same colour for everything.^^
1. Okay, I already started working on it, and (besides the text opacity, dunno why that doesn't work) this part is almost done.
2. Not a problem.
3. Then you would change "system_color" to something like
Color.new(0, 5, 255, 255)
EDIT: :^_^': I am so stupid. I just remembered that this can change the text opacity. So text will fade, as well.
EDIT 2: Okay, this isn't going to work. If you put text with a lower opacity on top of the same text with higher opacity, it won't change.
I recommend having the text on a low opacity (such as 100) and then when the window is fully faded out, it'll disappear.
What I have so far:
#==============================================================================
# ** Now Playing by LilBrudder917
#------------------------------------------------------------------------------
# This window displays which music is being played now.
#
# TO USE:
# Use "Call Script" and add
#
# "$lmusic = ["SONG TITLE"]
# $lauthor = ["AUTHOR/BAND NAME"]
# $lalbum = ["ALBUM TITLE"]
# @nowplaying = Window_LMusic.new
# @nowplaying.x = 2
# @nowplaying.y = 2
# @nowplaying.opacity = $game_variables[1]"
#
# Of course, you can change the X and Y positions as you please, aswell as
# the variable ID.
#
#
# To remove the Window, use "Call Script" and add
#
# "@nowplaying.dispose
# @nowplaying = nil"
#
#==============================================================================
$lmusic = []
$lauthor = []
$lalbum = []
class Window_LMusic < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(2, 2, 400, 115)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = Color.new(0, 5, 0, 100)
self.contents.draw_text(4, 0, 1200, 32, "Now Playing: " + $lmusic.to_s)
self.contents.draw_text(4, 20, 120, 32, "by " + $lauthor.to_s)
self.contents.draw_text(4, 40, 1200, 32, "from the album " + $lalbum.to_s)
self.contents.font.color = normal_color
fade
end
if defined?(SDK)
raise "SDK's fault, I swear."
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
refresh
end
def fade
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 255
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 230
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 205
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 180
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 155
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 130
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 105
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 80
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 55
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 30
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 5
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.opacity = 0
Graphics.update
Graphics.update
Graphics.update
Graphics.update
self.contents.dispose
end
end
The fade effect pretty much ruins the variable opacity, but if you want it to start on a lower opacity (155, for example), remove everything below (and including) "self.opacity = 255" up until the line above "self.opacity = 155", for example.
this would be better done with a sprite.
also if you edited Game_System.bgm_play you could make it all automatically then you would set up a config method for song titles ect.
If you want I can make the gamy system method for you and change the window into a sprite so that it can fade out properly.
Quote from: Ryexander on February 06, 2010, 12:58:11 pm
this would be better done with a sprite.
also if you edited Game_System.bgm_play you could make it all automatically then you would set up a config method for song titles ect.
If you want I can make the gamy system method for you and change the window into a sprite so that it can fade out properly.
Would be awesome, I don't know if he wants to do it himself though.
I'd appreciate it xD
Well, I don't know how to do that, so if Ryex wants to do it, that's fine by me.
Here's something to work on:
class Game_System
attr_accessor :now_playing
alias now_playing_system_initialize initialize
def initialize
now_playing_system_initialize
@now_playing = nil
end
alias now_playing_bgm_play bgm_play
def bgm_play(bgm)
now_playing_bgm_play(bgm)
@now_playing = bgm.name if $scene.is_a?(Scene_Map)
end
end
class Spriteset_Map
alias now_playing_map_spriteset_initialize initialize
def initialize
now_playing_map_spriteset_initialize
@now_playing_sprite = nil
end
alias now_playing_map_spriteset_update update
def update
now_playing_map_spriteset_update
if $game_system.now_playing != nil
if @now_playing_sprite.nil? || @now_playing_sprite.disposed?
@now_playing_sprite = Now_Playing_Sprite.new(
$game_system.now_playing, @viewport1)
end
@now_playing_sprite.update
$game_system.now_playing = nil if @now_playing_sprite.disposed?
end
end
alias now_playing_map_spriteset_dispose dispose
def dispose
now_playing_map_spriteset_dispose
@now_playing_sprite.dispose unless @now_playing_sprite.nil? ||
@now_playing_sprite.disposed?
end
end
class Now_Playing_Sprite < Sprite
def initialize(bgm_name='', vp=nil)
super(vp)
make_bitmap(bgm_name)
self.opacity = 0
self.z = 1000
@waittime = 120
end
def make_bitmap(bgm_name)
a = bgm_name.split(/-/)
b = Bitmap.new(1, 1)
size = 0
a.each {|str| s = b.text_size(str).width
size = s if s > size}
b.dispose
b = Bitmap.new(size+16, a.size*26+16)
b.fill_rect(b.rect, Color.new(0, 0, 0, 128))
b.font.size = 24
a.each_with_index {|str, i| y = 8 + i*28
b.draw_text(8, y, size, 26, str)}
self.bitmap = b
end
def update
if self.opacity < 255 && @waittime == 120
self.opacity += 32
elsif @waittime > 0
@waittime -= 1
elsif self.opacity > 0
self.opacity -= 32
else
self.dispose
end
end
def dispose
self.bitmap.dispose unless self.bitmap.nil? || self.bitmap.disposed?
super
end
end
Of course, it still needs a lot to be done (making it configurable, refining code naming, cosmetics, etc), but this is the implementation approach. As of now, it works with any BGM being played only on the map. The filename is separated using the "-" delimiter. Try it out.
PS: *levels up Subsonic for the concept*
Quote from: Fantasist on February 08, 2010, 01:25:30 am
Here's something to work on:
class Game_System
attr_accessor :now_playing
alias now_playing_system_initialize initialize
def initialize
now_playing_system_initialize
@now_playing = nil
end
alias now_playing_bgm_play bgm_play
def bgm_play(bgm)
now_playing_bgm_play(bgm)
@now_playing = bgm.name if $scene.is_a?(Scene_Map)
end
end
class Spriteset_Map
alias now_playing_map_spriteset_initialize initialize
def initialize
now_playing_map_spriteset_initialize
@now_playing_sprite = nil
end
alias now_playing_map_spriteset_update update
def update
now_playing_map_spriteset_update
if $game_system.now_playing != nil
if @now_playing_sprite.nil? || @now_playing_sprite.disposed?
@now_playing_sprite = Now_Playing_Sprite.new(
$game_system.now_playing, @viewport1)
end
@now_playing_sprite.update
$game_system.now_playing = nil if @now_playing_sprite.disposed?
end
end
alias now_playing_map_spriteset_dispose dispose
def dispose
now_playing_map_spriteset_dispose
@now_playing_sprite.dispose unless @now_playing_sprite.nil? ||
@now_playing_sprite.disposed?
end
end
class Now_Playing_Sprite < Sprite
def initialize(bgm_name='', vp=nil)
super(vp)
make_bitmap(bgm_name)
self.opacity = 0
self.z = 1000
@waittime = 120
end
def make_bitmap(bgm_name)
a = bgm_name.split(/-/)
b = Bitmap.new(1, 1)
size = 0
a.each {|str| s = b.text_size(str).width
size = s if s > size}
b.dispose
b = Bitmap.new(size+16, a.size*26+16)
b.fill_rect(b.rect, Color.new(0, 0, 0, 128))
b.font.size = 24
a.each_with_index {|str, i| y = 8 + i*28
b.draw_text(8, y, size, 26, str)}
self.bitmap = b
end
def update
if self.opacity < 255 && @waittime == 120
self.opacity += 32
elsif @waittime > 0
@waittime -= 1
elsif self.opacity > 0
self.opacity -= 32
else
self.dispose
end
end
def dispose
self.bitmap.dispose unless self.bitmap.nil? || self.bitmap.disposed?
super
end
end
Of course, it still needs a lot to be done (making it configurable, refining code naming, cosmetics, etc), but this is the implementation approach. As of now, it works with any BGM being played only on the map. The filename is separated using the "-" delimiter. Try it out.
PS: *levels up Subsonic for the concept*
Wow, works awesome so far =D you got a level up, too, lol.
Just two questions though.
1. How can I stop the text from resizing?
2. How do I change the position and opacity of the window with this?
1. You mean the window resizing to fit the text?
2. Here's the second iteration with some more options:
class Now_Playing_Sprite < Sprite
OPACITY = 128
FONTSIZE = 24
WAITTIME = 120
POSITION = 3
###########################
# 1 2 #
# #
# #
# 5 #
# #
# #
# 3 4 #
###########################
# 1, 2, 3, 4, 5: top-left, top-right, bottom-left, bottom-right, middle
attr_accessor :mode
def initialize(bgm_name='', vp=nil)
super(vp)
make_bitmap(bgm_name)
self.opacity = 0
self.z = 1000
@waittime = WAITTIME
@mode = 0
end
def make_bitmap(bgm_name)
a = bgm_name.split(/-/)
b = Bitmap.new(1, 1)
b.font.size = FONTSIZE
size = 0
a.each {|str| s = b.text_size(str).width
size = s if s > size}
b.dispose
b = Bitmap.new(size+16, a.size*(FONTSIZE+4)+16)
b.fill_rect(b.rect, Color.new(0, 0, 0, OPACITY))
b.font.size = FONTSIZE
a.each_with_index {|str, i| y = 8 + i*(FONTSIZE+4)
b.draw_text(8, y, size, (FONTSIZE+4), str)}
self.bitmap = b
case POSITION
when 1
self.x, self.y = 0, 0
when 2
self.x, self.y = 640 - b.width, 0
when 3
self.x, self.y = 0, 480 - b.height
when 4
self.x, self.y = 640 - b.width, 480 - b.height
when 5
self.x, self.y = 320 - b.width/2, 240 - b.height/2
end
end
def update
if @mode == 0 # Intro
self.opacity < 255 ? self.opacity += 32 : @mode = 1
elsif @mode == 1 # Main
@waittime > 0 ? @waittime -= 1 : @mode = 2
elsif @mode == 2 # Outro
self.opacity > 0 ? self.opacity -= 32 : @mode = 3
else # Destructor
self.dispose
end
end
def dispose_override
bgm_name = $game_system.now_playing
self.dispose
$game_system.now_playing = bgm_name
end
def dispose
self.bitmap.dispose unless self.bitmap.nil? || self.bitmap.disposed?
$game_system.now_playing = nil
super
end
end
class Game_System
attr_accessor :now_playing
alias now_playing_system_initialize initialize
def initialize
now_playing_system_initialize
@now_playing = nil
end
alias now_playing_bgm_play bgm_play
def bgm_play(bgm)
now_playing_bgm_play(bgm)
@now_playing = bgm.name if $scene.is_a?(Scene_Map)
end
alias now_playing_bgm_stop bgm_stop
def bgm_stop
now_playing_bgm_stop
@now_playing = nil
end
alias now_playing_bgm_fade bgm_fade
def bgm_fade(time)
now_playing_bgm_fade(time)
@now_playing = nil
end
end
class Spriteset_Map
alias now_playing_map_spriteset_initialize initialize
def initialize
now_playing_map_spriteset_initialize
@now_playing_sprite = nil
@now_playing = nil
end
alias now_playing_map_spriteset_update update
def update
now_playing_map_spriteset_update
now_playing_exists = !(@now_playing_sprite.nil? ||
@now_playing_sprite.disposed?)
if @now_playing != $game_system.now_playing
#p [@now_playing, $game_system.now_playing]
@now_playing = $game_system.now_playing
if @now_playing.nil? || @now_playing == ''
@now_playing_sprite.mode = 2
else
@now_playing_sprite.dispose_override if now_playing_exists
@now_playing_sprite = Now_Playing_Sprite.new(@now_playing)
end
end
@now_playing_sprite.update if now_playing_exists
end
alias now_playing_map_spriteset_dispose dispose
def dispose
now_playing_map_spriteset_dispose
@now_playing_sprite.dispose unless @now_playing_sprite.nil? ||
@now_playing_sprite.disposed?
end
end
You can set the position to the corners and center. If you want to set absolute positions, let me know.
Sorry to only answer this now, lol. I just tried this and it's just amazing. Works smoothly, without any problems. Another level up for you :D
Now the only thing missing would be the album covers. Whould you be able to do that?
I would be able to, but I can't do it now. Unless you have a deadline, I hope you don't mind if I took some time. Thanks for the powerup :D
PS: You know, this is such a nice idea I feel like releasing the script, but the thought of making the header, organizing the code and posting hte topic are making me think again. I'm getting too old for this :V
Quote from: Mad Scientist Fantasist on April 02, 2010, 12:58:46 pm
I would be able to, but I can't do it now. Unless you have a deadline, I hope you don't mind if I took some time. Thanks for the powerup :D
PS: You know, this is such a nice idea I feel like releasing the script, but the thought of making the header, organizing the code and posting hte topic are making me think again. I'm getting too old for this :V
I absolutely have no deadline. I'm working on the base engine of this game for a very long time now, changing the battle system twice, redoing all gameplay mechanics, etc. so I think I can wait xD
Sweet ^.^
INFPs ftw! My sig doesn't show properly, does it? I'll need to fix that sometime... /pointless chatter