I am using RMXP and have a question regarding Cyclope's Advanced Name Input script:
http://forum.chaos-project.com/index.php?topic=6731.0 (http://forum.chaos-project.com/index.php?topic=6731.0)
I am using the Tons of Addons version:
#==============================================================================
# Modyfied Scene_Name
# By Cyclope
#------------------------------------------------------------------------------
#´ Instructions
# Place above main
#------------------------------------------------------------------------------
# Credit:
# Nattmath (For making Scene_Name Leters Modification)
# Blizzard (For making Custom Cotrols)
# Cyclope (For modifying Scene_Name Leters Modification and Scene_Name)
#==============================================================================
#==============================================================================
# ** Window_Instructions
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_Instruction < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize
super( 0, 400, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 18
self.contents.font.color = normal_color
#Change this text to whatever instructions u want to have!
self.contents.draw_text(26, 9, 500, 32, "Enter = OK")
self.contents.draw_text(128, 9, 500, 32, "Esc/Backspace = Delete")
self.contents.draw_text(336, 9, 500, 32, "abc... = Text")
self.contents.draw_text(448, 9, 500, 32, "Shift = Uppercase")
end
end
#==============================================================================
# ** Window_TextName
#------------------------------------------------------------------------------
# super ( 224, 32, 224, 80)
#==============================================================================
class Window_TextName < Window_Base
def initialize
super ( 224, 32, 224, 80)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = $game_actors[$game_temp.name_actor_id]
refresh
end
def refresh
self.contents.clear
draw_actor_graphic(@actor, 20, 48)
self.contents.font.name = "Arial"
self.contents.font.size = 40
self.contents.font.color = normal_color
self.contents.draw_text(64, 0, 96, 32, "Name:")
end
end
#==============================================================================
# ** Window_NameEdit
#------------------------------------------------------------------------------
# This window is used to edit your name on the input name screen.
#==============================================================================
class Window_NameEdit < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# max_char : maximum number of characters
#--------------------------------------------------------------------------
def initialize(actor, max_char)
super(16, 128, 608, 96)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@name = actor.name
@max_char = max_char
# Fit name within maximum number of characters
name_array = @name.split(//)[0...@max_char]
@name = ""
for i in 0...name_array.size
@name += name_array[i]
end
@default_name = @name
@index = name_array.size
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Return to Default Name
#--------------------------------------------------------------------------
def restore_default
@name = @default_name
@index = @name.split(//).size
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Add Character
# character : text character to be added
#--------------------------------------------------------------------------
def add(character)
if @index < @max_char and character != ""
@name += character
@index += 1
refresh
update_cursor_rect
end
end
#--------------------------------------------------------------------------
# * Delete Character
#--------------------------------------------------------------------------
def back
if @index > 0
# Delete 1 text character
name_array = @name.split(//)
@name = ""
for i in 0...name_array.size-1
@name += name_array[i]
end
@index -= 1
refresh
update_cursor_rect
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Draw name
self.contents.font.size = 42
name_array = @name.split(//)
for i in 0...@max_char
c = name_array[i]
if c == nil
c = "_"
end
x = 304 - @max_char * 14 + i * 26
self.contents.draw_text(x, 15, 28, 42, c, 1)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
x = 320 - @max_char * 14 + @index * 26
self.cursor_rect.set(x, 55, 20, 5)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_cursor_rect
end
end
#==============================================================================
# ** Window_NameInput
#------------------------------------------------------------------------------
# This window is used to select text characters on the input name screen.
#==============================================================================
class Window_NameInput < Window_Base
CHARACTER_TABLE =
[
"", ""
]
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 0)
self.contents = Bitmap.new(width - 32, height - 32)
@index = 0
refresh
end
#--------------------------------------------------------------------------
# * Text Character Acquisition
#--------------------------------------------------------------------------
def character
return CHARACTER_TABLE[@index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
end
end
#==============================================================================
# ** Scene_Name
#------------------------------------------------------------------------------
# This class performs name input screen processing.
#==============================================================================
class Scene_Name
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_actors[$game_temp.name_actor_id]
# Make windows
@edit_window = Window_NameEdit.new(@actor, $game_temp.name_max_char)
@edit_window.back_opacity = 160
@input_window = Window_NameInput.new
@inst_window = Window_Instruction.new
@inst_window.back_opacity = 160
@nametext_window = Window_TextName.new
@nametext_window.back_opacity = 160
@spriteset = Spriteset_Map.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@edit_window.dispose
@input_window.dispose
@inst_window.dispose
@nametext_window.dispose
@spriteset.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@edit_window.update
@input_window.update
@nametext_window.update
@inst_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# If cursor position is at [OK]
if @input_window.character == nil
# If name is empty
if @edit_window.name == ""
# If name is empty
if @edit_window.name == ""
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
return
end
# Change actor name
@actor.name = @edit_window.name
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If cursor position is at maximum
if @edit_window.index == $game_temp.name_max_char
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If text character is empty
if @input_window.character == ""
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Add text character
@edit_window.add(@input_window.character)
return
end
end
end
#==============================================================================
# ** Scene_Name Leters Modification Made By Nattmath and Improved Cyclope
#------------------------------------------------------------------------------
# Makes you imput stuf with the keyboard
#==============================================================================
class Scene_Name
alias name_input_update update
def update
(65...91).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
let = let.downcase unless Input.press?(Input::Key['Shift'])
@edit_window.add(let)
end}
(48...58).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
@edit_window.add(let)
end}
(186...192).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
@edit_window.add(let)
end}
(219...222).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
@edit_window.add(let)
end}
if Input.trigger?(Input::Key['Backspace'])
@edit_window.back
end
if Input.trigger?(Input::Key['Arrow Left'])
@edit_window.back
end
if Input.trigger?(Input::Key['Enter'])
# If name is empty
if @edit_window.name == ""
# Return to default name
@edit_window.restore_default
# If name is empty
if @edit_window.name == ""
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
return
end
# Change actor name
@actor.name = @edit_window.name
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
end
if Input.trigger?(Input::Key['Space'])
@actor.name = @edit_window.name
$game_system.se_play($data_system.decision_se)
@edit_window.add(" ")
end
name_input_update
end
end
The script uses the map as the background. If I want to use a picture instead, how would I go about doing this? I tried to look at other scripts and how they do it but all I've been met with is errors.
The picture I intend to use is slightly "see-through" so the map would be seen behind the picture exactly how Zeriab did in his F12 Pause w/ Image Script:
http://forum.chaos-project.com/index.php?topic=3613.0 (http://forum.chaos-project.com/index.php?topic=3613.0)
#==============================================================================
# ** Pausing with F12
#------------------------------------------------------------------------------
# Zeriab
# Version 1.1
# 2009-05-25 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1.0 -------------------------------------------------- (2009-05-22)
# - First release
#
# Version 1.1 -------------------------------------------------- (2009-05-25)
# - The pause image now appears immediately when F12 is pressed.
# - Transitions are cut short rather than restarted when F12 is pressed.
#------------------------------------------------------------------------------
# * 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 F12 prevention 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.
#==============================================================================
#=============================================================================
# ** Reset class (because it won't be defined until F12 is pressed otherwise)
#=============================================================================
class Reset < Exception
end
#=============================================================================
# ** Module Graphics
#=============================================================================
module Graphics
class << self
#-------------------------------------------------------------------------
# * Aliases Graphics.update and Graphics.transition
#-------------------------------------------------------------------------
unless self.method_defined?(:zeriab_f12_pause_update)
alias_method(:zeriab_f12_pause_update, :update)
alias_method(:zeriab_f12_pause_transition, :transition)
end
#-------------------------------------------------------------------------
# Change the update method so F12 toggles pause
#-------------------------------------------------------------------------
def update(*args)
# Try to update normally
begin
zeriab_f12_pause_update(*args)
return
rescue Reset
# Do nothing
end
# F12 has been pressed
done = false
# 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
# Keep trying to do the update
while !done
begin
zeriab_f12_pause_update(*args)
done = true
rescue Reset
# Do Nothing
end
end
# F12 has been released, update until it is pressed again
while done
begin
zeriab_f12_pause_update(*args)
rescue Reset
done = false
end
end
# F12 has been pressed, keep trying to update
while !done
begin
zeriab_f12_pause_update(*args)
done = true
rescue Reset
# Do nothing
end
end
# F12 has been released, dispose pause image
@sprite.dispose
# Set proper frame count
Graphics.frame_count = frame_count
end
#-------------------------------------------------------------------------
# Changes the transition so it is cut short if F12 is pressed
#-------------------------------------------------------------------------
def transition(*args)
done = false
# Keep trying to do the transition
while !done
begin
zeriab_f12_pause_transition(*args)
done = true
rescue Reset
# Set transition length to 0 frames.
args[0] = 0
end
end
end
end
end
Any help is greatly appreciated. :)
change
@spriteset = Spriteset_Map.new
to
@spriteset = Sprite.new
@spriteset.bitmap = RPG::Cache.picture(filename)
That did change the background to a picture but didn't allow for the semi-transparency of the picture to show the map behind it. Is this possible to accomplish?
here just add the file name to the Over_Picture_Graphic and tell me if it works
Over_Picture_Graphic = ''
#==============================================================================
# Modyfied Scene_Name
# By Cyclope
#------------------------------------------------------------------------------
#´ Instructions
# Place above main
#------------------------------------------------------------------------------
# Credit:
# Nattmath (For making Scene_Name Leters Modification)
# Blizzard (For making Custom Cotrols)
# Cyclope (For modifying Scene_Name Leters Modification and Scene_Name)
#==============================================================================
#==============================================================================
# ** Window_Instructions
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_Instruction < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize
super( 0, 400, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 18
self.contents.font.color = normal_color
#Change this text to whatever instructions u want to have!
self.contents.draw_text(26, 9, 500, 32, "Enter = OK")
self.contents.draw_text(128, 9, 500, 32, "Esc/Backspace = Delete")
self.contents.draw_text(336, 9, 500, 32, "abc... = Text")
self.contents.draw_text(448, 9, 500, 32, "Shift = Uppercase")
end
end
#==============================================================================
# ** Window_TextName
#------------------------------------------------------------------------------
# super ( 224, 32, 224, 80)
#==============================================================================
class Window_TextName < Window_Base
def initialize
super ( 224, 32, 224, 80)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = $game_actors[$game_temp.name_actor_id]
refresh
end
def refresh
self.contents.clear
draw_actor_graphic(@actor, 20, 48)
self.contents.font.name = "Arial"
self.contents.font.size = 40
self.contents.font.color = normal_color
self.contents.draw_text(64, 0, 96, 32, "Name:")
end
end
#==============================================================================
# ** Window_NameEdit
#------------------------------------------------------------------------------
# This window is used to edit your name on the input name screen.
#==============================================================================
class Window_NameEdit < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# max_char : maximum number of characters
#--------------------------------------------------------------------------
def initialize(actor, max_char)
super(16, 128, 608, 96)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@name = actor.name
@max_char = max_char
# Fit name within maximum number of characters
name_array = @name.split(//)[0...@max_char]
@name = ""
for i in 0...name_array.size
@name += name_array[i]
end
@default_name = @name
@index = name_array.size
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Return to Default Name
#--------------------------------------------------------------------------
def restore_default
@name = @default_name
@index = @name.split(//).size
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Add Character
# character : text character to be added
#--------------------------------------------------------------------------
def add(character)
if @index < @max_char and character != ""
@name += character
@index += 1
refresh
update_cursor_rect
end
end
#--------------------------------------------------------------------------
# * Delete Character
#--------------------------------------------------------------------------
def back
if @index > 0
# Delete 1 text character
name_array = @name.split(//)
@name = ""
for i in 0...name_array.size-1
@name += name_array[i]
end
@index -= 1
refresh
update_cursor_rect
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Draw name
self.contents.font.size = 42
name_array = @name.split(//)
for i in 0...@max_char
c = name_array[i]
if c == nil
c = "_"
end
x = 304 - @max_char * 14 + i * 26
self.contents.draw_text(x, 15, 28, 42, c, 1)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
x = 320 - @max_char * 14 + @index * 26
self.cursor_rect.set(x, 55, 20, 5)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_cursor_rect
end
end
#==============================================================================
# ** Window_NameInput
#------------------------------------------------------------------------------
# This window is used to select text characters on the input name screen.
#==============================================================================
class Window_NameInput < Window_Base
CHARACTER_TABLE =
[
"", ""
]
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 0)
self.contents = Bitmap.new(width - 32, height - 32)
@index = 0
refresh
end
#--------------------------------------------------------------------------
# * Text Character Acquisition
#--------------------------------------------------------------------------
def character
return CHARACTER_TABLE[@index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
end
end
#==============================================================================
# ** Scene_Name
#------------------------------------------------------------------------------
# This class performs name input screen processing.
#==============================================================================
class Scene_Name
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_actors[$game_temp.name_actor_id]
# Make windows
@edit_window = Window_NameEdit.new(@actor, $game_temp.name_max_char)
@edit_window.back_opacity = 160
@input_window = Window_NameInput.new
@inst_window = Window_Instruction.new
@inst_window.back_opacity = 160
@nametext_window = Window_TextName.new
@nametext_window.back_opacity = 160
@spriteset = Spriteset_Map.new
@over = Sprite.new
@over.bitmap = RPG::Cache.picture(Over_Picture_Graphic)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@edit_window.dispose
@input_window.dispose
@inst_window.dispose
@nametext_window.dispose
@spriteset.dispose
@over.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@edit_window.update
@input_window.update
@nametext_window.update
@inst_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# If cursor position is at [OK]
if @input_window.character == nil
# If name is empty
if @edit_window.name == ""
# If name is empty
if @edit_window.name == ""
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
return
end
# Change actor name
@actor.name = @edit_window.name
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If cursor position is at maximum
if @edit_window.index == $game_temp.name_max_char
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If text character is empty
if @input_window.character == ""
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Add text character
@edit_window.add(@input_window.character)
return
end
end
end
#==============================================================================
# ** Scene_Name Leters Modification Made By Nattmath and Improved Cyclope
#------------------------------------------------------------------------------
# Makes you imput stuf with the keyboard
#==============================================================================
class Scene_Name
alias name_input_update update
def update
(65...91).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
let = let.downcase unless Input.press?(Input::Key['Shift'])
@edit_window.add(let)
end}
(48...58).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
@edit_window.add(let)
end}
(186...192).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
@edit_window.add(let)
end}
(219...222).each{|i|
if Input.trigger?(i)
$game_system.se_play($data_system.decision_se)
let = Input::Key.index(i)
@edit_window.add(let)
end}
if Input.trigger?(Input::Key['Backspace'])
@edit_window.back
end
if Input.trigger?(Input::Key['Arrow Left'])
@edit_window.back
end
if Input.trigger?(Input::Key['Enter'])
# If name is empty
if @edit_window.name == ""
# Return to default name
@edit_window.restore_default
# If name is empty
if @edit_window.name == ""
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
return
end
# Change actor name
@actor.name = @edit_window.name
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
end
if Input.trigger?(Input::Key['Space'])
@actor.name = @edit_window.name
$game_system.se_play($data_system.decision_se)
@edit_window.add(" ")
end
name_input_update
end
end
That did indeed work! Thanks! I have a few other scripts I intend on doing this for and I looked at the new code for changes, is the only thing you added this:
@spriteset = Spriteset_Map.new
@over = Sprite.new
@over.bitmap = RPG::Cache.picture(Over_Picture_Graphic)
Along with the disposal of it and the ability to set the picture at the top of the script?
@spriteset.dispose
@over.dispose
Over_Picture_Graphic = 'Overlay'
I really appreciate your help with this. :)
You really should add one more line in there. If your overlay isn't transparent, you can make it transparent using:
@over.opacity = 120 # any # between 0 and 255
The picture is transparent but that definitely helps in the event I choose to use one that isn't already. :) Thanks!