RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] State Icon Scroll

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
State Icon Scroll
Version: 1.0c
Author: modern algebra
Date: January 20, 2012

Version History


  • <Version 1.0c> 2012.01.20 - Fixed a bug where scrolling state icons would not dispose when showing a different actor in the same window
  • <Version 1.0b> 2012.01.05 - Fixed a big bug where states were not showing up where they were supposed to be showing up in the battle scene
  • <Version 1.0a> 2012.01.05 - Fixed a small bug where the opacity of the states corresponded to the incorrect value
  • <Version 1.0> 2012.01.02 - Original Release

Description


This script allows you to set it so that if an actor is afflicted with many states and buffs, it will scroll through them instead of only showing the first four.

Features

  • Allows you to show more than just four states and buffs if an actor is afflicted by more
  • Can choose to either smoothly scroll or flash to the next icons
  • Can precisely control the speed and how much time to pause on each icon

Screenshots


A picture of the icons in mid-scroll

Instructions

Paste this script into its own slot in the Script Editor, above Main and below Materials.

This script is plug & play and will show up in any window, but if you so desire, you can set the speed, pause time, and which windows this feature will be available. See the Editable Region beginning at line 28 for more details.

Script


Code: [Select]
#==============================================================================
#    State Icon Scroll
#    Version: 1.0c
#    Author: modern algebra (rmrk.net)
#    Date: January 20, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to set it so that if an actor is afflicted with
#   many states and buffs, it will scroll through them instead of only showing
#   the first four.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Paste this script into its own slot in the Script Editor, above Main and
#   below Materials.
#
#    This script is plug & play and will show up in any window, but if you so
#   desire, you can set the speed, pause time, and which windows this feature
#   will be available. See the Editable Region beginning at line 29 for more
#   details.
#==============================================================================

$imported = {} unless $imported
$imported[:MA_StateIconScroll] = true

MASIS_SCROLL_SETTINGS = {
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  #  Editable Region
  #````````````````````````````````````````````````````````````````````````````
  #  For all of the following options, you may only alter the part that comes
  # after the colon. Each line except the last should end in a comma.
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  scroll_speed:  This value controls how many pixels the states will scroll
  # every frame. If between 0 and 24, then it will scroll smoothly. If set to
  # 0, it will be in flash mode, meaning it will show as many states as it can,
  # then get rid of them immediately and show the next states, and so on. If
  # set to a value greater than 23, then it must be a multiple of 24, and it
  # will flash by as many icons as you specify.
  scroll_speed:    2,
  #  pause_time:  This value determines how much time to wait once it reaches
  # the next icon. There are 60 frames in one second.
  pause_time:      60,
  #  windows_enabled:  This array allows you to specify which windows it will
  # work in. :Window_Base means it will show up in every window, but you could,
  # for instance, replace it with something like this:
  #    [:Window_BattleStatus, :Window_Status]
  #  Then the states would only scroll in the Status and Battle Scenes, and not
  # in the Main Menu or any other scene. It is recommended that you just keep
  # it as [:Window_Base]
  windows_enabled: [:Window_Base]
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  END Editable Region
  #////////////////////////////////////////////////////////////////////////////
}

if MASIS_SCROLL_SETTINGS[:scroll_speed] > 24
  MASIS_SCROLL_SETTINGS[:scroll_speed] /= 24
  MASIS_SCROLL_SETTINGS[:scroll_speed] *= 24
end

#==============================================================================
#    Sprite_IconScroll
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This sprite shows the icons of all states and buffs and scrolls through them
#==============================================================================

class Sprite_IconScroll < Sprite_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(viewport, x, y, width, icons = [], icon_hues = [])
    super(viewport)
    @last_paused_ox = 0
    @scroll_pause_time = MASIS_SCROLL_SETTINGS[:pause_time]
    reset(x, y, width, icons, icon_hues)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update
    super
    # If paused, wait until time finishes
    if @scroll_pause_time >= 0
      update_pause
    else
      update_scroll
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Pause
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_pause
    @scroll_pause_time -= 1
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Scroll
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_scroll
    # If flashing through all icons
    if MASIS_SCROLL_SETTINGS[:scroll_speed] == 0
      self.src_rect.x += self.src_rect.width # Go to the next set of icons
      @scroll_pause_time = MASIS_SCROLL_SETTINGS[:pause_time] # Reset pause
      self.src_rect.x = 0 if self.src_rect.x >= bitmap.width
    elsif MASIS_SCROLL_SETTINGS[:scroll_speed] <= 24
      self.src_rect.x += MASIS_SCROLL_SETTINGS[:scroll_speed]
      if self.src_rect.x >= @last_paused_ox + 24 # Make sure stops on an icon
        # If at the point where repeating original icons, reset src_rect.x
        self.src_rect.x = (@last_paused_ox + 24) % @restart_x
        @last_paused_ox = self.src_rect.x
        @scroll_pause_time = MASIS_SCROLL_SETTINGS[:pause_time] # Reset pause
      end
    else
      self.src_rect.x += MASIS_SCROLL_SETTINGS[:scroll_speed]
      @scroll_pause_time = MASIS_SCROLL_SETTINGS[:pause_time] # Reset pause
      self.src_rect.x %= @restart_x
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Dispose
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dispose
    bitmap.dispose if bitmap
    super
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reset
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reset(x, y, width, icons = [], icon_hues = [])
    self.x = x
    self.y = y
    @restart_x = icons.size*24
    src_x = src_rect.x if src_rect
    # Only create the icons buffer if not on Flash All mode.
    w = MASIS_SCROLL_SETTINGS[:scroll_speed] == 0 ? 0 : width
    bitmap.dispose if bitmap
    self.bitmap = Bitmap.new(@restart_x + w, 24)
    # Remember point at which to reset the src_rect
    src_rect.set(src_x ? src_x % @restart_x : 0, 0, width, 24)
    draw_bitmap(icons, icon_hues)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Bitmap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_bitmap(icons, icon_hues = [])
    # Unless it is simply flashing through each row
    if MASIS_SCROLL_SETTINGS[:scroll_speed] != 0
      # Create a buffer so that it can smoothly scroll
      icons += icons[0, viewport.rect.width / 24]
      icon_hues += icon_hues[0, viewport.rect.width / 24] unless icon_hues.empty?
    end
    # Draw all icons
    icons.each_with_index {|n, i|
      if icon_hues.size > 0 # Icon Hue Compatibility
        draw_icon_with_hue(n, icon_hues.shift, i*24, 0)
      else
        draw_icon(n, i*24, 0)
      end
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Icon (copied from the default Window_Base method)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_icon(icon_index, x, y)
    iconset = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    bitmap.blt(x, y, iconset, rect, 255)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Icon With Hue (Icon Hue Compatibility)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_icon_with_hue(icon_index, icon_hue, x, y)
    iconset = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    # Draw Icon onto small and independent bitmap
    icon_bmp = Bitmap.new(24, 24)
    icon_bmp.blt(0, 0, iconset, rect)
    icon_bmp.hue_change(icon_hue) # Change hue of icon
    rect.x, rect.y = 0, 0
    bitmap.blt(x, y, icon_bmp, rect, 255)
    icon_bmp.dispose # Dispose Icon Bitmap
  end
end

#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - initialize; draw_actor_icons; update; dispose
#    new method - dispose_icon_scroll_sprites; update_icon_scroll_sprites
#==============================================================================

class Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias masis_iniz_4hb5 initialize
  def initialize(*args, &block)
    # If an enabled window
    if MASIS_SCROLL_SETTINGS[:windows_enabled].any? {|win_sym| self.is_a?(Kernel.const_get(win_sym)) }
      @iconscroll_sprites = {}            # Initialize Sprite Hash
      @iconscroll_viewport = Viewport.new # Initialize Viewport
    end
    masis_iniz_4hb5(*args, &block) # Run Original Method
    update_icon_scroll_viewport if @iconscroll_viewport
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Actor Icons
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias masis_drwactoric_4jv3 draw_actor_icons
  def draw_actor_icons(actor, x, y, width = 96, *args)
    icons = (actor.state_icons + actor.buff_icons)
    if @iconscroll_sprites
      @iconscroll_sprites.each_pair {|key, val|
        dispose_icon_scroll_sprites(key) if val.x == x && val.y == y }
    end
    # If icons exceed the space given and this window enables state scroll
    if (width / 24) < icons.size && @iconscroll_sprites
      w = (width / 24) * 24
      icon_hues = []
      if $imported[:MAIcon_Hue] # Icon Hue Compatibility
        for state in actor.states
          icon_hues.push(state.icon_hue) if state.icon_index != 0
        end
      end
      if @iconscroll_sprites[actor.object_id]
        @iconscroll_sprites[actor.object_id].reset(x, y, w, icons, icon_hues)
      else
        dispose_icon_scroll_sprites(actor.object_id) if @iconscroll_sprites[actor.object_id]
        @iconscroll_sprites[actor.object_id] = Sprite_IconScroll.new(@iconscroll_viewport, x, y, w, icons, icon_hues)
      end
    else # Otherwise, resort to default method
      dispose_icon_scroll_sprites(actor.object_id) if @iconscroll_sprites[actor.object_id]
      masis_drwactoric_4jv3(actor, x, y, width, *args) # Run Original Method
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias masis_update_3ed4 update
  def update(*args, &block)
    update_icon_scroll_sprites if @iconscroll_sprites
    update_icon_scroll_viewport if @iconscroll_viewport
    masis_update_3ed4(*args, &block) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Icon Scroll Sprites
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_icon_scroll_sprites
    return unless @iconscroll_sprites
    @iconscroll_sprites.values.each {|sprite|
      sprite.update # Update each sprite
      # Match the opacity of the rest of the contents
      sprite.visible = self.visible
      sprite.opacity = self.contents_opacity
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup Icon Scroll Viewport
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_icon_scroll_viewport
    return unless @iconscroll_viewport
    # Update Viewport stats to match the contents.
    if viewport
      # Real position of the window
      vrect = viewport.rect
      x = vrect.x - viewport.ox + self.x + padding
      y = vrect.y - viewport.oy + self.y + padding
      w = [width - 2*padding, (vrect.x + vrect.width) - x].min
      h = [height - 2*padding, (vrect.y + vrect.height) - y].min
      @iconscroll_viewport.z = viewport.z + 1
      @iconscroll_viewport.visible = viewport.visible && self.open? && self.visible
    else
      x, y, w, h = self.x + padding, self.y + padding, width - 2*padding, height - 2*padding
      @iconscroll_viewport.z = self.z + 1
      @iconscroll_viewport.visible = self.open? && self.visible
    end
    @iconscroll_viewport.rect.set(x, y, w, h)
    @iconscroll_viewport.ox = self.ox
    @iconscroll_viewport.oy = self.oy
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Dispose Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias masis_disps_1qn6 dispose
  def dispose(*args, &block)
    # Dispose all scroll sprites
    dispose_icon_scroll_sprites(nil) if @iconscroll_sprites
    @iconscroll_viewport.dispose if @iconscroll_viewport # Dispose the viewport
    masis_disps_1qn6(*args, &block) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Dispose Icon Scroll Sprite
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dispose_icon_scroll_sprites(actor_id = nil)
    return unless @iconscroll_sprites
    if !actor_id # If nil, delete all Icon Scroll Sprites
      @iconscroll_sprites.keys.each {|a_id| dispose_icon_scroll_sprites(a_id) }
    elsif @iconscroll_sprites[actor_id] # If a sprite exists for that object
      # Delete the individual's sprite and remove it from the hash
      @iconscroll_sprites[actor_id].dispose
      @iconscroll_sprites.delete(actor_id)
    end
  end
end

Credit


  • modern algebra
Thanks
  • ziifee; his RMVX script inspired this one

Support


Please post in this topic at RMRK to report any errors or to ask any questions about this script.
« Last Edit: July 16, 2012, 02:14:31 PM by modern algebra »

**
Rep:
Level 72
RMRK Junior
Ha, I like this one. I'm gonna use it!
Thanks. The scrolling part is cool.

**
Rep: +0/-0Level 74
RMRK Junior
Is it just me or the icons in the main menu status don't scroll? They just appear, and disappear immediately.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
No, they ought to scroll and they certainly shouldn't disappear; that sounds like a bug. Are they working in other scenes?

I would like to recreate the error, so what are your configuration settings and how many states and buffs are applied? You can simply copy and paste your version of the script.

Also, are you using any menu script?

**
Rep: +0/-0Level 74
RMRK Junior
Oh i managed to make it work, my problems was that i changed the opacity of the status_window in the main menu, so since your script makes the icons to match the opacity, they became invisible. That's why they disappeared. But after i deleted that line it worked perfectly.
Thanks for this nice script :D

EDIT: I found a bug, this time im sure it is. In battle, if my character gets 4+ buffs/debuffs, the icons start scrolling, but they change position on screen. Here is a screenshot

I'm using Yanfly's Battle Engine with several addons.
« Last Edit: January 05, 2012, 11:11:55 PM by pinkapinkie »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Alright, thanks. I will look into it.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Alright, I updated the script to v. 1.0b. It should fix the error you are receiving; just grab it from the first post and replace the one you have.

The script probably needs to be redesigned and rewritten as the code is kind of embarrassing at this point, but it should work at least.

**
Rep: +0/-0Level 74
RMRK Junior
It works now! Thanks a lot!

**
Rep: +0/-0Level 74
RMRK Junior
I found another little bug, concerning Yanfly's Battle Engine probably. The problem is, when selecting skills or targets, there is a little window on the right side of the screen, which shows the actor's face and states, that when any actor has 4+ states, just takes the scrolling icons of the actor that has more states even if its not his turn.
This is a screenshot to show what i mean:

Now, this is the white haired girls turn, but the states displayed are not hers. Because she only had one buff when i took the screenshot.
This is YF battle engine for you to look at: http://yanflychannel.wordpress.com/rmvxa/battle-scripts/ace-battle-engine/

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, it's actually a logical problem solely on my end, unfortunately.

For now, try going to this part of the code, around line 210:

Code: [Select]
  alias masis_drwactoric_4jv3 draw_actor_icons
  def draw_actor_icons(actor, x, y, width = 96, *args)
    icons = (actor.state_icons + actor.buff_icons)
    # If icons exceed the space given and this window enables state scroll
    if (width / 24) < icons.size && @iconscroll_sprites

Replace it with:

Code: [Select]
  alias masis_drwactoric_4jv3 draw_actor_icons
  def draw_actor_icons(actor, x, y, width = 96, *args)
    icons = (actor.state_icons + actor.buff_icons)
    if @iconscroll_sprites
      @iconscroll_sprites.each_pair {|key, val|
        dispose_icon_scroll_sprites(key) if val.x == x && val.y == y }
    end
    # If icons exceed the space given and this window enables state scroll
    if (width / 24) < icons.size && @iconscroll_sprites

I might need to rewrite that script. I did it as a sprite since I did not want to be redrawing images onto contents every frame and because I wanted it not to interfere with things that might be drawn below it (as in that battle script you posted), but I think it causes more problems than it solves, especially in the realm of compatibility.
« Last Edit: January 20, 2012, 09:35:11 PM by modern algebra »

**
Rep: +0/-0Level 74
RMRK Junior
Ok, now it totally crashes, with an error like this: line 212 undefined method 'each_pair' for nil class

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Sorry, I had put the wrong fix up before, but I fixed it a couple minutes before you just posted. Reverse the earlier change and make the one that I suggest in the post above.

**
Rep: +0/-0Level 74
RMRK Junior
It works perfectly now! Thanks a lot :D

*
Rep: +0/-0Level 73
RMRK Junior
Hey MA!

awesome script! one tiny problem though. im using Yanfly's Ace Battle Engine, and everything works great, but the scrolling only happens while commands/magic/attacks are executing, otherwise it is paused.

tried changing the script order, but nothing changed.

pokeball ze1Offline
**
Rep: +0/-0Level 72
RMRK Junior
When I hide the window which contains the scroll icon, the window disappears, but the icon remains on the screen (though it stops being updated). Why is that? =(

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Go to this part in the script:

Code: [Select]

  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Icon Scroll Sprites
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_icon_scroll_sprites
    return unless @iconscroll_sprites
    @iconscroll_sprites.values.each {|sprite|
      sprite.update # Update each sprite
      # Match the opacity of the rest of the contents
      sprite.opacity = self.contents_opacity
    }
  end

Replace it with:

Code: [Select]

  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Icon Scroll Sprites
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_icon_scroll_sprites
    return unless @iconscroll_sprites
    @iconscroll_sprites.values.each {|sprite|
      sprite.update # Update each sprite
      # Match the opacity of the rest of the contents
      sprite.visible = self.visible
      sprite.opacity = self.contents_opacity
    }
  end

***
Rep:
Level 81
One suggestion, should your ever plan to update the script again:
Include the option to hide multiples of the same icon.
Like, if 3 states with the same icon are applied, only display the icon once.
This way we could have multiple buff or debuff states, without clogging up the 4 icon window.
I would love that feature.
Sincerely

***
hail satan buddy 666
Rep:
Level 55
Blagil VlUE
Love that feature, i suggest this is so cool to use it.
[

**
Rep: +0/-0Level 40
RMRK Junior
In case anyone else experiences the same issue I did...

I was getting a nil error from line 150 "can't convert nil into Array (TypeError)" and as I am not an expert at Ruby, I can't explain why. But I managed to figure out that after the first frame, where draw_bitmap combined the icons array with itself (to make the smooth rollover of the icons) the next frame was losing the ability to repeat it.

So, change that method to this, in order to fix the issue.
Code: [Select]
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Bitmap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_bitmap(icons, icon_hues = [])
    # Unless it is simply flashing through each row
    if MASIS_SCROLL_SETTINGS[:scroll_speed] != 0
      # Create a buffer so that it can smoothly scroll
      rollover = icons[0, viewport.rect.width / 24]
      icons += rollover if rollover
      icon_hues += icon_hues[0, viewport.rect.width / 24] unless icon_hues.empty?
    end
    # Draw all icons
    icons.each_with_index {|n, i|
      if icon_hues.size > 0 # Icon Hue Compatibility
        draw_icon_with_hue(n, icon_hues.shift, i*24, 0)
      else
        draw_icon(n, i*24, 0)
      end
    }
  end


Also note that icon_hues may also suffer from the same issue if its ever not empty. Having not run into a problem, I have left it alone.

I apologize if I am mistaken the actual issue. Just hoping to help. ;)