VX 스크립트

예를 들면 이런겁니다.

스킬의 설명에 "찌질!"을 100번 적어놓으면 전부 표시를 못하는 것이 기존의 VX였죠?

하지만 이제 걱정 끄읕!

스킬의 설명을 아무리 길게 적어도, 문장을 스크롤 해서 보여주기 때문에, 아주 편리하죠!

MP3에 보면 노래 이름이 앞으로 당겨지면서 계속 반복해서 나타나는 거랑 비슷한 겁니다. Advanced Help Configuration Module에서

스크롤 타입을 정할 수 있습니다.

어쨋든! 유용하게 쓰시길 바라고,

아래부터 복사..

#==============================================================================
# ** Advanced Help
#------------------------------------------------------------------------------
#  © Dargor, 2008-2009
#  17/02/09
#  Version 1.3
#------------------------------------------------------------------------------
#  VERSION HISTORY:
#   - 1.0 (02/11/08), Initial release
#   - 1.1 (03/11/08), Now compatible with the Takentai CBS
#   - 1.2 (17/02/09), Text can now scroll vertically using Scroll Mode 2
#   - 1.3 (17/02/09), Now works with text alignment
#------------------------------------------------------------------------------
#  INSTRUCTIONS:
#   - Place this script above Main
#   - Edit the constants in the Advanced Help module and enjoy!
#------------------------------------------------------------------------------
#  Notes
#   This script handles the following message codes.
#   - Color      : C[n]
#   - Variable   : V[n]
#   - Actor Name : N[n]
#   - New Line   : L
#==============================================================================
 
#==============================================================================
# ** Advanced Help Configuration Module
#==============================================================================
 
module Advanced_Help
  # The delay (in frames) before the text starts to scroll
  Scroll_Wait = 120
  # Scroll Mode
  # 0 : Scrolls to left and loops
  # 1 : Scrolls to left and goes back to its origin.
  # 2 : Scrolls down and goes back to its origin when using 2+ lines.
  Scroll_Mode = 0
  # Letter by letter
  Letter_By_Letter = true
end
 
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================
 
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias dargor_vx_help_scroll_update update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 544, WLH + 32)
    @scroll_wait = 0
    @scroll_mode = Advanced_Help::Scroll_Mode
    @temp_wait = 0
    @text = ''
    @new_text = ''
    @last_text = ''
    @contents_x = 0
    @line_y = 0
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : character string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(text, align=0)
    @last_text = @text
    if text != @text or align != @align
      self.ox = 0
      self.oy = 0
      self.contents.clear
      @scroll_wait = Advanced_Help::Scroll_Wait
      @text = text
      @new_text = text.dup
      @temp_text = @new_text.dup
      @align = align
      @max_line_y = 0
      @contents_x = 0
      if align == 1
        @contents_x = ((self.width - get_contents_width) / 2) - 16
      elsif align == 2
        @contents_x = (self.width - get_contents_width) - 32
      end
      if @scroll_mode == 2
        ch = (get_contents_height + 1) * WLH
        self.contents = Bitmap.new(self.width - 32, ch)
      else
        cw = [contents.text_size(text).width + 16, 32].max
        self.contents = Bitmap.new(cw, WLH)
      end
      convert_special_characters
    end
  end
  #--------------------------------------------------------------------------
  # * Get the number of lines in the text
  #--------------------------------------------------------------------------
  def get_contents_height
    @temp_text.gsub!(/L/)              { @max_line_y += 1 }
    return @max_line_y
  end
  #--------------------------------------------------------------------------
  # * Get the width of the text
  #--------------------------------------------------------------------------
  def get_contents_width
    @temp_text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
    @temp_text.gsub!(/N[([0-9]+)]/i) { $game_actors[$1.to_i].name }
    @temp_text.gsub!(/C[([0-9]+)]/i) { "" }
    @temp_text.gsub!(/L/)              { "" }
    return self.contents.text_size(@temp_text).width
  end
  #--------------------------------------------------------------------------
  # * Convert Special Characters
  #--------------------------------------------------------------------------
  def convert_special_characters
    @new_text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
    @new_text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
    @new_text.gsub!(/N[([0-9]+)]/i) { $game_actors[$1.to_i].name }
    @new_text.gsub!(/C[([0-9]+)]/i) { "x01[#{$1}]" }
    @new_text.gsub!(/G/)              { "x02" }
    @new_text.gsub!(/./)             { "x03" }
    @new_text.gsub!(/|/)             { "x04" }
    @new_text.gsub!(/!/)              { "x05" }
    @new_text.gsub!(/>/)              { "x06" }
    @new_text.gsub!(/</)              { "x07" }
    @new_text.gsub!(/^/)             { "x08" }
    @new_text.gsub!(/L/)              { "x09" }
    @new_text.gsub!(/\/)             { "" }
  end
  #--------------------------------------------------------------------------
  # * Update Message
  #--------------------------------------------------------------------------
  def update_message
    # Draw text letter by letter
    if Advanced_Help::Letter_By_Letter
      loop do
        c = @new_text.slice!(/./m)            # Get next text character
        case c
        when nil                          # There is no text that must be drawn
          break
        when "x01"                       # C[n]  (text character color change)
          @new_text.sub!(/[([0-9]+)]/, "")
          contents.font.color = text_color($1.to_i)
          next
        when "x09"
          @contents_x = 0
          @line_y += 1
        else                              # Normal text character
          contents.draw_text(@contents_x, @line_y * WLH, 40, WLH, c)
          c_width = contents.text_size(c).width
          @contents_x += c_width
        end
        break
      end
    # Draw the whole text
    else 
      while (c = @new_text.slice!(/./m)) != nil
        case c
        when nil                          # There is no text that must be drawn
          break
        when "x01"                       # C[n]  (text character color change)
          @new_text.sub!(/[([0-9]+)]/, "")
          contents.font.color = text_color($1.to_i)
          next
        when "x09"
          @contents_x = 0
          @line_y += 1
        else                              # Normal text character
          contents.draw_text(@contents_x, @line_y * WLH, 40, WLH, c)
          c_width = contents.text_size(c).width
          @contents_x += c_width
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Draw text
    update_message
    # The usual
    dargor_vx_help_scroll_update
    # Scroll text
    @scroll_wait -= 1
    if @temp_wait > 0
      @temp_wait -= 1
      @temp_wait = -1 if @temp_wait == 0
      return
    else
      if self.oy != 0 && @temp_wait == -1
        self.oy -= 1 if Graphics.frame_count % 2 == 0
        if self.oy % WLH == 0
          @temp_wait = Advanced_Help::Scroll_Wait
          return
        end
        @temp_wait = 0 if self.oy == 0
        return
      end
    end
    if @scroll_mode != 2
      if self.contents.width > self.width && @scroll_wait < 0
        self.ox += 1
        @scroll_wait = Advanced_Help::Scroll_Wait if self.ox == 0
      end
    else
      if self.contents.height + 32 > self.height && @scroll_wait < 0
        self.oy += 1 if Graphics.frame_count % 2 == 0
        if self.oy % WLH == 0
          if self.oy > self.contents.height - WLH
            @temp_wait = Advanced_Help::Scroll_Wait
          else
            @scroll_wait = Advanced_Help::Scroll_Wait
          end
          return
        end
        #@scroll_wait = Advanced_Help::Scroll_Wait if self.oy == 0
      end
    end
    case @scroll_mode
    when 0
      if self.ox > self.contents.width
        self.ox = (-self.contents.width + 64)
      end
    when 1
      if self.ox > self.contents.width + 64
        self.ox = 0
        @scroll_wait = Advanced_Help::Scroll_Wait
      end
    when 2
      if self.oy > self.contents.height - WLH
        @temp_wait = Advanced_Help::Scroll_Wait
        @scroll_wait = Advanced_Help::Scroll_Wait
      end
    end
  end
end
 
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_vx_advanced_help_battle_update_basic update_basic
  #--------------------------------------------------------------------------
  # * Basic Update Processing
  #     main : Call from main update method
  #--------------------------------------------------------------------------
  def update_basic(main = false)
    dargor_vx_advanced_help_battle_update_basic(main)
    @help_window.update unless @help_window.nil?
  end
end

이상! 루시페르였습니다!
Comment '13'
  • ?
    Zero_Som 2009.06.06 18:04
    허걱 길어지는거군요!
  • profile
    레이♡ 2009.06.07 17:00

    꽤 유용할지도.....

    문장이 안보여서 불편하다면 ㅋㅋ;;

  • ?
    백년술사 2009.06.09 22:53

    설명을 많이 할수있는건가요?

    어쨌든 좋을듯..(씨익)
  • ?
    Berylll 2009.10.18 15:12
    잘쓰겟습니다 ㅎㅎ.
  • ?
    1000℃ 복숭아 2009.10.19 15:48

    잘 쓰겠습니다~

     

  • ?
    뉴공 2009.11.05 13:38

    그 사이드뷰 배틀스트립트와 같이쓰면

    전투 도중 화면 상단에 기술이나 방어를 사용할때 나오는 문장이 출력되지 않습니다.

    여러모로 시도해보니 스크롤 타입을 '2'로 했을 경우에만 정상적으로 출력되더군요.

    참고하시길.

  • ?
    뉴공 2009.11.05 13:38
    아, 그리고 정말 좋은 스크립트네요 ㅎㅎ
  • ?
    뉴공 2009.11.05 13:43

    아, 확인해보니 스크롤타입이 '2' 일 경우에는 문장이 제대로 출력되지 않는군요.....;;

    결국은 사이드뷰 배틀스크립트와는 같이 못쓴다는 말이죠.

  • ?
    키레이 2010.11.21 21:17

    그래도 아이템 설명 쓰는 곳 자체에 글자수 제한이 있으니 뭐,

    그래도 감사히 받겠습니다!

  • ?
    이클립스 2010.12.16 00:23

    감사합니다!! 정말 좋군요!!

    안그래도 글자 잘리는 것 때문에 고민하고 있었는데...

    덕분에 해결이 되네요..^^

  • ?
    구제가능 2011.07.24 18:09

    난 왜 안될까

  • profile
    개촙포에버 2011.07.28 16:51

    어..스크립트가 뭔가 이상한데요?붙여넣었더니 아랫부분이 분홍색으로 변했네요.

  • ?
    크런키맛아듀크림 2011.10.30 21:57

    이거 에러..


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
637 기타 Gamepad Extender VX 습작 2015.01.02 672
636 버그픽스 DerVVulfman's Tileset Reader VX Bug Fix 습작 2014.11.16 699
635 아이템 현재있는 파티원 선택 레벨업 아이템 만들기 1 file 싸패 2016.06.06 713
634 메뉴 Etude87_Ace_Style_Formation_Change ver.1.01 습작 2014.10.05 758
633 저장 세이브 파일 개수 16개로 늘리기 (기본 세이브 엔진용) 1 file Bunny_Boy 2015.09.07 815
632 ??? 1 Man... 2008.10.27 1020
631 버그픽스 Graphical Object Global Reference VX by Mithran Alkaid 2014.03.03 1026
630 키입력 No F1, F12 and Alt+Return (Kein F1, F12 und Alt+Eingabe) by cremno 습작 2013.04.19 1046
629 메시지 Etude87 Dialogue History Scene file 습작 2014.07.07 1069
628 메뉴 KGC - 커스텀 메뉴 커멘드 (번역) 1 듀란테 2015.07.27 1077
627 ??(다 영어)여기서 부터 드레그만 빼고 Man... 2008.10.27 1078
626 Scene_Credit script Plug & Play 1 Man... 2008.10.27 1085
625 Multi-threader snippet by Omegazion Man... 2008.10.28 1107
624 메뉴 MOG - Scroll Bar for VX file 습작 2014.07.06 1115
623 Screen Shortcut Script Man... 2008.10.27 1142
622 LevelMe v1.2 3 Man... 2008.10.27 1154
621 Screen Resolution 3 Man... 2008.10.28 1171
620 키입력 Key Simulator by Fantasist 습작 2013.05.01 1176
619 MAX Level Limitation System 3 Man... 2008.10.28 1198
618 Simple Fon Chage 3 Man... 2008.10.28 1212
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32