[RESOLVED] Mutiple $scene's???

Started by jyumai, December 24, 2010, 10:24:20 am

Previous topic - Next topic

jyumai

December 24, 2010, 10:24:20 am Last Edit: December 24, 2010, 12:52:03 pm by jyumai
Hey guys I have two scripts, first one shows a loading bar before titlescreen and second one shows two splash screens. Both have $scenes that have to be called in main. Is it possible to call the $scene for the splash screen then the loading bar. I cant seem to do it on my own.

Thanks in advance.

Aqua

So you want like... the splash screens to be a background to the loading bar or something?

jyumai

No...actually let me give you a scenario:

$scene = Scene_Splash.new calls the splash screen in main....
$scene = Scene_Loading_Bar.new calls the loading bar in main....

I want to have the splash screen so I call $scene = Scene_Splash.new in main.

However I also want to have the loading bar immediately following the splash screen. But for some
reason the splash screen $scene is called but the loading bar $scene isnt.

Aqua

Call the loading bar scene within the splash one, not main.

jyumai

Ok thats done...just one slight problem...When the loading bar starts a second later it moves to the splash screen. I'm not
an RGSS scripter, but I think I need to wait a certain number of frames until the loading bar's animation is finished. Whats the
syntax for that?

Aqua

You probably called it at the wrong place.

I'm not giving you detailed help because you're not providing detailed ask for help.

jyumai

December 24, 2010, 11:15:34 am #6 Last Edit: December 24, 2010, 12:43:03 pm by jyumai
I can provide the loading bar script, again plaease bare with me I am not a scripter in this language.

Spoiler: ShowHide
#===================================================================
# Ultimate Fake Loading Bar
# By arevulopapo
# May 11 2007
#
# This script displays a fake loading screen before the title.
#
#
# Setup:
# Put this script above the "main", go in the script "main" and change:
# $scene = Scene_Title.new
# by
# $scene = Scene_Loading_Bar.new
#
# Settings:
#
#LOADING_SPEED controls the speed of loading.
#
#BAR_FILL_TYPE select what will fill the bar.
#
# 1 - Use only one color to fill the bar.
# 2 - Transition of color that occurs throughout the bar.
# 3 - color transition smaller.
# 4 - an image ( "Graphics / Pictures / bar" any extension) used to fill the bar.
#
#BAR_FRAME_TYPE select the type of frame (outline):
#
# 1 - initial frame
# 2 - a picture ( "Graphics / Pictures / frame", any extension) which will be shown
# 3 - no frame
#
#BAR_BACK_TYPE select the background (bottom) bar:
#
# 1 - nothing
# 2 - a picture ( "Graphics / Pictures / back", any extension) which will be shown
#
#FILE_LISTING (true / false) true = shows that files are being loaded, false = do not show.
#
#BEEP (true / false) will play (or not) a sound ( "Audio / SE / beep, any extension)
#when the end of the loading
#
#BACKGROUND selects the bottom of the screen:
#
# 1 - the title screen
# 2 - a picture ( "Graphics / Pictures / splash", any extension)
# 3 - no background (black background)
#
# NOTE:
# Any image used to create bars / frames must 544x32 in size.
#===================================================================
LOADING_SPEED = 15
BAR_FILL_TYPE = 3
BAR_FRAME_TYPE = 1
BAR_BACK_TYPE = 1
FILE_LISTING = false
BEEP = false
BACKGROUND = 2
COLOR_1 = Color.new(255,64,64,255)
COLOR_2 = Color.new(128,255,64,255)
COLOR_3 = Color.new(16,16,16,255)


#===================================================================
# Window
#===================================================================
class Window_Loading_Bar < Window_Base
#=================================================================
attr_reader :finish_flag
#=================================================================
def initialize()
super(0, 384, 640, 64)
self.contents = Bitmap.new(608, 32)
self.contents.font.size = 16
self.windowskin = nil
@finish_flag = false
@bar_fill = 0
@file = 0
@flags = [0,0,0]
@speed = LOADING_SPEED
refresh
end
#=================================================================
def refresh
self.contents.clear
step = rand(@speed)
unless (@bar_fill + step) > 544
@bar_fill += step
else
@finish_flag = true
end
#===============================================================
# Draw background bar
#===============================================================
case BAR_BACK_TYPE
when 1
self.contents.fill_rect(32, 0, 544, 32, COLOR_3)
when 2
self.contents.blt(32, 0, RPG::Cache.picture('back.png'), Rect.new(0,0,544,32))
end
#===============================================================
# Draw main bar
#===============================================================
case BAR_FILL_TYPE
when 1
self.contents.fill_rect(32, 0, @bar_fill, 32, COLOR_1)
when 2
r = COLOR_1.red + (COLOR_2.red - COLOR_1.red)*@bar_fill/544
g = COLOR_1.green + (COLOR_2.green - COLOR_1.green)*@bar_fill/544
b = COLOR_1.blue + (COLOR_2.blue - COLOR_1.blue)*@bar_fill/544
a = COLOR_1.alpha + (COLOR_2.alpha - COLOR_1.alpha)*@bar_fill/544
self.contents.fill_rect(32, 0, @bar_fill, 32, Color.new(r,g,b,a))
when 3
for i in 0..@bar_fill - 1
r = COLOR_1.red + (COLOR_2.red - COLOR_1.red)*i/544
g = COLOR_1.green + (COLOR_2.green - COLOR_1.green)*i/544
b = COLOR_1.blue + (COLOR_2.blue - COLOR_1.blue)*i/544
a = COLOR_1.alpha + (COLOR_2.alpha - COLOR_1.alpha)*i/544
self.contents.fill_rect(32+i, 0, 1, 32, Color.new(r,g,b,a))
end
when 4
self.contents.blt(32, 0, RPG::Cache.picture('bar.png'), Rect.new(0,0,@bar_fill,32))
end
#===============================================================
# Draw surrounding rectangle
#===============================================================
case BAR_FRAME_TYPE
when 1
self.contents.fill_rect(32, 0, 544, 5, Color.new(64,64,64))
self.contents.fill_rect(32, 0, 5, 32, Color.new(64,64,64))
self.contents.fill_rect(571, 0, 5, 32, Color.new(64,64,64))
self.contents.fill_rect(32, 27, 544, 5, Color.new(64,64,64))
self.contents.fill_rect(33, 1, 542, 3, Color.new(128,128,128))
self.contents.fill_rect(33, 28, 542, 3, Color.new(128,128,128))
self.contents.fill_rect(33, 1, 3, 30, Color.new(128,128,128))
self.contents.fill_rect(572, 1, 3, 30, Color.new(128,128,128))
self.contents.fill_rect(34, 2, 540, 1, Color.new(192,192,192))
self.contents.fill_rect(34, 29, 540, 1, Color.new(192,192,192))
self.contents.fill_rect(573, 2, 1, 28, Color.new(192,192,192))
self.contents.fill_rect(34, 2, 1, 28, Color.new(192,192,192))
when 2
self.contents.blt(32, 0, RPG::Cache.picture('frame.png'), Rect.new(0,0,544,32))
end
#===============================================================
# Make array of filenames
#===============================================================
files_root = Dir.entries(".")
files_data = (files_root.include?("Data") ? Dir.entries("Data")+Dir.entries(".") : [])
files_graphics = (files_root.include?("Graphics") ? Dir.entries("Graphics")+Dir.entries("Graphics/Animations")+Dir.entries("Graphics/Autotiles")+Dir.entries("Graphics/Battlebacks")+Dir.entries("Graphics/Battlers")+Dir.entries("Graphics/Characters")+Dir.entries("Graphics/Fogs")+Dir.entries("Graphics/Gameovers")+Dir.entries("Graphics/Icons")+Dir.entries("Graphics/Panoramas")+Dir.entries("Graphics/Pictures")+Dir.entries("Graphics/Tilesets")+Dir.entries("Graphics/Titles")+Dir.entries("Graphics/Transitions")+Dir.entries("Graphics/Windowskins") : [])
files_audio = (files_root.include?("Audio") ? Dir.entries("Audio")+Dir.entries("Audio/BGM")+Dir.entries("Audio/BGS")+Dir.entries("Audio/SE")+Dir.entries("Audio/ME") : [])
if @flags[0] == 0
if @file < files_data.size
text = "Data/" + files_data[@file]
else
@flags[0] = 1
@file = 0
return
end
elsif @flags[1] == 0
if @file < files_graphics.size
text = "Graphics/" + files_graphics[@file]
else
@flags[1] = 1
@file = 0
return
end
elsif @flags[2] == 0
if @file < files_audio.size
text = "Audio/" + files_audio[@file]
else
@flags[2] = 1
@file = 0
return
end
else
text = "RGSS102E.DLL"
@speed += 1
end
#===============================================================
# Draw the filenames loaded
#===============================================================
self.contents.draw_text(192,0,608,32,"Loading file: " + text,0) if FILE_LISTING
@file += 1
end
#=================================================================
end

#===================================================================
# Scene
#===================================================================
class Scene_Loading_Bar
#=================================================================
def main
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new
@sprite = Sprite.new
case BACKGROUND
when 1
bitmap = RPG::Cache.title($data_system.title_name)
when 2
bitmap = RPG::Cache.picture("splash")
when 3
bitmap = RPG::Cache.picture("")
end
@sprite.bitmap = bitmap
@loading_bar = Window_Loading_Bar.new
Graphics.transition
loop do
Graphics.update
@loading_bar.refresh
if @loading_bar.finish_flag == true
$scene = Scene_Title.new
Audio.se_play("Audio/SE/System01", 100, 100) if BEEP
end
if $scene != self
break
end
end
Graphics.freeze
@loading_bar.dispose
@sprite.bitmap.dispose
@sprite.dispose
end
#=================================================================
end

jyumai

You know what...Its cool I got it.   ;)

Valdred

Not really on topic, but why would you use such a script? Do you have any idea how annoying loading time is? Especially when it does nothing :/

ForeverZer0

To answer your original question, "no" you can't use two scenes, nor would you ever have to, under any circumstances. Just have one scene scripted right, or have a transition from one to the other. I believe you are misunderstanding exactly how scenes are used in RMXP.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zeriab

You can use my Dialog System to create dialogs which you can consider as a scene on top of the current scene. (Any number of nested dialogs are supported)
A fake loading bar fits imo conceptually better with a dialog that freezes the current scene because it can be called at pretty much anytime and it does not disturb the normal $scene flow.

*hugs*