设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 82|回复: 0

[转载发布] SGD | Zalgo-Inspired Text

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58751
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68660

    灌水之王

    发表于 2026-7-27 11:35:27 | 显示全部楼层 |阅读模式
    Zalgo-Inspired Text Version 2.0 (2.1 ish)
    SGD


    Note before we start: Below this post is a reply with a fix for choices. Choices did not display correctly and lost their functionality. You can simply replace the part of the code. The Demos (V1 and V2) have not been updated. The original codes in here have. So if you are using the Demo as refference you have to manually tweak it. Please use the Fix for Version 2.0 of the Script down below.

    I just finished a new script that lets you create Zalgo-inspired stacked text in RPG Maker XP. It’s designed to work per-line and integrates seamlessly with RMXP’s message system





    Features:


    • UP, MID, and DOWN diacritics applied to every character.
    • Per-line control via \z[n] (intensity n ranges 0–15). (Recommended not to go higher than 6 on a lot of text.)
    • Fully compatible with RMXP’s message system—normal messages, choices, and pauses all work.
    • No global toggling required; just use \z[n] wherever you want Zalgo text.

    Usage:

    Insert \z[n] at the start of any line in your message to activate Zalgo text for that line:
                    Ruby:       
    1. \z[6]This line will appear in Zalgo style at intensity 6
    2. Normal lines remain unaffected
    复制代码


    You can mix normal and Zalgo lines in the same message:
                    Ruby:       
    1. Normal line
    2. \z[4]Zalgo line
    3. Back to normal
    复制代码


    Demo here (Version 1.0)

    Spoiler: CODE VERSION 1.0
                    Ruby:       
    1. #==============================================================================
    2. # ** Z A L G O  S T A C K E D  T E X T  F O R  R M X P
    3. #------------------------------------------------------------------------------
    4. #  Zalgo-Inspired Text by SGD
    5. #------------------------------------------------------------------------------
    6. #  Use \z[n] in message text to activate Zalgo with intensity 'n' per line:
    7. #      \z[6] This line will appear in Zalgo style
    8. #      Normal lines remain unaffected.
    9. #
    10. #  Hint: would not got too high, affects Frames and can cause stuttering.
    11. #------------------------------------------------------------------------------
    12. #  Features:
    13. #    - UP, MID, and DOWN marks applied per character
    14. #    - Per-line control with \z[n], no global toggle needed
    15. #    - Fully compatible with RMXP messages (no freezing)
    16. #------------------------------------------------------------------------------
    17. #  Credits & Alterations:
    18. #    By SGD
    19. #    Based on SGD's previous Zalgo scripts
    20. #------------------------------------------------------------------------------
    21. #  Date: 2025-09-01
    22. #  For: RPG Maker XP (RGSS, Ruby 1.8.1)
    23. #==============================================================================
    24. module Zalgo
    25.   @intensity = 4
    26.   UP   = %w( ̍ ̎ ̄ ̅ ̿ ̑ ̆ ̐ ͒ ͗ ͑ )
    27.   DOWN = %w( ̞ ̟ ̠ ̤ ̥ ̦ ̩ ̪ ̫ ̬ ̭ )
    28.   MID  = %w( ̕ ̛ ̡ ̢ ̧ ̨ ̴ ̵ ̶ ͘ ͝ )
    29.   def self.intensity; @intensity; end
    30.   def self.intensity=(n); @intensity = [[n.to_i,0].max,15].min; end
    31.   def self.sample_up;   UP[rand(UP.size)]; end
    32.   def self.sample_down; DOWN[rand(DOWN.size)]; end
    33.   def self.sample_mid;  MID[rand(MID.size)]; end
    34. end
    35. #------------------------------------------------------------------------------
    36. # Extend Bitmap to draw Zalgo letters with stacked marks
    37. #------------------------------------------------------------------------------
    38. class Bitmap
    39.   def draw_zalgo_char(x, y, ch, intensity, char_width, char_height)
    40.     draw_text(x, y, char_width, char_height, ch)
    41.     return if ch == ' '
    42.     intensity.times do
    43.       ox = x + rand(char_width/2) - char_width/4
    44.       oy = y - rand(char_height/2)
    45.       draw_text(ox, oy, char_width, char_height, Zalgo.sample_up)
    46.     end
    47.     intensity.times do
    48.       ox = x + rand(char_width/2) - char_width/4
    49.       oy = y + rand(char_height/2)
    50.       draw_text(ox, oy, char_width, char_height, Zalgo.sample_down)
    51.     end
    52.     intensity.times do
    53.       ox = x + rand(char_width/2) - char_width/4
    54.       oy = y + rand(char_height/2) - char_height/4
    55.       draw_text(ox, oy, char_width, char_height, Zalgo.sample_mid)
    56.     end
    57.   end
    58.   def draw_zalgo_text_stacked(x, y, text, height)
    59.     cx = x
    60.     text.scan(/./m) do |ch|
    61.       char_width = self.text_size(ch).width
    62.       char_height = height
    63.       if ch == ' '
    64.         cx += char_width
    65.         next
    66.       end
    67.       draw_zalgo_char(cx, y, ch, Zalgo.intensity, char_width, char_height)
    68.       cx += char_width
    69.     end
    70.   end
    71. end
    72. #------------------------------------------------------------------------------
    73. # Patch Window_Message for RMXP to support \z[n] inline
    74. #------------------------------------------------------------------------------
    75. class Window_Message < Window_Selectable
    76.   alias zalgo_old_refresh refresh
    77.   def refresh
    78.     text = $game_temp.message_text
    79.     return zalgo_old_refresh unless text
    80.     self.contents.clear
    81.     self.contents.font.color = normal_color
    82.     x = 4
    83.     y = 0
    84.     text.split("\n").each do |line|
    85.       intensity = nil
    86.       # Detect \z[n] at the start of the line
    87.       if line =~ /^\\z\[(\d+)\]/i
    88.         intensity = $1.to_i
    89.         line = line.gsub(/^\\z\[\d+\]/i, "")
    90.       end
    91.       if intensity
    92.         Zalgo.intensity = intensity
    93.         self.contents.draw_zalgo_text_stacked(x, y * 32, line, 32)
    94.       else
    95.         self.contents.draw_text(x, y * 32, 480, 32, line)
    96.       end
    97.       y += 1
    98.     end
    99.   end
    100. end
    复制代码


    UPDATE: VERSION 2.0

    Spoiler: CODE: VERSION 2.0
                    Ruby:       
    1. #==============================================================================
    2. # ** Z A L G O  S T A C K E D  T E X T  F O R  R M X P
    3. #------------------------------------------------------------------------------
    4. #  Zalgo-Inspired Text by SGD
    5. #------------------------------------------------------------------------------
    6. #  Use \z[n] in message text to activate Zalgo with intensity 'n' per line:
    7. #      \z[6] This line will appear in Zalgo style
    8. #      Normal lines remain unaffected.
    9. #
    10. #  Hint: Do not set intensity too high — it affects FPS and can cause stuttering.
    11. #------------------------------------------------------------------------------
    12. #  Features:
    13. #    - UP, MID, and DOWN marks applied per character
    14. #    - Independent colors and offsets for UP / MID / DOWN marks
    15. #    - Optional per-symbol random color variation
    16. #    - Optional slight random variation for main Zalgo text
    17. #    - Per-line control with \z[n], no global toggle needed
    18. #    - Fully compatible with RMXP messages (no freezing)
    19. #------------------------------------------------------------------------------
    20. #  Credits & Alterations:
    21. #    By SGD
    22. #    Based on SGD's previous Zalgo scripts
    23. #------------------------------------------------------------------------------
    24. #  Version 2.0
    25. #  Date: 2025-09-02
    26. #  For: RPG Maker XP (RGSS, Ruby 1.8.1)
    27. #==============================================================================
    28. module Zalgo
    29.   @intensity = 4
    30.   # -------------------------------
    31.   # Configurable settings
    32.   # -------------------------------
    33.   COLOR_MAIN = Color.new(255, 100, 255) # main Zalgo character color
    34.   RANDOM_COLOR_MAIN = true              # slight random variation for main Zalgo character
    35.   COLOR_UP   = Color.new(255, 100, 100) # reddish for UP marks
    36.   COLOR_MID  = Color.new(100, 255, 100) # greenish for MID marks
    37.   COLOR_DOWN = Color.new(100, 100, 255) # bluish for DOWN marks
    38.   OFFSET_UP_Y   = 0  # vertical offset for UP marks
    39.   OFFSET_MID_Y  = 0  # vertical offset for MID marks
    40.   OFFSET_DOWN_Y = 0  # vertical offset for DOWN marks
    41.   RANDOM_COLOR_VARIATION = true
    42.   RANDOM_VARIATION_RANGE  = 50   # max +/- change per RGB channel
    43.   # Marks
    44.   UP   = %w( ̍ ̎ ̄ ̅ ̿ ̑ ̆ ̐ ͒ ͗ ͑ ̇ ̈ ̊ ̋ ̌ ̏ ᷄ ᷅ ᷆ ᷇ ᷈ )
    45.   DOWN = %w( ̞ ̟ ̠ ̤ ̥ ̦ ̩ ̪ ̫ ̬ ̭ ̡ ̢ ̧ ̰ ̱ ̲ ̳ ̹ ̺ ̻ ͅ )
    46.   MID  = %w( ̕ ̛ ̡ ̢ ̧ ̨ ̴ ̵ ̶ ͘ ͝ ̽ ̾ ͜ ͝ ͞ ͟ ͠ ͢ ͣ ͤ )
    47.   #---------------------------------------------------------------------------
    48.   # Helpers
    49.   #---------------------------------------------------------------------------
    50.   def self.intensity; @intensity; end
    51.   def self.intensity=(n); @intensity = [[n.to_i,0].max,15].min; end
    52.   def self.sample_up;   UP[rand(UP.size)]; end
    53.   def self.sample_down; DOWN[rand(DOWN.size)]; end
    54.   def self.sample_mid;  MID[rand(MID.size)]; end
    55.   # Randomize a Color object slightly
    56.   def self.randomize_color(base_color)
    57.     return base_color unless RANDOM_COLOR_VARIATION
    58.     r = [[base_color.red   + rand(RANDOM_VARIATION_RANGE*2+1) - RANDOM_VARIATION_RANGE, 0].max, 255].min
    59.     g = [[base_color.green + rand(RANDOM_VARIATION_RANGE*2+1) - RANDOM_VARIATION_RANGE, 0].max, 255].min
    60.     b = [[base_color.blue  + rand(RANDOM_VARIATION_RANGE*2+1) - RANDOM_VARIATION_RANGE, 0].max, 255].min
    61.     Color.new(r, g, b, base_color.alpha)
    62.   end
    63. end
    64. #------------------------------------------------------------------------------
    65. # Extend Bitmap to draw Zalgo letters with stacked marks
    66. #------------------------------------------------------------------------------
    67. class Bitmap
    68.   def draw_zalgo_char(x, y, ch, intensity, char_width, char_height)
    69.     return if ch == ' '
    70.     # ---- Draw main Zalgo character ----
    71.     main_color = Zalgo::COLOR_MAIN
    72.     main_color = Zalgo.randomize_color(main_color) if Zalgo::RANDOM_COLOR_MAIN
    73.     self.font.color = main_color
    74.     draw_text(x, y, char_width, char_height, ch)
    75.     # ---- Draw UP marks ----
    76.     intensity.times do
    77.       ox = x + rand(char_width/2) - char_width/4
    78.       oy = y - rand(char_height/2) + Zalgo::OFFSET_UP_Y
    79.       self.font.color = Zalgo.randomize_color(Zalgo::COLOR_UP)
    80.       draw_text(ox, oy, char_width, char_height, Zalgo.sample_up)
    81.     end
    82.     # ---- Draw DOWN marks ----
    83.     intensity.times do
    84.       ox = x + rand(char_width/2) - char_width/4
    85.       oy = y + rand(char_height/2) + Zalgo::OFFSET_DOWN_Y
    86.       self.font.color = Zalgo.randomize_color(Zalgo::COLOR_DOWN)
    87.       draw_text(ox, oy, char_width, char_height, Zalgo.sample_down)
    88.     end
    89.     # ---- Draw MID marks ----
    90.     intensity.times do
    91.       ox = x + rand(char_width/2) - char_width/4
    92.       oy = y + rand(char_height/2) - char_height/4 + Zalgo::OFFSET_MID_Y
    93.       self.font.color = Zalgo.randomize_color(Zalgo::COLOR_MID)
    94.       draw_text(ox, oy, char_width, char_height, Zalgo.sample_mid)
    95.     end
    96.   end
    97.   def draw_zalgo_text_stacked(x, y, text, height)
    98.     cx = x
    99.     text.scan(/./m) do |ch|
    100.       char_width  = self.text_size(ch).width
    101.       char_height = height
    102.       if ch == ' '
    103.         cx += char_width
    104.         next
    105.       end
    106.       draw_zalgo_char(cx, y, ch, Zalgo.intensity, char_width, char_height)
    107.       cx += char_width
    108.     end
    109.   end
    110. end
    111. #------------------------------------------------------------------------------
    112. # Patch Window_Message for RMXP to support \z[n] inline (line-level)
    113. #------------------------------------------------------------------------------
    114. class Window_Message < Window_Selectable
    115.   alias zalgo_old_refresh refresh
    116.   def refresh
    117.     # If this is a choice message, skip Zalgo and use normal refresh
    118.     if $game_temp.choice_max > 0
    119.       return zalgo_old_refresh
    120.     end
    121.     text = $game_temp.message_text
    122.     return zalgo_old_refresh unless text
    123.     self.contents.clear
    124.     x = 4
    125.     y = 0
    126.     text.split("\n").each do |line|
    127.       intensity = nil
    128.       # Detect \z[n] at the start of the line
    129.       if line =~ /^\\z\[(\d+)\]/i
    130.         intensity = $1.to_i
    131.         line = line.gsub(/^\\z\[\d+\]/i, "")
    132.       end
    133.       if intensity
    134.         Zalgo.intensity = intensity
    135.         self.contents.draw_zalgo_text_stacked(x, y * 32, line, 32)
    136.       else
    137.         self.contents.font.color = normal_color
    138.         self.contents.draw_text(x, y * 32, 480, 32, line)
    139.       end
    140.       y += 1
    141.     end
    142.   end
    143. end
    复制代码


    New Features for Version 2.0:

    • Independent mark offsets: Vertical adjustments for UP, MID, and DOWN marks (OFFSET_UP_Y, etc.).
    • Independent colors for marks: COLOR_UP, COLOR_MID, COLOR_DOWN.
    • Optional random color variation: Slight per-symbol color changes for marks.
    • Main Zalgo text color: COLOR_MAIN, with optional random variation (RANDOM_COLOR_MAIN).
    • Marks and main text fully separated: Randomization for marks does not affect normal or main text.
    • Expanded mark sets: More symbols for UP, MID, and DOWN marks for a richer effect.

    Screenshot Version 2.0





    Download Demo here (Version 2.0)

    Credits:


    • By SGD
    • Based on SGD’s previous "SGD | Zalgo-Inspired Text" script



    本贴来自国际rpgmaker官方论坛作者:SGD处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/sgd-zalgo-inspired-text.179884/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-4 12:52 , Processed in 0.066142 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表