XP 스크립트

현재 제가 퀘스트 창으로 쓰고 있는 스크립트입니다.
일루젼님께서 사용법이 필요하시다길래 올립니다.

사용법::
실행 스크립트는 $scene = Scene_Outline.new 입니다.
그러나 그냥 실행만 시켜서는 개요창에 제목이 표시되지 않습니다
그래서 따로 $game_system.outline_enable[0] = true를 스크립트로 실행해주셔야합니다.
그럼 첫번째 글을 읽을 수 있게 되고 $game_system.outline_enable[0] = true에서 [0]의 숫자를
바꿔주시면 다른 글도 표시됩니다.
단 첫번째 글의 번호가 0부터 시작합니다 두번째 글은 1, 세번째는 2가 되는거죠.
필요하시다면 예제도 올리겠습니다.

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆개요 - KGC_Outline◆
#_/----------------------------------------------------------------------------
#_/  개요를 열람하는 기능을 추가합니다.
#_/  Provides the function to show "Outline".
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ 커스터마이즈 항목 - Customize ★
#==============================================================================

module KGC
  # ◆개요 화면 배경 투과
  OLINE_BACK_TRANSPARENT = true
  # ◆스크롤 속도【단위:px】
  OLINE_SCROLL_SPEED = 8
  # ◆일련 번호를 묘화
  OLINE_SERIAL_NUMBER = false
  # ◆일련 번호의 자리수
  OLINE_SERIAL_NUMBER_DIGITS = 3
  # ◆무효인 개요는 표시하지 않는
  OLINE_HIDE_DISABLED = true
  # ◆완료 기호
  OLINE_COMPLETION_SYMBOL = "★"
  # ◆미완 기호
  OLINE_INCOMPLETION_SYMBOL = " "

  # ◆개요 내용
  #  ≪["타이틀", ["본문", ...]], ...≫
  #  본문은 , 배열의 각 요소가 1행에 상당.
  #    **** 제어 커멘드 ****
  #  \V[n]  : 변수 ID:n
  #  \G    : 소지금
  #  \N[n]  : ID:n 의 엑터명
  #  \EN[n] : ID:n 의 에너미명
  #  \IN[n] : ID:n 의 아이템명
  #  \WN[n] : ID:n 의 무기명
  #  \AN[n] : ID:n 의 방어용 기구명
  OLINE_CONTENTS = [
    ["(Main) '루스텐'촌장과의 만남",  # 제목
      ["[대지의 마을: 로렌] 중앙에 위치한 '루스텐' 촌장의 집으로",
      " 가서 '루스텐' 촌장에게 레뮤리아 대륙의 이야기를 들으라."]] #  내용
  ]  # -- Don't delete this line! --
end

#### OLINE_BACK_TRANSPARENT
### Makes the background of "Outline" transparency.

#### OLINE_SCROLL_SPEED
### Scroll speed. {Unit : pixel}

#### OLINE_SERIAL_NUMBER
### Draws the serial number.

#### OLINE_SERIAL_NUMBER_DIGITS
### Digits of the serial number.

#### OLINE_HIDE_DISABLED
### Hides disabled "Outline".

#### OLINE_COMPLETION_SYMBOL
### Completion symbol.

#### OLINE_INCOMPLETION_SYMBOL
### Incompletion symbol.


#### OLINE_CONTENTS
### Contents of "Outline".
#  << ["Title", ["Body", ...]], ... >>
#  In the "Body", each element of the array corresponds to one line.
#    **** Control statement ****
#  \V[n]  : Variable of ID:n
#  \G    : Money
#  \N[n]  : Actor's name of ID:n
#  \EN[n] : Enemies' name of ID:n
#  \IN[n] : Item's name of ID:n
#  \WN[n] : Weapon's name of ID:n
#  \AN[n] : Armor's name of ID:n

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["Outline"] = true

#--------------------------------------------------------------------------
# ● 개요 화면 호출
#--------------------------------------------------------------------------
def call_outline
  # 플레이어의 자세를 교정
  $game_player.straighten
  # 개요 화면으로 전환하고
  $scene = Scene_Outline.new(true)
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_System
#==============================================================================

class Game_System
  attr_accessor :outline_enable, :outline_complete
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias initialize_KGC_Outline initialize
  def initialize
    initialize_KGC_Outline

    @outline_enable = []
    @outline_complete = []
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Module - KGC_Outline
#------------------------------------------------------------------------------
#  개요 처리에 사용하는 메소드입니다.
#==============================================================================

module KGC_Outline
  #--------------------------------------------------------------------------
  # ● 제어 커멘드 처리
  #    string : 처리 대상 캐릭터 라인
  #--------------------------------------------------------------------------
  def self.apply_control_statement(string)
    buf = string.dup
    buf.gsub!(/\V[(d+)]/i) { $game_variables[$1.to_i].to_s }
    buf.gsub!(/\G/i) { $game_party.gold.to_s }
    buf.gsub!(/\N[(d+)]/i) { $game_actors[$1.to_i].name }
    buf.gsub!(/\EN[(d+)]/i) { $data_enemies[$1.to_i].name }
    buf.gsub!(/\IN[(d+)]/i) { $data_items[$1.to_i].name }
    buf.gsub!(/\WN[(d+)]/i) { $data_weapons[$1.to_i].name }
    buf.gsub!(/\AN[(d+)]/i) { $data_armors[$1.to_i].name }
    return buf
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_OutlineList
#------------------------------------------------------------------------------
#  개요 일람을 표시하는 윈도우입니다.
#==============================================================================

class Window_OutlineList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(80, 40, 480, 400)
    self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
    self.index = 0
    self.z = 1000
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 선택 개요 내용
  #--------------------------------------------------------------------------
  def outline
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.dispose if self.contents != nil
    @data = []
    # 리스트 작성
    $game_system.outline_enable = [] if $game_system.outline_enable == nil
    $game_system.outline_complete = [] if $game_system.outline_complete == nil
    KGC::OLINE_CONTENTS.each_with_index { |oline, i|
      if $game_system.outline_enable[i]
        buf = oline
        buf << i
        @data << buf
      elsif !KGC::OLINE_HIDE_DISABLED
        @data << ["- - - - - - - -", nil, i]
      end
    }
    # 리스트 묘화
    @item_max = [@data.size, 1].max
    self.contents = Bitmap.new(self.width - 32, 32 * @item_max)
    if @data.size == 0
      @data << ["", nil, 0]
    else
      @data.each_index { |i| draw_item(i) }
    end
  end
  #--------------------------------------------------------------------------
  # ● 항목 묘화
  #--------------------------------------------------------------------------
  def draw_item(index)
    self.contents.fill_rect(0, 32 * index, self.width - 32, 32, Color.new(0, 0, 0, 0))
    # 타이틀 생성
    text = ($game_system.outline_complete[index] ?
      KGC::OLINE_COMPLETION_SYMBOL : KGC::OLINE_INCOMPLETION_SYMBOL) +
      (KGC::OLINE_SERIAL_NUMBER ? sprintf("%0*d : ",
      KGC::OLINE_SERIAL_NUMBER_DIGITS, @data[index][2] + 1) : "") +
      KGC_Outline::apply_control_statement(@data[index][0])
    # 묘화색 설정
    self.contents.font.color = $game_system.outline_enable[index] ?
      normal_color : disabled_color
    self.contents.draw_text(0, 32 * index, self.width - 32, 32, text)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_OutlineTitle
#------------------------------------------------------------------------------
#  개요의 제목을 표시하는 윈도우입니다.
#==============================================================================

class Window_OutlineTitle < Window_Base
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #    text  : 표시하는 캐릭터 라인
  #--------------------------------------------------------------------------
  def refresh(text)
    self.contents.clear
    text2 = KGC_Outline::apply_control_statement(text)
    self.contents.draw_text(0, 0, self.width - 32, 32, text2, 1)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Outline
#------------------------------------------------------------------------------
#  개요(의 내용)을 표시하는 윈도우입니다.
#==============================================================================

class Window_Outline < Window_Base
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 416)
    self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #    oline : 개요
  #--------------------------------------------------------------------------
  def refresh(oline = nil)
    self.oy = 0
    self.contents.dispose if self.contents != nil
    return if oline == nil
    # 본문을 묘화
    self.contents = Bitmap.new(self.width - 32, 32 * oline.size)
    oline.each_with_index { |l ,i|
      next if l == nil
      text = KGC_Outline::apply_control_statement(l)
      self.contents.draw_text(0, i * 32, self.width - 32, 32, text)
    }
  end
  #--------------------------------------------------------------------------
  # ● 갱신
  #--------------------------------------------------------------------------
  def update
    super
    # 스크롤
    if self.active
      scroll_max = [self.contents.height - (self.height - 32), 0].max
      if Input.press?(Input::UP)
        self.oy = [self.oy - KGC::OLINE_SCROLL_SPEED, 0].max
      elsif Input.press?(Input::DOWN)
        self.oy = [self.oy + KGC::OLINE_SCROLL_SPEED, scroll_max].min
      elsif Input.repeat?(Input::L)
        self.oy = [self.oy - (self.height - 32), 0].max
      elsif Input.repeat?(Input::R)
        self.oy = [self.oy + (self.height - 32), scroll_max].min
      end
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Outline
#------------------------------------------------------------------------------
#  개요 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

class Scene_Outline
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #    map_call : 맵으로부터의 호출 플래그
  #--------------------------------------------------------------------------
  def initialize(map_call = false)
    @map_call = map_call
  end
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  def main
    # 스프라이트 세트를 작성
    @spriteset = Spriteset_Map.new if KGC::OLINE_BACK_TRANSPARENT
    # 윈도우를 작성
    @list_window = Window_OutlineList.new
    @title_window = Window_OutlineTitle.new
    @content_window = Window_Outline.new
    # 트란지션 실행
    Graphics.transition
    # 메인 루프
    loop {
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    }
    # 트란지션 준비
    Graphics.freeze
    # 윈도우를 해방
    @list_window.dispose
    @title_window.dispose
    @content_window.dispose
    @spriteset.dispose if KGC::OLINE_BACK_TRANSPARENT
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 윈도우 갱신
    @list_window.update
    @title_window.update
    @content_window.update
    # 액티브 윈도우 조작
    if @list_window.active
      update_list
    elsif @content_window.active
      update_content
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (리스트)
  #--------------------------------------------------------------------------
  def update_list
    # B 버튼이 밀렸을 경우
    if Input.trigger?(Input::B)
      # 캔슬 SE 을 연주
      $game_system.se_play($data_system.cancel_se)
      if @map_call
        # 맵 화면으로 전환하고
        $scene = Scene_Map.new
      else
        # 메뉴 화면으로 전환하고
        if $imported["MenuAlter"]
          index = KGC::MA_COMMANDS.index(12)
          if index != nil
            $scene = Scene_Menu.new(index)
          else
            $scene = Scene_Menu.new
          end
        else
          $scene = Scene_Menu.new
        end
      end
      return
    end
    # C 버튼이 밀렸을 경우
    if Input.trigger?(Input::C)
      outline = @list_window.outline
      # 열람할 수 없는 경우
      if outline[1] == nil
        # 버저 SE 를 연주
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 결정 SE 을 연주
      $game_system.se_play($data_system.decision_se)
      # 개요를 갱신
      @title_window.refresh(outline[0])
      @content_window.refresh(outline[1])
      # 윈도우 변환
      @list_window.active = false
      @list_window.z = 0
      @content_window.active = true
      @content_window.z = 1000
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (본문)
  #--------------------------------------------------------------------------
  def update_content
    # B 버튼이 밀렸을 경우
    if Input.trigger?(Input::B)
      # 캔슬 SE 을 연주
      $game_system.se_play($data_system.cancel_se)
      # 윈도우 변환
      @list_window.active = true
      @list_window.z = 1000
      @content_window.active = false
      @content_window.z = 0
      return
    end
  end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '2'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6159
1021 액터 (killer님 요청)자동회복 스크립트 3 나뚜루 2009.02.22 2573
1020 기타 (T-RPG) 데미지 표시 시의 폰트를 설정 백호 2009.02.22 1348
1019 메뉴 1-Scene CMS 1.03 by LegACy@rmxp.org (SDK호환) file 백호 2009.02.22 871
1018 메뉴 1-Scene CMS 1.1 by LegACy@rmxp.org (SDK호환) file 백호 2009.02.22 953
1017 메뉴 1-Scene CMS 1.16 by LegACy (SDK호환) 3 file 백호 2009.02.22 1564
1016 메시지 1문자식 표시랑 따랑소리 나는 스크립트 8 백호 2009.02.22 2305
1015 메뉴 1인 캐릭터 메뉴 스크립트 27 file - 하늘 - 2009.08.06 4790
1014 메뉴 1인용 메뉴 스크립트 6 WMN 2008.03.17 2450
1013 메뉴 3D Menu Script 7 현문 2010.10.06 4077
1012 기타 3d 렌더링스크립트 어렵게 찾음 9 라구나 2011.03.05 3610
1011 이동 및 탈것 3D 캐릭 스크립트 7 백호 2009.02.22 3443
1010 기타 3D스크립트 48 file ok하승헌 2010.02.18 3808
1009 기타 4방향 마우스 스크립트 12 file 아방스 2009.02.28 2664
1008 기타 8방향 마우스 스크립트 10 file 아방스 2009.02.28 4063
1007 이동 및 탈것 8방향 스크립트 12 file 백호 2009.02.21 2412
1006 이동 및 탈것 8방향 이동 & 대쉬 스크립트 5 백호 2009.02.21 1703
1005 이동 및 탈것 8방향움직임과 8방향 캐릭터칩 호환 2 file 백호 2009.02.21 2274
1004 이동 및 탈것 8방향이동 9 캉쿤 2011.09.19 2529
1003 이동 및 탈것 8방향이동, Shift키 누르면 대쉬 63 WinHouse 2010.06.12 4025
1002 전투 A-battle 수정 file 백호 2009.02.21 1155
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