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 전투 펫 시스템(ABS 3.4v포함) 23 file 백호 2009.02.22 3458
880 메뉴 자작 메뉴 스크립트들(L's Simple CMS and menu scenes) (SDK 호환?) 10 Alkaid 2010.09.02 3455
879 미니맵 스크립트 이용하여 미니맵 만들기 16 file 아방스 2007.11.09 3452
878 전투 CTB by Charlie Fleed 3.2 - FF10 스타일의 전투 시스템 7 Alkaid 2010.10.14 3448
877 능력치 올리기 스크립트 21 file 아방스 2007.11.09 3447
876 이동 및 탈것 3D 캐릭 스크립트 7 백호 2009.02.22 3443
875 미니맵 던전용 미니맵 스크립트[사용법 추가] 16 file 배포 2008.03.02 3443
874 HUD 맵이름표시 ps인간 2009.01.23 3441
873 미니맵 미니맵(중복률100%? 한글번역!) 17 백호 2009.02.21 3423
872 메시지 ◆메세지 윈도우 개조 -KGC_MessageAlter◆ 3 백호 2009.02.22 3422
871 기타 FPLE 2 - First Person Labyrinth Explorer by MGC 1 Alkaid 2012.01.17 3415
870 이동 및 탈것 멈췄을때 행동. 17 file Bera 2010.10.17 3408
869 메뉴 스탯올리기 시스템 (액알가능) 27 file 백호 2009.02.22 3404
868 기타 한글 입력 스크립트 입니다. (vx -> xp) 23 file 헤르코스 2009.04.18 3397
867 메뉴 [자작]명성치 사용 스크립트 16 Rainsy 2009.03.22 3390
866 전투 ATB전투 5 백호 2009.02.22 3369
865 파티 [최강전사님 제공] 파티가 따라오게 하는 스크립트 24 file 아방스 2007.11.09 3365
864 아이템 아이템 인벤토리 2 file 백호 2009.02.22 3355
863 이동 및 탈것 최단경로 찾아가기 - (마우스 사용) 18 file 허걱 2009.02.02 3351
862 스탯 포인트 시스템 3차수정 ( ' 백호 ' 님이 올리신 자료 수정.) 26 카이어덱터 2010.01.04 3346
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