diablosbud
Member
I am currently working on a custom script for displaying game records and I used the Window and Scene Wizard by Mr. Mo, I have it all prepared for a adding the different windows, but I am lost at were to put my window drawing and disposing. Please help me figure out these fragment placements. Here are the scripts and the script below the other script must be above the other or else it can cause errors:
Code:
#==============================================================================
class Window_Record_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 56)
#Set Window Skin
self.windowskin = RPG::Cache.windowskin('Phoenix')
#Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
#Z-Pos
self.z = 100
#Get Contents
get_contents
#Refresh and add the contents to window
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
#Clear Bitmap
self.contents.clear
#Add Contents
add_contents
end
#--------------------------------------------------------------------------
# * Add Content- Adds the contents
#--------------------------------------------------------------------------
def add_contents
#Get all the contents
for cont in @content
next if cont == nil
#If the content is a text
if cont.is_a?(Game_Text)
# Add the text
add_text(cont.text,cont.x,cont.y,cont.w,cont.h,cont.size,cont.color,cont.bol,cont.it)
elsif cont.is_a?(Game_Bar)
# Add Bar
draw_bar_type(cont.x, cont.y, cont.min, cont.max, cont.file, cont.w , cont.h, cont.hue, cont.back, cont.back2, cont.view)
elsif cont.is_a?(Game_HpBar)
#Draw HP Bar
draw_actor_hp(cont.actor, cont.x, cont.y, cont.w, cont.file)
elsif cont.is_a?(Game_SpBar)
#Draw Sp Bar
draw_actor_sp(cont.actor, cont.x, cont.y, cont.w, cont.file)
elsif cont.is_a?(Game_ExpBar)
#Draw Exp Bar
draw_actor_exp(cont.actor, cont.x, cont.y, cont.w, cont.file)
elsif cont.is_a?(Game_ParaBar)
#Draw Para Bar
draw_actor_parameter(cont.actor, cont.x, cont.y, cont.type, cont.file)
elsif cont.is_a?(Game_Pic)
#Draw Picture
add_picture(cont.file,cont.x,cont.y,cont.w,cont.h)
elsif cont.is_a?(Game_CharacterSet)
#Draw Characterset
add_characterset(cont.file,cont.x,cont.y,cont.dir,cont.h,cont.w,cont.hue)
elsif cont.is_a?(Game_Bat)
#Draw Game Battler
add_battler(cont.file,cont.x,cont.y,cont.w,cont.h,cont.hue)
elsif cont.is_a?(Game_AcCharacterSet)
#Draw Characterset
add_characterset(cont.file,cont.x,cont.y,cont.dir,cont.h,cont.w,cont.hue)
elsif cont.is_a?(Game_AcBat)
#Draw Game Battler
add_battler(cont.file,cont.x,cont.y,cont.w,cont.h,cont.hue)
elsif cont.is_a?(Game_Icon)
#Draw Icon
add_icon(cont.file,cont.x,cont.y,cont.w,cont.h)
end
end
end
#--------------------------------------------------------------------------
# * Get Contents - Creates a list of the contents
#--------------------------------------------------------------------------
def get_contents
#Set the content array
@content = []
#Save Content: Text A record of some of your main achievements on this game file.
@content[0] = Game_Text.new(0,-4,600,32,'A record of some of your main achievements on this game file.',24,false,false,255,255,255,255)
end
end
Code:
#==============================================================================
# Scene_Records
#==============================================================================
class Scene_Records
#--------------------------------------------------------------------------
# * Main - Handles drawing/disposing windows and the main loop
#--------------------------------------------------------------------------
def main
#Draw Windows
window_record_help_draw
#Execute transition
Graphics.transition
#Main Loop
loop do
#Main Loop
window_record_help_loop
break if window_record_help_scenechange?
end
#Prepare for transition
Graphics.freeze
#Dispose Windows
window_record_help_dispose
end
#--------------------------------------------------------------------------
# * Main Draw - Handles drawing windows
#--------------------------------------------------------------------------
def window_record_help_draw
#Draw Windows
# Main Window
@Window_Record_Help = Window_Record_Help.new
end
#--------------------------------------------------------------------------
# * Main Scene Change
#--------------------------------------------------------------------------
def window_record_help_scenechange?
# Abort loop if screen is changed
if $scene != self
return true
end
return false
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def window_record_help_dispose
# Dispose All Windows
# Dispose Main Window
@Window_Record_Help.dispose
end
#--------------------------------------------------------------------------
# * Main Loop
#--------------------------------------------------------------------------
def window_record_help_loop
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Update Windows
update_windows
end
#--------------------------------------------------------------------------
# * Window Update
#--------------------------------------------------------------------------
def update_windows
# Update Main Window
@Window_Record_Help.update if @Window_Record_Help.visible
end
end