CNS (Custom Name System) - Samo the thief - 02-12-2007
CNS (Custom Name System)
by samo
Feb 12 2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
CODE
Code:
#==============================================================================
#
# CNS (Custom Name System) by Samo, the thief
# v1.0
#
#-Place this script above Main
#-Before calling a Input Name, put this in a new call script:
#
# $gender = "GENDER"
#
# GENDER must be in quotes and can be MALE or FEMALE.
#
# ###################
# #######################----------------############################
# #~~~~~~~~~~~~~~~~~~~~~#..::OPTIONAL::..#~~~~~~~~~~~~~~~~~~~~~~~~~~#
# #######################----------------############################
# ###################
# Search the lines @MALE_NAME and @FEMALE_NAME and you will see too many names.
# Put the names you want there. The script will take at random one of those names.
#
#
#
# <FEATURES>
#
#<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
#
# -Animations of Windows and map background.
# -Random Name Feature when pressing SHIFT. a random name of the variables
# @FEMALE_NAME and @MALE_NAME will be taken. If that name has more characters
# than the max, another name would be picked.
# -More nice Name Input.
#
#
#
#<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
#
#
# Enjoy it! Give me the creditif you use it!
#
# Samo, the thief.
#------------------------------------------------------------------------------
def generate_random_name
loop do
if $gender == "MALE"
number = rand(@MALE_NAME.size)
@new_name = @MALE_NAME[number]
else
number = rand(@FEMALE_NAME.size)
@new_name = @FEMALE_NAME[number]
end
if @new_name.size < $game_temp.name_max_char
@edit_window.name = @new_name
@edit_window.refresh
@edit_window.index = @new_name.size
@edit_window.update_cursor_rect
break
end
end
end
# ------------------------------------
def update
if @help_window.y != 0
@help_window.y += 10
end
if @edit_window.y != 0
@edit_window.y += 16
end
if @input_window.y != 128
@input_window.y -= 16
end
$game_map.update
@edit_window.update
@input_window.update
@help_window.update
if Input.trigger?(Input::SHIFT)
$game_system.se_play($data_system.cursor_se)
generate_random_name
end
if Input.repeat?(Input::B)
if @edit_window.index == 0
return
end
$game_system.se_play($data_system.cancel_se)
@edit_window.back
return
end
if Input.trigger?(Input::C)
if @input_window.character == nil
if @edit_window.name == ""
@edit_window.restore_default
if @edit_window.name == ""
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
return
end
@actor.name = @edit_window.name
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
return
end
if @edit_window.index == $game_temp.name_max_char
$game_system.se_play($data_system.buzzer_se)
return
end
if @input_window.character == ""
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@edit_window.add(@input_window.character)
return
end
end
end
def refresh
self.contents.clear
for i in 0..179
x = 4 + i / 5 / 9 * 152 + i % 5 * 28
y = i / 5 % 9 * 32
self.contents.draw_text(x, y, 28, 32, CHARACTER_TABLE[i], 1)
end
self.contents.draw_text(544, 9 * 32, 64, 32, "OK", 1)
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index >= 180
self.cursor_rect.set(544, 9 * 32, 64, 32)
else
x = 4 + @index / 5 / 9 * 152 + @index % 5 * 28
y = @index / 5 % 9 * 32
self.cursor_rect.set(x, y, 28, 32)
end
end
#--------------------------------------------------------------------------
def update
super
if @index >= 180
if Input.trigger?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index -= 180
end
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index -= 180 - 40
end
else
if Input.repeat?(Input::RIGHT)
if Input.trigger?(Input::RIGHT) or
@index / 45 < 3 or @index % 5 < 4
$game_system.se_play($data_system.cursor_se)
if @index % 5 < 4
@index += 1
else
@index += 45 - 4
end
if @index >= 180
@index -= 180
end
end
end
if Input.repeat?(Input::LEFT)
if Input.trigger?(Input::LEFT) or
@index / 45 > 0 or @index % 5 > 0
$game_system.se_play($data_system.cursor_se)
if @index % 5 > 0
@index -= 1
else
@index -= 45 - 4
end
if @index < 0
@index += 180
end
end
end
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
if @index % 45 < 40
@index += 5
else
@index += 180 - 40
end
end
if Input.repeat?(Input::UP)
if Input.trigger?(Input::UP) or @index % 45 >= 5
$game_system.se_play($data_system.cursor_se)
if @index % 45 >= 5
@index -= 5
else
@index += 180
end
end
end
if Input.repeat?(Input::L) or Input.repeat?(Input::R)
$game_system.se_play($data_system.cursor_se)
if @index / 45 < 2
@index += 90
else
@index -= 90
end
end
end
update_cursor_rect
end
end
#==============================================================================
#
# CNS (Custom Name System) by Samo, the thief
# v1.0
#
#-Place this script above Main
#-Before calling a Input Name, put this in a new call script:
#
# $gender = "GENDER"
#
# GENDER must be in quotes and can be MALE or FEMALE.
#
# ###################
# #######################----------------############################
# #~~~~~~~~~~~~~~~~~~~~~#..::OPTIONAL::..#~~~~~~~~~~~~~~~~~~~~~~~~~~#
# #######################----------------############################
# ###################
# Search the lines @MALE_NAME and @FEMALE_NAME and you will see too many names.
# Put the names you want there. The script will take at random one of those names.
#
#
#
# <FEATURES>
#
#
# -Animations of Windows and map background.
# -Random Name Feature when pressing SHIFT. a random name of the variables
# @FEMALE_NAME and @MALE_NAME will be taken. If that name has more characters
# than the max, another name would be picked.
# -More nice Name Input.
#
#
# Enjoy it! Give me the creditif you use it!
#
# Samo, the thief.
#------------------------------------------------------------------------------
Enjoy the script and give me the credit. Replies please! What do you think of this?