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
681 전투 KGC_RandomTarget(랜덤 타겟) 1 file 백호 2009.02.22 1495
680 전투 KGC_RankConception(대열 개념) file 백호 2009.02.22 1719
679 전투 KGC_RateDamage(비율 데미지) 3 file 백호 2009.02.22 1652
678 전투 KGC_DamageAlter(데미지 표시 개조) 8.24 14 file 백호 2009.02.22 3154
» 이름입력 Keyboard-Controlled Name Input Script by BlueScope@rmxp.org 1 file 백호 2009.02.22 1769
676 전투 액알 스크립트 24 백호 2009.02.22 6013
675 이동 및 탈것 KGC_RemoveElements file 백호 2009.02.22 1127
674 이동 및 탈것 KGC_SetAttackElement (공격속성설정) file 백호 2009.02.22 1407
673 스킬 KGC_SkillReflection (마법반사) 2 file 백호 2009.02.22 1476
672 스킬 KGC_SkillMessage (스킬사용메세지) 1 file 백호 2009.02.22 2081
671 전투 KGC_SPdamage (SP데미지) 3 file 백호 2009.02.22 1627
670 전투 KGC_SPdeath (SP전투불능) file 백호 2009.02.22 1527
669 전투 KGC_BonusGauge (보너스게이지) 3 file 백호 2009.02.22 2762
668 전투 KGC_SeparationCommand file 백호 2009.02.22 1706
667 기타 KGC_UsableWeapon file 백호 2009.02.22 1384
666 이동 및 탈것 KGC_Teleport file 백호 2009.02.22 1153
665 기타 Trailing Characters ver.1 by SephirothSpawn 6 file 백호 2009.02.22 1551
664 메뉴 Materia System 2.01v by SephirothSpawn 6 file 백호 2009.02.22 2100
663 기타 Golden_sun_intro v1 1 백호 2009.02.22 1262
662 전투 [신기술 체험] SRPG-Test 13 file 백호 2009.02.22 3536
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... 52 Next
/ 52