05-25-2009, 03:02 PM
Hey Punk. Good work on this script ^_^
I really like your documentation and commenting for the settings.
I do not like your indention (or lack-of rather) of the second settings page.
Take for example this:
I would suggest using indention to illustrate which part belongs to which part: (I.e. proper indention)
On to the last page, the pause script code:
I don't like that you are doing all the processing in the constructor of the PK8_Pause_Script class script. Instead I would suggest creating a class method which you just call and let that method handle the time consuming processing so creating the object doesn't take an insanely long time. It could for example look like this:
Since it is a pause script which can work in more than a specific scene you could consider integrating the pausing with the Input module rather than specific scenes.
If you need an example you can look at this pause script I have created:
*hugs*
- Zeriab
I really like your documentation and commenting for the settings.
I do not like your indention (or lack-of rather) of the second settings page.
Take for example this:
Code:
Pause_Text[0] = [
"Paused.", # Text String
["Georgia", 22, false, false, # Font Name, Size, Bold, Italics
[255, 255, 255, 255]], # Text Color: Red, Green, Blue, Alpha
1, 5, # Alignment, Z Coordinate
255, 0, # Opacity, Blend Type
[100, 100], # Zoom X and Zoom Y
0, false, # Angle, Draw Horizontally?
[0, 0] # X and Y Positioning
]
I would suggest using indention to illustrate which part belongs to which part: (I.e. proper indention)
Code:
Pause_Text[0] = [
"Paused.", # Text String
["Georgia", 22, false, false, # Font Name, Size, Bold, Italics
[255, 255, 255, 255]], # Text Color: Red, Green, Blue, Alpha
1, 5, # Alignment, Z Coordinate
255, 0, # Opacity, Blend Type
[100, 100], # Zoom X and Zoom Y
0, false, # Angle, Draw Horizontally?
[0, 0] # X and Y Positioning
]
On to the last page, the pause script code:
I don't like that you are doing all the processing in the constructor of the PK8_Pause_Script class script. Instead I would suggest creating a class method which you just call and let that method handle the time consuming processing so creating the object doesn't take an insanely long time. It could for example look like this:
Code:
class PK8_Pause_Script
def self.run
instance = self.new
loop do
Graphics.update
Input.update
instance.update
if Input.trigger?(PK8::Pause_UPButton_Eval)
instance.dispose
$pk8_pause = nil
break
end
end
end
Since it is a pause script which can work in more than a specific scene you could consider integrating the pausing with the Input module rather than specific scenes.
If you need an example you can look at this pause script I have created:
Code:
#==============================================================================
# ** Pause with image
#------------------------------------------------------------------------------
# Zeriab
# Version 1.0
# 2009-05-23 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Description :
#
# This script changes the functionality of pressing F12 during the game
# from resetting the game to (un)pausing the game. A picture is displayed
# while the game is paused. (Having a picture is optional)
#------------------------------------------------------------------------------
# * License :
#
# Copyright (C) 2009 Zeriab
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# For the full license see <http://www.gnu.org/licenses/>
# The GNU General Public License: http://www.gnu.org/licenses/gpl.txt
# The GNU Lesser General Public License: http://www.gnu.org/licenses/lgpl.txt
#------------------------------------------------------------------------------
# * Compatibility :
#
# Is most likely not compatible with other pause scripts.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place this script anywhere above main.
# The image file 'pause' present in Graphics/Pictures is used.
# Note: No picture is shown if there is no 'pause' in Graphics/Pictures.
#==============================================================================
#=============================================================================
# ** Module Input
#=============================================================================
module Input
class << self
PAUSE_BUTTON = F6
#-------------------------------------------------------------------------
# * Aliases Graphics.update and Graphics.transition
#-------------------------------------------------------------------------
unless self.method_defined?(:zeriab_pause_update)
alias_method(:zeriab_pause_update, :update)
end
def update(*args)
zeriab_pause_update(*args)
return unless trigger?(PAUSE_BUTTON)
# Store frame count
frame_count = Graphics.frame_count
# Show pause image
@sprite = Sprite.new
@sprite.z = 9999
begin
@sprite.bitmap = RPG::Cache.picture('pause')
rescue
@sprite.bitmap = Bitmap.new(32,32)
end
# Update once so the trigger doesn't count.
zeriab_pause_update(*args)
# Update until trigger
while !trigger?(PAUSE_BUTTON)
zeriab_pause_update(*args)
Graphics.update
end
# Dispose pause image
@sprite.dispose
# Set proper frame count
Graphics.frame_count = frame_count
end
end
end
*hugs*
- Zeriab