kone
소미소프트

소미소프트

줄 바꿈, RPGM VXA 스크립트) ▼ シーン ## 자동 줄바꿈.txt

04/11/2026, 08:20:55
유틸
8867 views · 2 likes
스크립트
# DarkPlasma_AutoLineBreak for RPG Maker VX Ace
# 버전: 1.0.5 (LINE_MARGIN 상수 참조 수정 + 약간의 안정성 개선)
# 목표: 최대한 간단하게 유지하면서 에러 제거

module DarkPlasma
  module AutoLineBreak
    PROHIBIT_BEFORE = ',)]}、〕〉》」』】〙〗〟’”⦆»ゝゞーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇷ゚ㇺㇻㇼㇽㇾㇿ々〻‐゠–〜~?!‼⁇⁈⁉・:;/。.'.freeze
    PROHIBIT_AFTER  = '([{〔〈《「『【〘〖〝‘“⦅«'.freeze
    
    LINE_MARGIN     = 4
    WORD_BASE       = false   # true = 영어 단어 단위 시도 (아주 제한적)

    IGNORE_CLASS_NAMES = []   # 필요하면 여기에 클래스 이름 추가
  end
end

class Window_Base
  attr_accessor :ignore_auto_linebreak_temp

  def ignore_auto_linebreak?
    DarkPlasma::AutoLineBreak::IGNORE_CLASS_NAMES.include?(self.class.name) ||
    @ignore_auto_linebreak_temp
  end

  def start_ignore_auto_linebreak
    @ignore_auto_linebreak_temp = true
  end

  def finish_ignore_auto_linebreak
    @ignore_auto_linebreak_temp = false
  end

  def auto_line_width
    contents.width - DarkPlasma::AutoLineBreak::LINE_MARGIN
  end

  def prohibit_before?(char)
    DarkPlasma::AutoLineBreak::PROHIBIT_BEFORE.include?(char)
  end

  def prohibit_after?(char)
    DarkPlasma::AutoLineBreak::PROHIBIT_AFTER.include?(char)
  end

  # 자동 줄바꿈 필요 여부 판단 (VX Ace 한계로 매우 단순화됨)
  def should_auto_break_here?(c, pos)
    return false if ignore_auto_linebreak?
    return false if c == "\n" || c.nil? || c.empty?

    char_width = begin
      contents.text_width(c)
    rescue
      12   # 폰트/문자 문제 시 기본값
    end

    current_x = pos[:x]

    # 1. 기본 폭 초과 → 행두 금지 문자가 아니면 줄바꿈
    if current_x + char_width > auto_line_width
      return !prohibit_before?(c)
    end

    # 2. 행미 금지 문자 + 여유 공간 부족 시 강제 줄바꿈 시도
    if prohibit_after?(c) && current_x + char_width + DarkPlasma::AutoLineBreak::LINE_MARGIN > auto_line_width
      return true
    end

    # 3. 영어 단어 단위 (매우 제한적 – lookahead 불가)
    if DarkPlasma::AutoLineBreak::WORD_BASE &&
       pos[:last_char] == ' ' && c != ' ' && c =~ /\w/
      if current_x + char_width * 4 > auto_line_width   # 임의 예측
        return true
      end
    end

    false
  end
end

class Window_Base
  alias dp_alb_process_character process_character
  def process_character(c, text, pos)
    if ignore_auto_linebreak?
      dp_alb_process_character(c, text, pos)
      return
    end

    # 자동 줄바꿈 필요 시 먼저 줄 바꿈
    if should_auto_break_here?(c, pos)
      process_new_line(text, pos)
      pos[:x] = pos[:new_x]   # x 위치 초기화 (중요!)
    end

    # 마지막 문자 기억 (영어 옵션용)
    pos[:last_char] = c if c =~ /[\w\s]/

    # 원본 처리
    dp_alb_process_character(c, text, pos)
  end

  # \ALB[START] / \ALB[FINISH] 간단 구현
  alias dp_alb_process_escape_character process_escape_character
  def process_escape_character(code, text, pos)
    if code.upcase == 'ALB'
      if text.sub!(/^\[START\]/i, '')
        start_ignore_auto_linebreak
        return
      elsif text.sub!(/^\[FINISH\]/i, '')
        finish_ignore_auto_linebreak
        return
      end
    end

    dp_alb_process_escape_character(code, text, pos)
  end
end

# 레이아웃이 깨지기 쉬운 윈도우는 자동 줄바꿈 끄기
class Window_ChoiceList < Window_Command
  def ignore_auto_linebreak?
    true
  end
end

class Window_BattleLog < Window_Selectable
  def ignore_auto_linebreak?
    true
  end
end


적용된 게임 참조: https://kone.gg/s/somisoft/bC8e92EXqwOp90q_d0MzWb


용머리 게임 텍스트 자동 줄바꿈 스크립트

aHR0cHM6Ly9raW8uYWMvYy9jN251a3lBamxNSzZ6NERfQUZFNTBi


업로드한 파일은 바로 적용 못함

에디터로 스크립트 넣을 수 있는 상태에서 복사 붙여넣기용


▼ シーン ## 자동 줄바꿈.txt


▼ 적용 위치 ## 스크립트명

2
1 comment
Sign in to comment
감사합니다
Sign in to comment
케모노 비슷무리한 사이트 찾음(영상+pc19게임파일+ASMR)
정보
playhsui
05/12 20263 144
[구매보급][베개 추천]최강의♀(암컷)는 당신의 신부♪ 저음 마왕님은 모든것을 용서해준다
소리
이름뭐하지
05/12 11727 79
[ai번역-쿠리후쿠 미노루] STOP!! 시간 정지 능력으로 꼼짝 못 하는 소녀들에게 미친듯 사정하는 사건
동인
mybest
05/12 27513 88
ai) 제로의 사역마 발정난 공주
야짤
Ghost
05/12 17661 19
[ai노모번역-에츠잔 자쿠수이] 정사에 물든다
동인
mybest
05/12 10075 36
플래피ー!
동인
hatlatal
05/12 13400 44
ai) 나히아 요로즈
야짤
Ghost
05/12 7989 19
[ai번역-히가시고 미칸] 젖내음 물씬 여름방학
동인
mybest
05/12 16057 37
길가던 여자애 잡아서 유두 피어스 박기
야짤
toscana
05/12 15910 40
수컷콜라보
동인
hatlatal
05/12 16756 37
비가 그칠 때까지만
동인
hatlatal
05/12 28997 99
[ai번역]옆집의 츤데레 서큐버스 아가씨
동인
mybest
05/12 15177 57
언리얼엔진 파일추출만 하는방법 정리
정보
boids
05/12 5968 16
[ai번역-비피더스] 성관계 여관
동인
mybest
05/12 14720 55
[5/12] 유라 (원신) 미니 HMV
영상
브레머튼
05/12 22940 88
[직번] [Xiong Ling] 호시노 루코 상식개변
동인
maha1004
05/12 24024 35
[손번역 Ver.0.21] Daily Lives My Countryside 0.3.4.3
번역
감자떡사요
05/12 48321 215
[스타레일] NO.070 은랑 ( 기본 + 후타)
영상
브레머튼
05/12 18252 111
요청복구) RJ01456652 완전 치○ - 내성적인 J○가 타락할 때까지
복구
ㅇㅇ
05/12 35568 54
구매보급 PUBPET
Mock
05/12 46351 118
ai, 붕스) 히메코에게 성처리를 부탁해 보았다
야짤
kjh9304
05/12 18588 129
[이미지번역 100%] Daily Lives of My Countryside v0.3.4.3
작업현황
dodoph123
05/11 13127 30
이미지 다운로더 만들어봄
유틸
lordofcinder
05/11 7724 34
[요청복구] 인공 학원 2
복구
이상성애
05/11 24218 74
[미번] 미번 일겜 8개 + 미번 양겜 6개
미번
미스터장
05/11 15564 61
んぴゅ・ゔぃむぞ 세미 롱 짱
동인
SK
05/11 62176 407
[구매보급]최○ 조교×백합 여고생/남자 싫어하는 레즈 커플을 방과 후 강○ 봉사
소리
이름뭐하지
05/11 17693 65
[미번][번역요청] 기도 소녀 샬롯 외 두개
미번
minki
05/11 6992 22
(요청복구) 사교의 포로 노모패치적용
복구
sinryeong
05/11 25633 74
[미검수][RJ227638]나의 H한 여름의 추억 ~누나들과 보낸 8월~
복구
돈키호테가조아
05/11 23601 106