XP 스크립트

키보드로 이름을 입력하는 스크립트입니다. 사용을 위해서는 Cybersam님의 키보드 입력 모듈이 필요. 물론 한글지원은 안합니다.(할줄 아시는 분이라면 한글입력이나 2바이트 특수문자 입력도 되도록 손볼 수 있겠지만)





#==============================================================================
# Name Input Script-x v1.0
#--------------------------------------------------------------------------
# Script-x by BlueScope
#==============================================================================


class Window_NameEdit < Window_Base
#--------------------------------------------------------------------------
attr_reader :name
attr_reader :index
#--------------------------------------------------------------------------
def initialize(actor, max_char)
super(0, 128, 384, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.x = 320 - self.width / 2
@actor = actor
@name = actor.name
@max_char = max_char
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
@sprite_size = 0 # 0 for small sprites, 1 for bigger sprites
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
def restore_default
@name = @default_name
@index = @name.split(//).size
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
def add(character)
if @index < @max_char and character != ""
@name += character
@index += 1
refresh
update_cursor_rect
end
end
#--------------------------------------------------------------------------
def back
if @index > 0
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
#--------------------------------------------------------------------------
def refresh
self.contents.clear
name_array = @name.split(//)
for i in 0...@max_char
c = name_array[i]
if c == nil
c = "_"
end
x = 320 - 16 * 14 + i * 28
self.contents.draw_text(x, 49, 28, 32, c, 1)
end
if @sprite_size == 0
draw_actor_graphic(@actor, 320 - 16 * 14 - 40, 92)
else
draw_actor_graphic(@actor, 320 - 16 * 14 - 40, 112)
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < @max_char-1
self.cursor_rect.set(-16 + @max_char * 14 + @index * 28, 48, 28, 32)
else
self.cursor_rect.set(-16 + @max_char * 14 + (@max_char-1) * 28, 48, 28, 32)
end
end
#--------------------------------------------------------------------------
def update
super
update_cursor_rect
end
#--------------------------------------------------------------------------
end


class Window_NameHint < Window_Base
#--------------------------------------------------------------------------
def initialize
super(128, 288, 384, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width-40, 32, "Please enter Hero Name using the Keyboard", 1)
end
#--------------------------------------------------------------------------
end


class Scene_Name
#--------------------------------------------------------------------------
def main
@actor = $game_actors[$game_temp.name_actor_id]
@edit_window = Window_NameEdit.new(@actor, $game_temp.name_max_char)
if $game_temp.name_max_char > 8
@edit_window.x = 0
@edit_window.width = 640
else
@edit_window.x = 128
@edit_window.width = 384
end
@hint_window = Window_NameHint.new
Graphics.transition
loop do
Graphics.update
update
if $scene != self
break
end
end
Graphics.freeze
@edit_window.dispose
@hint_window.dispose
end
#--------------------------------------------------------------------------
def change_name
@actor.name = @edit_window.name
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
if @edit_window.index == $game_temp.name_max_char
$game_system.se_play($data_system.buzzer_se)
return
end
end
#--------------------------------------------------------------------------
def input_processing
if @edit_window.index == $game_temp.name_max_char
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.cursor_se)
end
end
#--------------------------------------------------------------------------
def update
@edit_window.update
if Input.triggered?(27) # [ESCAPE]
$game_system.se_play($data_system.decision_se)
@edit_window.restore_default
return
end
if Input.triggered?(8) # [BACKSPACE]
if @edit_window.index == 0
return
end
$game_system.se_play($data_system.cancel_se)
@edit_window.back
return
end
if Input.triggered?(13) # [ENTER]
if @edit_window.name == ""
@edit_window.restore_default
return
end
change_name
end
if Input.triggered?(65)
input_processing
if Input.pressed?(16)
@edit_window.add("A")
else
@edit_window.add("a")
end
end
if Input.triggered?(66)
input_processing
if Input.pressed?(16)
@edit_window.add("B")
else
@edit_window.add("b")
end
end
if Input.triggered?(67)
input_processing
if Input.pressed?(16)
@edit_window.add("C")
else
@edit_window.add("c")
end
end
if Input.triggered?(68)
input_processing
if Input.pressed?(16)
@edit_window.add("D")
else
@edit_window.add("d")
end
end
if Input.triggered?(69)
input_processing
if Input.pressed?(16)
@edit_window.add("E")
else
@edit_window.add("e")
end
end
if Input.triggered?(70)
input_processing
if Input.pressed?(16)
@edit_window.add("F")
else
@edit_window.add("f")
end
end
if Input.triggered?(71)
input_processing
if Input.pressed?(16)
@edit_window.add("G")
else
@edit_window.add("g")
end
end
if Input.triggered?(72)
input_processing
if Input.pressed?(16)
@edit_window.add("H")
else
@edit_window.add("h")
end
end
if Input.triggered?(73)
input_processing
if Input.pressed?(16)
@edit_window.add("I")
else
@edit_window.add("i")
end
end
if Input.triggered?(74)
input_processing
if Input.pressed?(16)
@edit_window.add("J")
else
@edit_window.add("j")
end
end
if Input.triggered?(75)
input_processing
if Input.pressed?(16)
@edit_window.add("K")
else
@edit_window.add("k")
end
end
if Input.triggered?(76)
input_processing
if Input.pressed?(16)
@edit_window.add("L")
else
@edit_window.add("l")
end
end
if Input.triggered?(77)
input_processing
if Input.pressed?(16)
@edit_window.add("M")
else
@edit_window.add("m")
end
end
if Input.triggered?(78)
input_processing
if Input.pressed?(16)
@edit_window.add("N")
else
@edit_window.add("n")
end
end
if Input.triggered?(79)
input_processing
if Input.pressed?(16)
@edit_window.add("O")
else
@edit_window.add("o")
end
end
if Input.triggered?(80)
input_processing
if Input.pressed?(16)
@edit_window.add("P")
else
@edit_window.add("p")
end
end
if Input.triggered?(81)
input_processing
if Input.pressed?(16)
@edit_window.add("Q")
else
@edit_window.add("q")
end
end
if Input.triggered?(82)
input_processing
if Input.pressed?(16)
@edit_window.add("R")
else
@edit_window.add("r")
end
end
if Input.triggered?(83)
input_processing
if Input.pressed?(16)
@edit_window.add("S")
else
@edit_window.add("s")
end
end
if Input.triggered?(84)
input_processing
if Input.pressed?(16)
@edit_window.add("T")
else
@edit_window.add("t")
end
end
if Input.triggered?(85)
input_processing
if Input.pressed?(16)
@edit_window.add("U")
else
@edit_window.add("u")
end
end
if Input.triggered?(86)
input_processing
if Input.pressed?(16)
@edit_window.add("V")
else
@edit_window.add("v")
end
end
if Input.triggered?(87)
input_processing
if Input.pressed?(16)
@edit_window.add("W")
else
@edit_window.add("w")
end
end
if Input.triggered?(88)
input_processing
if Input.pressed?(16)
@edit_window.add("X")
else
@edit_window.add("x")
end
end
if Input.triggered?(89)
input_processing
if Input.pressed?(16)
@edit_window.add("Y")
else
@edit_window.add("y")
end
end
if Input.triggered?(90)
input_processing
if Input.pressed?(16)
@edit_window.add("Z")
else
@edit_window.add("z")
end
end
if Input.triggered?(32) # [SPACE]
input_processing
@edit_window.add(" ")
end
end
#--------------------------------------------------------------------------
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
881 기타 Hero Databass 4 file 백호 2009.02.22 797
880 기타 House Decoration System 1.6 by MephistoX (SDK 2.x, MACL 2.x 필요) 1 file Alkaid 2010.09.02 1489
879 HUD HP/SP 상태를 표시해주는 간이 윈도우 3 file 백호 2009.02.21 3067
878 HUD HP과 SP 바 19 Man... 2008.11.04 4534
877 HUD HUD Menu 1.2 by Raziel 6 file 백호 2009.02.22 2390
876 HUD HUD Menu 2.0 by Raziel 3 Alkaid 2010.09.07 2031
875 기타 ID띄우기 스크립트(新) 3 백호 2009.02.22 1280
874 저장 Improved Save by gerrtunk 2 file Alkaid 2010.10.13 1983
873 변수/스위치 Initial Switches and Variables by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1296
872 저장 Inn & Save Point System by SephirothSpawn (SDK호환) 1 file 백호 2009.02.22 810
871 기타 Introduction & optional Splash 2.1 by SephirothSpawn (SDK호환) 1 백호 2009.02.22 860
870 아이템 Item Acquired Window by SiliconHero@rmxp.net 백호 2009.02.22 1096
869 키입력 Key Simulator by Fantasist 4 습작 2013.05.01 1143
868 키입력 Keyboard Input Module v5 by Near Fantastica (SDK호환) 백호 2009.02.22 1075
» 이름입력 Keyboard-Controlled Name Input Script by BlueScope@rmxp.org 1 file 백호 2009.02.22 1769
866 기타 KGC - RMXP 스크립트 개발용 프로젝트 1.01 4 file 백호 2009.02.22 1515
865 스킬 KGC - 도주스킬 스크립트 백호 2009.02.22 1193
864 기타 KGC - 입수 경험치&금 증가 스크립트 백호 2009.02.22 1299
863 기타 KGC 디버거 (최신 올라온 것에 비해 성능은 딸리지만) file 백호 2009.02.22 929
862 메뉴 KGC 메뉴화면 개조 스크립트 번역 3 file 백호 2009.02.22 1940
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52