질문과 답변

Extra Form

이벤트 스크립트 창에

 

hud(true)

 

이걸 적으니까 스크립트를 불러오는 중에 Syntax오류가 발생했다고 오류 메시지만 뜹니다.

 

 

 

 

사용한 스크립트는 다음과 같습니다.

 

--------------------------------------------------------------------
# A list of colors that you may use to configure the font and gauge
################################################################################
#                                                                              #
#                      ~~~~~ Copyright 2009 SojaBird ~~~~~                     #
#                                                                              #
################################################################################

# To toggle the hud's display, just do a callscript "hud"
# To set the hud's display, just do a callscript "hud(true)" or "hud(false)"

module HUD_HP_MP_EXP_NAME_FACE_LEVEL
  HUD_WIDTH = 126 # The width of the HUD (when 126, face will be drawn)
  FACE_OPACITY = 100 # The opacity of the background face (when HUD_WIDTH = 126)

  BG_DISPLAY = true # Show or hide the backgroundwindow [true/false]

  EXP_NAME = "Exp" # What should be displayed for the EXP
 
  ACTOR_ID = 0 # Id of actor to show data of (actor1=0, actor2=1...actorN=N-1)
 
  HIDE = true # Hide if player is beneath the HUD [true/false]
  OPACITY = 100 # Opacity when hidden [0-255]
 
  HUD_START_DISPLAY = true # Wheter to display the HUD at start [true/false]
 
  CYCLE = true # Wheter to enable to cyle through actors with L&R buttons
end

################################################################################
def hud(arg = nil)
  $game_system.hud_display = !$game_system.hud_display if arg == nil
  $game_system.hud_display = arg if arg != nil
end
################################################################################
class Window_HUD_HP_MP_EXP_NAME_FACE_LEVEL < Window_Base
  include HUD_HP_MP_EXP_NAME_FACE_LEVEL
 
  attr_reader :index
 
  def initialize(index)
    @index = index
    super(0, 0, HUD_WIDTH, WLH * 4 + 32)
    self.visible = $game_system.hud_display
    self.opacity = OPACITY
    self.opacity = 0 if !BG_DISPLAY
    @actor = $game_party.members[@index]
    @width = HUD_WIDTH - 32
    hide_status
    refresh
  end
 
  def refresh
    contents.clear
    @hp = @actor.hp
    @mp = @actor.mp
    @exp = @actor.exp
    @name = @actor.name
    @level = @actor.level
    @face = [@actor.face_name, @actor.face_index]
    draw_actor_face_picture(@actor, 0, 0, FACE_OPACITY) if HUD_WIDTH == 126
    draw_actor_name_and_level(@actor, 0, WLH * 0)
    draw_actor_hp(@actor, 0, WLH * 1, @width)
    draw_actor_mp(@actor, 0, WLH * 2, @width)
    draw_actor_exp(@actor, 0, WLH * 3, @width)
  end
 
  def hide_status
    if HIDE == true
      if $game_player.screen_x + 16 > self.x and
      $game_player.screen_y + 4 > self.y and
      $game_player.screen_x - 16 < self.x + self.width and
      $game_player.screen_y - 28 < self.y + self.height
        self.opacity = OPACITY if BG_DISPLAY
        self.contents_opacity = OPACITY
      else
        self.opacity = 255 if BG_DISPLAY
        self.contents_opacity = 255
      end
    end
  end
 
  def draw_actor_face_picture(actor, x, y, opacity, size = 94)
    bitmap = Cache.face(actor.face_name)
    rect = Rect.new(0, 0, 0, 0)
    rect.x = actor.face_index % 4 * 96 + (96 - size) / 2
    rect.y = actor.face_index / 4 * 96 + (96 - size) / 2
    rect.width = size
    rect.height = size
    self.contents.blt(x, y, bitmap, rect, opacity)
    bitmap.dispose
  end
 
  def draw_actor_name_and_level(actor, x, y)
    self.contents.font.color = hp_color(actor)
    self.contents.draw_text(x, y, @width - 32 - 24, WLH, actor.name)
    self.contents.font.color = system_color
    x = @width / 2
    width = (@width.to_f / 2) / (32 + 24)
    self.contents.draw_text(x, y, width * 32, WLH, Vocab::level_a)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + width * 32, y, width * 24, WLH, actor.level, 2)
  end
 
  def draw_actor_exp(actor, x, y, width)
    s1 = actor.exp_s
    s2 = actor.next_rest_exp_s + s1
    if s1.is_a? String or s2.is_a? String
      s1 = actor.exp
      s2 = actor.exp
    end
    draw_actor_exp_gauge(actor, x, y, s1, s2, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, EXP_NAME)
    self.contents.font.color = normal_color
    last_font_size = self.contents.font.size
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 44, y, 44, WLH, s1, 2)
    else
      self.contents.draw_text(xr - 99, y, 44, WLH, s1, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
      self.contents.draw_text(xr - 44, y, 44, WLH, s2, 2)
    end
  end
 
  def draw_actor_exp_gauge(actor, x, y, s1, s2, width)
    gw = width * s1 / s2
    gc1 = text_color(31)
    gc2 = text_color(27)
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
 
  def update
    self.visible = $game_system.hud_display
    return if !self.visible
    if @hp != @actor.hp or
      @mp != @actor.mp or
      @exp != @actor.exp or
      @name != @actor.name or
      @level != @actor.level or
      @face != [@actor.face_name, @actor.face_index]
      refresh
    end
    hide_status
  end
end

#------------------------------------------------------------
# * Scene_Map: Attach HUD to map
#------------------------------------------------------------
class Scene_Map < Scene_Base
  alias start_hmexp_name_face_lvl start
  alias terminate_hmexp_name_face_lvl terminate
  alias update_hmexp_name_face_lvl update
  def start
    start_hmexp_name_face_lvl
    @index = HUD_HP_MP_EXP_NAME_FACE_LEVEL::ACTOR_ID
    new_hud
   
  end
  def terminate
    @hp_mp_exp_name_face_hud.dispose
    terminate_hmexp_name_face_lvl
  end
  def update
    update_hmexp_name_face_lvl
    @hp_mp_exp_name_face_hud.update
    return if !HUD_HP_MP_EXP_NAME_FACE_LEVEL::CYCLE
    return if !@hp_mp_exp_name_face_hud.visible
    if Input.trigger?(Input::R)
      if @index == $game_party.members.size - 1
        @index = 0
      else
        @index += 1
      end
    elsif Input.trigger?(Input::L)
      if @index == 0
        @index = $game_party.members.size - 1
      else
        @index -= 1
      end
    end
    new_hud if @index != @hp_mp_exp_name_face_hud.index
  end
 
  def new_hud
    @hp_mp_exp_name_face_hud.dispose if !@hp_mp_exp_name_face_hud.nil?
    @hp_mp_exp_name_face_hud = Window_HUD_HP_MP_EXP_NAME_FACE_LEVEL.new(@index)
  end
end

#------------------------------------------------------------
# * Game_System: Check for display
#------------------------------------------------------------
class Game_System
  alias hud_initialize initialize
  attr_accessor :hud_display
  def initialize
    hud_initialize
    @hud_display = HUD_HP_MP_EXP_NAME_FACE_LEVEL::HUD_START_DISPLAY
  end
end

 

 

 

 

 

제가 제대로 적용한 것이 맞나요?

Comment '1'
  • profile
    습작 2012.04.01 00:26

    VX에서 나타나는 매우 전형적인 Syntax오류입니다.

    절대로 특별한 경우가 아니며, 무심코 그냥 새 프로젝트를 시작했을 시 생기는 일입니다.

    해당 스크립트를 직접 확인 후 답변을 드리는 것임을 알려드립니다.


    VX 강좌에서 Syntax오류 관련 허걱님 게시물을 검색해서 첨부파일을 받은 뒤, 새 프로젝트에 적용한뒤 시작하세요.

    게시물 내용에서 지적한 곳들을 바꿔주는 것 또한 해결방법입니다만, 게시물에는 오타가 있어 수정전과 수정후가 같게 적혀 있으므로, 적확히 알지 못 하신다면 그냥 파일을 받는 것을 추천합니다.


    유사 사례가 잦은 질문입니다.

    질문하기 전에 보다 검색을 생활화 하시고, 강좌를 살펴보시길 바랍니다.


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12397
RMVX rpg 조건분기 질문 1 file 슬 라임 2012.03.31 2168
RMVX 몬스터을 새로 추가할수가 있나요 ? 3 썬삼이 2012.03.31 2263
RMVX HUD 인터페이스 숨기기 오류가 발생합니다. 1 C_tan 2012.03.31 1716
RMVX 이건뭐 병 .. 어뜩해. . 5 쁘띠뽀루 2012.03.31 2394
RMVX 프린세스 메이커 같은 육성 게임 스크립트 있나요? 2 승비 2012.04.01 4058
RMVX vx Srpg의 턴 종료 시키기 1 minibalrog 2012.04.02 2785
RMVX Srpg의 턴 종료 시키기(재 작성) 1 file minibalrog 2012.04.03 3033
RMVX 몬스터 리스폰 시키는방법 1 춰억헐릿 2012.04.03 2783
RMVX 응??? 타일셋 늘리는 스크립트 나와있던것 같던데... 2 난현이라는 2012.04.04 2771
RMVX SBS 3.4 사이드뷰 적 기본공격 2 잭무기 2012.04.12 2643
RMVX RPG VX 5 윤파카 2012.04.12 2397
RMVX 게임 시작전 부터 특정 스위치를 on시켜놓는 전제하에 시작하게 만들기 3 라이루 2012.04.14 2557
RMVX RPGVX로 SRPG게음을 만들떄 민첩순위로 한턴당 한캐릭터만 움직일수 있게 만들수 있나요? 1 August_Wish 2012.04.16 2900
RMVX 까까까님이 예전에 올리신 "역동적인 타이틀 만들기" 에 관해서 3 TheEK 2012.04.18 4210
RMVX rpg만들기 툴 어느걸 추천하시나요? 2 stonesoup 2012.04.18 2458
RMVX 캐릭터의 기본공격이 다른 캐릭의 스킬로 멋대로 바뀌었네요 6 file 친구뿐인삶 2012.04.19 1770
RMVX 정수로 id와 pw만들기 3 FNS키리토 2012.04.20 1819
RMVX 소지금이 OO이상일때 진행되는 이벤트를 만들려면 2 춰억헐릿 2012.04.20 2273
RMVX 도와주세요 ~~ 테스트 도중 오류가 납니다. 2 file GreatSH 2012.04.22 2369
RMVX 분명히 만들땐 따라가기 스크립트가 적용이 되어있는데 배포로 만드니까 종범 춰억헐릿 2012.04.22 2638
Board Pagination Prev 1 ... 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 ... 127 Next
/ 127