XP 스크립트

#------------------------------------------------------------------------------
# ●임의 키 취득 스크립트  by tonbi
#
#  최신판의 정보나 버그 보고는 여기 → http://www.mc.ccnw.ne.jp/sarada/toshi/
#
# 이것을 사용한 것으로 ,이벤트의 스크립트로부터 ,
#
#  get_press(variable,key)      키가 눌러지고 있는가 취득
#  get_trigger(variable,key)    키가 누른 순간인지 취득
#  get_repeat(variable,key)      키가 눌러지고 있는가 취득(일정 시간마다)
#  get_press_all(variable)      상기의 일괄 취득 판
#  get_trigger_all(variable)    상기의 일괄 취득 판
#  get_repeat_all(variable)      상기의 일괄 취득 판
#
#  ※variable = 변수 ID  key = 키 ID 입니다.
#
# 이들이 실행할 수 있게 됩니다.
# 각각,지정한 넘버의 변수에 ,눌러지고 있다면 1,다르면0이 대입됩니다.
# 또,하단의 일괄 취득계는 ,지정한 변수의 넘버로부터 순서로,키 ID:0,1,2,···
# 토스 가와의 키 ID가 대입되고 갑니다.
#
# 조건 분기의 스크립트로 ,Key.press?(key) 라고(와) 넣으면 ,변수 사용하지 않고 분기될 수 있습니다.
# Key.trigger?(key),Key.repeat?(key) 모방할 수 있습니다.
#
# 키 ID 초기 설정은 ,(타이핑겜 기분?)
#
#      0 : 커서 키[←]
#      1 : 커서 키[↑]
#      2 : 커서 키[→]
#      3 : 커서 키[↓]
#      4 : [ENTER]
#      5 : [SPACE]
#      6 : [ESC]
#      7 : [BACKSPACE]
#      8 : [DELETE]
#      9 : [SHIFT]
#    10 : [CTRL]
#    11 : [ALT]
#    12 : [TAB]
#    13 : [CAPSLOCK]
# 14∼23 : [0]∼[9](메인 키보드)
# 24∼49 : [A]∼[Z]
# 50∼59 : [0]∼[9](텐 키)
#    60 : [,] (값)
#    61 : [.] (る)
#    62 : [/] (싹)
#    63 : [_] (로)
#    64 : [;] (れ)
#    65 : [:] (け)
#    66 : []] (무)
#    67 : [@] (")
#    68 : [[] (。)
#    69 : [-] (돛)
#    70 : [^] (에)
#    71 : []
#
# 아래쪽의 ★도장의 코멘트의 주변을 만지면,
# 필요하지 않는 키를 삭제하거나 ,늘리거나 를 할 수 있습니다.
# 키 코드의 지식이 필요합니다만 .

#------------------------------------------------------------------------------
# ●스크립트로부터 직접 다양한 키를 취득하고 싶은 쪽에
#
# 1.취득하고 싶은 장면의 Input.update의 뒤 정답에 「Key.update」를 추가
# 2.Key.trigger?(keyID)로서 취득한다.press?,repeat?그러나 가
#   덧붙여서 되돌아가고 값은 Input의 경우와 동일한.
#
#------------------------------------------------------------------------------ 
#==============================================================================
# ■ Key
# 키 취득을 관리한 클래스
#==============================================================================
module Key
  #----------------------------------------------------------
  # ● 오브젝트 초기화
  #----------------------------------------------------------
  def self.setup
    @keystatus=[]
    @getkeystate = Win32API.new("user32", "GetKeyState", "i", "i")
  end 
#----------------------------------------------------------
  # ● 갱신
  #----------------------------------------------------------
  def self.update
    for i in @keystatus
      num1 = false
      for j in i[1]
        num2=@getkeystate.call(j)
        if num2 != 1 and num2 != 0
          num1 = true
          break
        end
      end
      if num1 == false
        if i[0] > 0
          i[0] = i[0]*-1
        else
          i[0] = 0
        end
      else
        if i[0] > 0
          i[0] += 1
        else
          i[0] = 1
        end
      end     
    end
  end 
#----------------------------------------------------------
  # ● 키가 설정된 최대 삭
  #----------------------------------------------------------
  def self.max
    return @keystatus.size
  end
  #----------------------------------------------------------
  # ● 키 설정을 추가하다
  #    id    추가 선ID
  #    code  추가한 키 코드
  #----------------------------------------------------------
  def self.add_key(id,code)
    if @keystatus[id]=nil
      keystatus[id]=[]
    end
    @keystatus[id][0]=0
    @keystatus[id][1].push(code)
  end 
#----------------------------------------------------------
  # ● 키 설정을 삭제하다
  #    id    삭제 ID
  #----------------------------------------------------------
  def self.del_key(id)
    @keystatus[id]=nil
  end
  #----------------------------------------------------------
  # ● 키 설정을 일괄 변경하다
  #    val    키 설정의 배열,2 차원
  #    예 [[65],[66,67],[68]]
  #    졸참나무,  ID.0=A 키,ID.1=B와 C 키,ID.2=D 키와 설정
  #----------------------------------------------------------
  def self.add_key_set(val)
    @keystatus = []
    for i in 0...val.size
      if @keystatus[i]==nil
        @keystatus[i]=[]
      end
      @keystatus[i][0]=0
      @keystatus[i][1]=val[i]
    end
  end   
#----------------------------------------------------------
  # ● 키 설정을 일괄 삭제한다
  #----------------------------------------------------------
  def self.del_key_set
    @keystatus[i]=nil
  end
  #----------------------------------------------------------
  # ● 키 정보를 돌려 준다.Input와 동일한.
  #    id  키 ID
  #----------------------------------------------------------
  def self.press?(id)
    if @keystatus[id][0] > 0
      return true
    else
      return false
    end
  end
  def self.trigger?(id)
    if @keystatus[id][0] == 1
      return true
    else
      return false
    end
  end
  def self.repeat?(id)
    if @keystatus[id][0] <= 0
      return false
    else
      if @keystatus[id][0] % 5 == 1 and @keystatus[id][0] % 5 != 2
        return true
      else
        return false
      end
    end
  end
end 
#==============================================================================9
# ■ Scene_Title (키의 초기화 호출)
#==============================================================================
class Scene_Title
  alias main_tonbi12 main
  def main
    #----------------------------------------------------------------
    # ★여기를 만지면,키 ID와 키 코드의 설정을 바꾸는 일을 할 수 있습니다.
    # 1개의 ID에 여러 키 넣고 싶다면
    # 변수 val = [[37],[38],[39],[40],[13,32]]
    # 의과 같이2 차원 배열이 되도록 해 주십시오.
    # [13,32]과 같이 1개의 ID에 여러의 키를 설정할 수 있습니다.
    #
    set = [37,38,39,40,13,32,27,8,46,16,17,18,9,20,48,49,50,51,52,53,54,55,56,57,
    65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
    96,97,98,99,100,101,102,103,104,105,188,190,191,226,187,186,221,192,219,189,
    222,220]
    # 2 차원에 변환
    val = []
    for i in set
      val.push([i])
    end
    # set 가 아니고 val 에(로) 설정하십시오.set 은  1회용.
    #----------------------------------------------------------------
    Key.setup
    Key.add_key_set(val)
    Key.update
    main_tonbi12
  end
end 
#==============================================================================
# ■ Scene_Map (키의 갱신을 추가)
#==============================================================================
class Scene_Map
  alias update_tonbi12 update
  def update
    Key.update
    update_tonbi12
  end
end
#==============================================================================
# ■ Scene_battle (키의 갱신을 추가)
#==============================================================================
class Scene_Battle
  alias update_tonbi12 update
  def update
    Key.update
    update_tonbi12
  end
end 
#==============================================================================
# ■ Interpreter (이벤트>스크립트용 방법)
#==============================================================================
class Interpreter
  def get_press(variable,id)
    $game_variables[variable]= Key.press?(id) == true ? 1 : 0
  end
  def get_trigger(variable,id)
    $game_variables[variable]= Key.trigger?(id) == true ? 1 : 0
  end
  def get_repeat(variable,id)
    $game_variables[variable]= Key.repeat?(id) == true ? 1 : 0
  end
  def get_press_all(variable)
    for i in 0...Key.max
      $game_variables[variable+i]= Key.press?(i) == true ? 1 : 0
    end
  end
  def get_trigger_all(variable)
    for i in 0...Key.max
      $game_variables[variable+i]= Key.trigger?(i) == true ? 1 : 0
    end
  end
  def get_repeat_all(variable)
    for i in 0...Key.max
      $game_variables[variable+i]= Key.repeat?(i) == true ? 1 : 0
    end
  end
end 

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6202
1021 메시지 Taylor's Simple Message System 2000 Alkaid 2020.07.05 247
1020 제작도구 [XP/VX/VXA] Doodad's Editor by newold Alkaid 2020.07.12 388
1019 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 507
1018 전투 전투중에 장비들 교체하기 file 레이스89 2017.08.19 600
1017 기타 [All RGSS] FileTest (Unicode) file Cheapmunk 2014.12.29 614
1016 맵/타일 맵연결 스크립트 (데모첨부) file 게임애호가 2018.06.15 694
1015 기타 에어리어 설정 by RPG Advocate 백호 2009.02.22 710
1014 기타 Boat Script 백호 2009.02.21 729
1013 기타 Localization by ForeverZer0, KK20 습작 2013.04.26 738
1012 기타 Materia System file 백호 2009.02.21 749
1011 기타 Real-Time Day Night 3 백호 2009.02.22 751
1010 스킬 SG_Escape Only Skills by sandgolem (SDK호환) 백호 2009.02.22 753
1009 기타 killer님 요청하신 스크립트 두번째입니다. 나뚜루 2009.02.21 759
1008 기타 Letter by Letter Message Window by slipknot@rmxp.org (SDK호환) 1 file 백호 2009.02.22 760
1007 기타 Advanced Gold display by Dubealex 1 백호 2009.02.22 761
1006 스킬 Skill Requirements by SephirothSpawn (SDK호환) file 백호 2009.02.22 763
1005 기타 Sphere Grid System file 백호 2009.02.21 765
1004 기타 AMS-Advanced Message Script Edited by Dubleax 3 file 백호 2009.02.21 766
1003 스킬 SG_Skill Break by sandgolem (SDK호환) 백호 2009.02.22 772
1002 기타 Activation_system file 백호 2009.02.22 775
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