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 전투 전투 특수효과 ActionEX 스크립트 1 file 백호 2009.02.21 1659
880 전투 전투 카메라 스크립트 5 file 백호 2009.02.21 2454
879 기타 전투 승리 BGM+페이드아웃 스크립트 1 file 백호 2009.02.21 1159
878 전투 전투 속도 조정 스크립트 2 file 백호 2009.02.21 1261
877 전투 전투 난이도 설정 스크립트 file 백호 2009.02.21 1441
876 전투 전투 관련 횟수 취득 스크립트 백호 2009.02.21 783
875 전투 전투 결과 화면 개조 스크립트 10 file 백호 2009.02.21 2496
874 전체화면 스크립트[해상도 스크립트랑 중복사용 불가] 24 file - 하늘 - 2009.08.06 3975
873 키입력 전체키 입력 스크립트 v4 by Cybersam 5 file 백호 2009.02.22 1947
872 장비 전체키 이용을 위한 장비창 스크립트 백호 2009.02.21 1234
871 키입력 전체 키 사용 스크립트 1 백호 2009.02.21 1423
870 전투 적의 여러차례 행동 스크립트 1 백호 2009.02.22 1320
869 HUD 적의 남은 HP만큼 적의 이름 색깔 변하는 스크립트 6 file 백호 2009.02.21 2337
868 전투 적 한계 HP수치 돌파 스크립트 ■ RPGモジュール 3 쉴더 2009.02.21 1783
867 저상 슬롯 15개 스크립트 9 WMN 2008.03.18 1496
866 장비 장비품개조 - KGC_AlterEquipment (8/12일자) 2 file 백호 2009.02.22 1694
865 장비 장비창을 다른거로 바꾸기 [헬악이님 제공] 10 file 아방스 2007.11.09 3049
864 장비 장비창업그레이드 ps인간 2009.01.23 2478
863 장비 장비창 개조 스크립트 from Harts Horn 7 백호 2009.02.22 1768
862 장비 장비착용시 올스탯 표시 2 file 백호 2009.02.21 1664
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