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 6203
254 기타 액알 30 지존!! 2010.07.26 5100
253 기타 쓸만한스크립트61개포함 28 file 궭크이 2012.01.09 4299
252 기타 XP 각종 스크립트입니다. 36 file 쿠도신이치 2009.04.26 4273
251 기타 말풍선 스크립트. 62 file 『동그라미』♥ 2010.02.04 4254
250 기타 [게이지바]게이지바 스크립트 2.5 (실용적?) 17 file 코아 코스튬 2010.12.05 4220
249 기타 [Game_Actor] 게이지바 표시 스크립트 8 file - 하늘 - 2009.08.03 4174
248 기타 대화창에 얼굴그래픽 스크립트 25 file 백호 2009.02.21 4137
247 기타 캐릭터 소개 화면 22 file 독도2005 2008.10.05 4100
246 기타 8방향 마우스 스크립트 10 file 아방스 2009.02.28 4063
245 기타 몬스터 게이지바 턴알 22 file 키라링 2009.01.22 4017
244 기타 [자작]데미지표시 19 file JACKY 2012.02.15 3845
243 기타 3D스크립트 48 file ok하승헌 2010.02.18 3809
242 기타 [게이지바]HelloCoaVer4.0 업데이트 속도 변경 [오랜만의 업데이트] 30 file 코아 코스튬 2011.04.02 3792
241 기타 만화형태 말칸 스크립트 28 file 백호 2009.02.22 3707
240 기타 [신기술 체험] RPGXP 3D 9 file 백호 2009.02.22 3637
239 기타 3d 렌더링스크립트 어렵게 찾음 9 라구나 2011.03.05 3610
238 기타 FPLE 2 - First Person Labyrinth Explorer by MGC 1 Alkaid 2012.01.17 3415
237 기타 한글 입력 스크립트 입니다. (vx -> xp) 23 file 헤르코스 2009.04.18 3401
236 기타 레벨9999만들기스크립 23 해파리 2009.04.10 3346
235 기타 횡스크롤 스크립트 한국말 번역. 15 file 백호 2009.02.21 3316
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13