Tuckie 'Wiggly Text' Script Compatibility

So, I recently found a script on the forums by Tuckie that allows for shaking/wobbly text, as well as causing the text to sort of animate and drop into place. I decided to try using it in my game just to give text an extra bit of style, but it seems to be interfering with some of my other message scripts. Namely, the problems I've noticed that I'm running into are:

Victor's SFonts - Tuckie's script doesn't seem to be compatible with this one at all. I've tried placing both of them above and below one another, and no matter what it just seems like Tuckie's script doesn't register Victor's as existing. This isn't too big a deal, just that there are some special characters I've made thanks to Victor's script that now won't appear since SFonts are image-based. And also, I just don't personally like how VXA renders text with aliasing and outlines, it makes pixel fonts look awful.

Yanfly's Ace Message System - Mostly compatible, my issue is with changing the width of message boxes. When the message box width is set to anything lower than default, Tuckie's text doesn't draw where the new left edge of the message box should be, and instead starts way off near the edge of the window.

Spoiler: Tuckie's Script
Ruby:
=begin
______________________
<  wiggly text          │
│ by tuckie            │
│                      │
│ 7/7/17 woa lucky     │
│ Version: pretty done │
│______________________│

       ______________
(-o-)< hi there!! │
      │_____________│

__________________________________________
<                                           │
│ uhh hi this lets you animate text〰️〰️〰️〰️ │
│                  pretty cool             │
│ i like credit link to my twitter         │
│ @plsvotetuckie  in the credit.txt        │
│ or website(tell ur fans to give me $100) │
│ tuckie.zone thank you i love yuo ❤️      │
│__________________________________________│

=end

#==============================================================================
# how2use this scripty boy                                              _ ⬜ ❎
#==============================================================================
# Triggering animations is done via tags in the message window.
#
# Simply add a \ani[0-9] to pick the animation you want, and all text after will
# be animated. If a new text box appears the animation will stop. You can
# manually end animation with a \stop or \ani[7].
#
#-R/-\|NB0\^/-------------------------------------------------------------------
# Much like an animation, you can turn on a rainbow effect with \ran . You can
# turn off the rainbow and animation with \off but \bln will turn off only the
# rainbow effect.
#
#==============================================================================

#==============================================================================
# ** SETTINGS | hi im tuckie please tell your players i made this       _ ⬜ ❎
#==============================================================================

module WiggleText

  # Characters 'drop in' when first drawn.
  DROP_IN     = true
  # Height from where characters drop.
  DROP_HEIGHT = 8

  # Enable or disable hitting a button to skip drawing characters one-by-one.
  # true means players can skip, false means they can't.
  SKIP_CHAR   = true

  # do /nam[number] to make a nametag box with that specific name
  NAMES = [
      "that guy", #0
      "that other guy",   #1
      "a jerk", #2 etc
  ]
  #the filename of the background for the nametag sprite, place in Graphics/System
  NAME_SPRITE = "Nametag"

  # creature comfort feature: If you have a bunch of text codes (nametag, color
  # sound effect, etc) that you need to have at the start of a message make them
  # on line one, and use the text code \lin . this will "reset" the text height
  # so line two is higher up. adjust the height to fit your font with this
  # variable. Measurement in pixels.
  LINE_HEIGHT = 16
end

#==============================================================================
# ** Sprite_TextAnim                                                    _ ⬜ ❎
#------------------------------------------------------------------------------
#  Sprite subclass for text animations.
#==============================================================================

class Sprite_TextAnim < Sprite

  attr_accessor :anim_offset
  attr_accessor :anim_type
  attr_accessor :rainbow
  attr_accessor :rainbow_offset
  attr_accessor :drop
  @timer      = false
  attr_accessor :galv_ani

  def drop()
    if WiggleText::DROP_IN
      @drop -= @drop * 0.1
      if @drop < 0
        @drop = 0
      end
      return @drop
    else
      return 0
    end
  end

  def ani
      @galv_ani += 0.015
  end

  def update
    return unless @anim_offset

    if @rainbow
      @rainbow_offset += 0.03
      self.color = Color.new(128 + Math.sin(@rainbow_offset) * 127,
        128 + Math.sin(@rainbow_offset + 2*Math::PI/3) * 127,
        128 + Math.sin(@rainbow_offset + 4*Math::PI/3) * 127,
        255)
    end
    case @anim_type
      when 1
        @anim_offset += 0.115
        self.oy = Math.sin(@anim_offset) * 3 + drop()
        ani()
      when 2
        @anim_offset += 0.2
        self.ox = Math.sin(@anim_offset) * 3
        self.oy = Math.cos(@anim_offset) * -3 + drop()
        ani()
      when 3
        @anim_offset += 0.15
        self.zoom_x = 1 + Math.sin(@anim_offset) * 0.2
        self.zoom_y = 1 + Math.cos(@anim_offset) * 0.2
        self.oy = drop()
        ani()
      when 4
        @anim_offset += 1
        rand = 0
        if @anim_offset % 8 == 0
          rand = 4
          self.ox = rand(rand) - rand(rand)
          self.oy = rand(rand) - rand(rand) + drop()
        end
        ani()
      when 5
        @anim_offset += 0.1
        sample  = Math.sin(@anim_offset) * 5
        self.oy = sample.abs + drop()
        ani()
      when 6
        @anim_offset += 0.1
        self.ox = Math.sin(@anim_offset) * 3
        self.oy = Math.cos(@anim_offset) * -2 + drop()
        self.angle = Math.sin(@anim_offset * 0.5) * 10
        ani()
      when 7
        #no animation
        self.oy = drop()
        ani()
      when 8
        @anim_offset += 0.1
        self.ox = Math.sin(@anim_offset) * 3
        self.oy = Math.cos(@anim_offset) * -2 + drop()
        self.angle = Math.sin(@anim_offset) * 10
      when 9
        @anim_offset += 0.15
        self.zoom_x = 2
        self.zoom_y = 2
        self.oy = Math.sin(@anim_offset / 2) * -4 + drop()
      when 10
        @anim_offset += 0.085
        self.oy = Math.sin(@anim_offset / 2) * 3 + drop() + 2
      else
        return
    end
  end

end

#==============================================================================
# ** Window_Message                                                     _ ⬜ ❎
#------------------------------------------------------------------------------
#  This message window is used to display text.
#==============================================================================

class Window_Message < Window_Base

  #--------------------------------------------------------------------------
  # * Window_Message Creation | Alias
  #--------------------------------------------------------------------------
  alias tuckie_wiggly_initialize initialize
  def initialize
    tuckie_wiggly_initialize
    @animchars = []
    @rainbow = false
    @anim_offset = 0
  end

  #--------------------------------------------------------------------------
  # * Normal Character Processing | Overwrite
  #--------------------------------------------------------------------------
  def process_normal_character(c, pos)
    if @anim_type && @anim_type > 0
      process_anim_character(c, pos)
    else
      if WiggleText::DROP_IN
        @anim_type = 7
        process_anim_character(c, pos)
      else
        super
      end
    end
    wait_for_one_character
  end
  #--------------------------------------------------------------------------
  # * Animated Character Processing | New Method
  #--------------------------------------------------------------------------
  def process_anim_character(c, pos)
    text_width = text_size(c).width
    if defined? Graphics.fullscreen #MKXP fix
      text_width += text_width * 0.6
      text_width = text_width.round
    end
    letter = Sprite_TextAnim.new(self.viewport)
    bitmap = Bitmap.new(text_width, pos[:height])
    bitmap.font = self.contents.font
    letter.bitmap = bitmap
    letter.x = pos[:x] + self.standard_padding + 9
    letter.y += WiggleText::DROP_HEIGHT if WiggleText::DROP_IN
    letter.y = self.y + standard_padding + pos[:y]
    letter.z = self.z + 10
    letter.anim_offset = @animchars.size
    letter.anim_type = @anim_type
    tuckie_extra(letter)
    letter.update
    bitmap.draw_text(0, 0, text_width+2, pos[:height], c)
    @animchars.push(letter)
    pos[:x] += text_width
  end
  #--------------------------------------------------------------------------
  # * Name Menu Processing | New Method
  #--------------------------------------------------------------------------
  def process_name(c, pos)
    c = WiggleText::NAMES[c]
    text_width = text_size(c).width
    if defined? Graphics.fullscreen #MKXP fix
      text_width += text_width * 0.6
      text_width = text_width.round
    end

    letter = Sprite_TextAnim.new(self.viewport)
    bitmap = Bitmap.new(text_width + 4, 20)
    letter.bitmap = bitmap
    bitmap.font = self.contents.font
    letter.x = 23
    letter.y = self.y  + 2
    letter.z = self.z + 10
    letter.anim_offset = @animchars.size
    letter.anim_type = 10 #@anim_type
    tuckie_extra(letter)
    letter.update
    bitmap.draw_text(0, 0, 10, 16, c)

    tag = Sprite_TextAnim.new(self.viewport)
    tag.bitmap = Cache.system(WiggleText::NAME_SPRITE)
    tag.x = 14
    tag.y = self.y - 8
    tag.z = self.z + 9
    tag.anim_offset = @animchars.size
    tag.anim_type = 10
    tuckie_extra(tag)
    tag.drop = 0
    tag.update

    @animchars.push(tag)
    @animchars.push(letter)
  end
  #--------------------------------------------------------------------------
  # * Animated Emoji Processing | New Method
  #--------------------------------------------------------------------------
  def process_anim_emoji(c, pos)
    text_width = 24
    letter = Sprite_TextAnim.new(self.viewport)
    icon_bitmap = Cache.system("Emoji")
    bitmap = Bitmap.new(24, pos[:height])
    rect = Rect.new(c % 16 * 24, c / 16 * 24, 24, 24)
    bitmap.blt(0, 0, icon_bitmap, rect)
    letter.bitmap = bitmap
    letter.x = pos[:x] + self.standard_padding + 9
    letter.y += WiggleText::DROP_HEIGHT if WiggleText::DROP_IN
    letter.y = self.y + standard_padding + pos[:y]
    letter.z = self.z + 10
    letter.anim_offset = @animchars.size
    letter.anim_type = @anim_type
    tuckie_extra(letter)
    letter.update
    bitmap.draw_text(0, 0, text_width * 2, pos[:height], c)
    @animchars.push(letter)
    pos[:x] += text_width
  end
  #--------------------------------------------------------------------------
  # * Animated Character Extra Conditions | New Method
  #--------------------------------------------------------------------------
  def tuckie_extra(letter)
    if WiggleText::DROP_IN
      letter.drop = WiggleText::DROP_HEIGHT
    else
      letter.drop = 0
    end
    if @anim_type == 5
      letter.anim_offset = 0
    end
    letter.galv_ani = get_galvani
    if @rainbow
      letter.rainbow = true
      letter.rainbow_offset = @animchars.size * 0.5
    end
  end
  #--------------------------------------------------------------------------
  # * Control Character Processing | Alias
  #     code : the core of the control character
  #            e.g. "C" in the case of the control character \C[1].
  #--------------------------------------------------------------------------
  alias tuckie_wiggly_process_escape_character process_escape_character
  def process_escape_character(code, text, pos)
    case code.upcase
    when 'ANI' # Text Animation (by number)
      @anim_type = obtain_escape_param(text)
    when 'OFF' # No Text Animation
      @anim_type = 7 if WiggleText::DROP_IN
      @rainbow = false
    when 'WAV' # Wave animation
      @anim_type = 1
    when 'SHK' # Shake Screen
      $game_map.screen.start_shake(obtain_escape_param(text), 15, 10)
    when 'RAN'
      @rainbow = true
    when 'BLN'
      @rainbow = false
    when 'MOJ'
      process_anim_emoji(obtain_escape_param(text), pos)
    when 'NAM'
      process_name(obtain_escape_param(text), pos)
    when 'LIN'
      pos[:y] -= WiggleText::LINE_HEIGHT
    end
    tuckie_wiggly_process_escape_character(code, text, pos)
  end
  #--------------------------------------------------------------------------
  # * Close Window and Wait for It to Fully Close | Alias
  #--------------------------------------------------------------------------
  alias tuckie_wiggly_close_wait close_and_wait
  def close_and_wait
    dispose_text_animation()
    tuckie_wiggly_close_wait()
  end
  #--------------------------------------------------------------------------
  # * Close Window and Wait for It to Fully Close | Alias
  #--------------------------------------------------------------------------
  alias tuckie_wiggly_dispose dispose
  def dispose
    dispose_text_animation()
    tuckie_wiggly_dispose()
  end
  #--------------------------------------------------------------------------
  # * New Page | Alias
  #--------------------------------------------------------------------------
  alias tuckie_wiggly_new_page new_page
  def new_page(*args)
    dispose_text_animation()
    tuckie_wiggly_new_page(*args)
  end
  #--------------------------------------------------------------------------
  # * Free animated text | New Method
  #--------------------------------------------------------------------------
  def dispose_text_animation
    @animchars.each do |letter|
      letter.dispose
    end
    @animchars = []
    @anim_type = 7
  end
  #--------------------------------------------------------------------------
  # * Update Fast Forward Flag | Alias
  #--------------------------------------------------------------------------
  alias tuckie_wiggle_update_show_fast update_show_fast
  def update_show_fast
    tuckie_wiggle_update_show_fast()
    @show_fast = false if !WiggleText::SKIP_CHAR
  end
  #--------------------------------------------------------------------------
  # * Galv Animated Textbox | Alias
  #--------------------------------------------------------------------------
  def get_galvani # new method
    return @anim_offset
  end

  def tuckie_update # new method
    @anim_offset += 0.015
  end

  #--------------------------------------------------------------------------
  # * Window Update | Alias
  #--------------------------------------------------------------------------
  alias tuckie_wiggly_update_base update
  def update
    tuckie_update
    update_text_animation()
    tuckie_wiggly_update_base()
  end
  #--------------------------------------------------------------------------
  # * Text Animation Processing | New Method
  #--------------------------------------------------------------------------
  def update_text_animation()
    unless @animchars.empty?
      @animchars.each do |letter|
        letter.update
      end
    end
  end

end
# end of script :) have a nice one thankz for looking

I would greatly appreciate help making these scripts compatible. If it can't be done then it isn't a big deal, but I would still like to try!
Change one line in wiggly script and it will work with yanfly.
But I don't think it will be compatible with sfonts at all.
Line 224/225 change to this
Ruby:
   letter.x = pos[:x] + self.standard_padding + 9 + self.x
Change one line in wiggly script and it will work with yanfly.
But I don't think it will be compatible with sfonts at all.
Line 224 change to this
Ruby:
    letter.x = pos[:x] + self.standard_padding + 9 + ((Graphics.width - window_width) / 2)
That fixes the Yanfly issue, thank you! As for the Sfont compatibility, could you explain why it wouldn't work? I would assume it would just be a matter of telling Tuckie's script to use the Sfont as the bitmap to draw characters from.
It's for the fact that it uses unique bitmaps with the graphic images.
Wiggle text uses
class Sprite_TextAnim < Sprite

SFonts uses the bitmap class directly with class SFont
If there is a way to make them work together it is far beyond my capabilities.
Ah, I see. Understood, thank you!
I found that the code above was not 100% fool proof. I updated it.
((Sorry for the necropost, if making a new thread is preferred I'll do that, just figured I'd post here since I'm working with Tuckie's script still.))

I managed to find a script that displays pixel fonts properly, Old RM Style by Joke, and it works with Tuckie's script, everything animates as it should, by all accounts it's exactly what I was looking for -- aside from one issue: the text color escape codes (\c[n]) don't seem to work when both scripts are active. They work when I'm using either one without the other, but once both are active they no longer work. I've also put them into a totally fresh project for testing, and I've attempted changing the script order, and still no luck. It is literally the only issue I'm still having, so finding a fix for it would be greatly appreciated.
It is literally the only issue I'm still having, so finding a fix for it would be greatly appreciated.
Cool, good to see everything workiing.
In tuckie script line 232. some data is missing so the color always defaults to 0.
change
bitmap.draw_text(0, 0, text_width+2, pos[:height], c)
to
bitmap.draw_text(0, 0, text_width+2, pos[:height], c, 0, @color_id)
then the color will get processed.
the 0 is the alignment, 0, 1, 2 didn't make any difference in my tests.
1772993809371.png
1772993833688.png
That works, thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/tuckie-wiggly-text-script-compatibility.160245/