Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Looking for Item/Weapon/Armor/Skill Description Script

[ This request has been solved! I couldn't write that into the subject, because there wasn't enough room. ]

Detailed Description:
Somewhere in here is a script that lets a description text scroll in its window, should it be too long (instead of squeezing it together). But the thing is: I can't find it! I've looked through the actual Script forum and the Script Archive, but looked for it in vain there...
I'm asking for a link to the topic of that script. And in case that script doesn't exist (anymore), I request one to be made.

Other Scripts I am using:
No custom ones... yet.


Credit will obviously be given.

Edit: Thanks to kyurianne, I've got my hands on that script. He/She sent it to me via PM, so I'm going to post it right here.

Code:
class Sprite

 

  def draw_icon(icon_index, x, y, enabled = true)

    bitmap = Cache.system("Iconset")

    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)

    self.bitmap.blt(x, y, bitmap, rect, enabled ? 255 : 128)

  end

 

end

 

class Window_Help < Window_Base

 

  @@SCROLL_DELAY = 1      # seconds

  @@SCROLL_SPEED = 1      # pixels / frame (60 frames / sec)

  @@SHOW_ICONS   = false  # display icons for items and skills?

 

  alias :pre_scrolling_initialize :initialize

  def initialize

    pre_scrolling_initialize

    @internal_frame_count = 0

    @text_is_long = false

    @icon_sprite = Sprite.new

    @icon_sprite.x = self.x + 16

    @icon_sprite.y = self.y + 16

    @icon_sprite.z = self.z + 1

    @icon_sprite.bitmap = Bitmap.new(32, 32)

  end

     

  def set_text(text, align = 0)

    unless (text == @text) && (align == @align)

      @internal_frame_count = 0

      txt_width = self.contents.text_size(text).width

      @text_is_long = txt_width > (self.width - 32)  

      self.contents.dispose

      w = @text_is_long ? (txt_width + self.width - 32) : self.width - 32

      self.contents = Bitmap.new(w, self.height - 32)                

      self.contents.clear  

      self.ox = 0

      self.contents.font.color = normal_color

      if ((i = get_icon_index(text)) != nil)

        draw_sprite(i, 0, 0)

        self.contents.draw_text(32, 0, self.contents.width, WLH, text, align)

      else

        @icon_sprite.bitmap.clear

        self.contents.draw_text(4, 0, self.contents.width, WLH, text, align)

      end

      @text = text

      @align = align

    end    

  end

 

  def draw_sprite(icon_index, x, y)

    @icon_sprite.bitmap.clear

    bitmap = Graphics.snap_to_bitmap

    rect = Rect.new(@icon_sprite.x, @icon_sprite.x,

                    @icon_sprite.bitmap.width, @icon_sprite.bitmap.height)

    @icon_sprite.bitmap.blt(x, y, bitmap, rect)

    @icon_sprite.draw_icon(icon_index, x, y)

  end

 

  def get_icon_index(desc)

    return nil unless @@SHOW_ICONS

    for item in $data_items

      return item.icon_index if !item.nil? && item.description == desc

    end

    for skill in $data_skills

      return skill.icon_index if !skill.nil? && skill.description == desc

    end

    return nil    

  end

 

  def update

    super

    @internal_frame_count += 1

    if ((@internal_frame_count > @@SCROLL_DELAY * 60) && @text_is_long)

      if self.ox >= (self.contents.width - self.width + 48)      

        self.ox = 0

        @internal_frame_count = 0

      else

        self.ox += @@SCROLL_SPEED

      end

    end

  end

 

  def dispose

    super

    @icon_sprite.dispose

  end

 

end

If someone could tell me whose script that is, I'd be grateful.
 
Hey,
I got a script similair like what you describe, but it features also to show the icon of the item in the info bar. But i don't know who created it :(
So I'm not sure if I'm allowed to post it so if interested I'll pm it to you.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top