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
501 온라인 광넷[ 광땡 온라인 + 넷플레이 ] 62 - 하늘 - 2009.08.02 9003
500 기타 광물캐기 스크립트 1 file 백호 2009.02.22 1850
499 기타 광물캐기 시스템 v2 3 백호 2009.02.22 1775
498 이동 및 탈것 그래픽 변경 데쉬 3 file 백호 2009.02.22 2499
497 이동 및 탈것 그래픽의 크기로 좁은길은 못지나가게한다. 7 file 백호 2009.02.21 1816
496 이동 및 탈것 그림자 스크립트 13 file 백호 2009.02.22 3540
495 이동 및 탈것 금금님 요청 대쉬 1 백호 2009.02.22 1383
494 메뉴 기본메뉴 뜯어고친것. (스샷추가) 6 file 백호 2009.02.22 4314
493 기타 기본설정 강화ㄴ 1 백호 2009.02.21 1047
492 스킬 기술문서(스킬 습득 아이템) 7 ok하승헌 2010.02.18 2132
491 이동 및 탈것 기차스크립트 6 백호 2009.02.21 1757
490 전투 깔끔한형식의 Asan'Tear배틀시스탬 4 file 콩밥 2010.09.29 4124
489 넷플2.0(펌) 1 오동훈 2008.02.25 1543
488 넷플2.0(펌) 2번째 2 오동훈 2008.02.25 1498
487 넷플2.0(펌) 3번째 4 오동훈 2008.02.25 1303
486 HUD 넷플레이 HUD표시 2 file 백호 2009.02.22 3094
485 메뉴 넷플레이 업그레이드됀 메뉴 스크립트 4 백호 2009.02.22 2040
484 온라인 넷플레이1.7.0+abs5.5+한챗 49 쀍뛝쒧 2009.01.24 7286
483 기타 능력치 무한대 스크립트 (따로 넣을필요없음) 2 백호 2009.02.21 1027
482 능력치 올리기 스크립트 21 file 아방스 2007.11.09 3447
Board Pagination Prev 1 ... 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 ... 52 Next
/ 52