[RGSS2 - RGSS3] IEX Extended Item Description Conversion?

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
Looking to have a short script converted from RGSS2 to RGSS3.

I've looked around and haven't really found a similar script for Ace that does this (though if you know of any then please let me know!), but this script in RMVX basically allows you to press a button of your choice while hovering over an item in the item scene, which would in turn bring up a little window that you could add text to.

It looks like a fairly short script but then again I am in no way Ruby inclined, so if it's easier to make something from scratch then let me know and I'll edit the topic accordingly!

Thanks in advance.

Code:
#==============================================================================## ** IEX(Icy Engine Xelion) - Extended Item Description#------------------------------------------------------------------------------## ** Created by    : IceDragon ([URL="http://www.rpgmakervx.net/"]http://www.rpgmakervx.net/[/URL])# ** Script-Status : Addon (Item Scene)# ** Script Type   : Extended Description# ** Date Created  : 12/03/2010# ** Date Modified : 12/04/2010# ** Requested By  : phropheus# ** Version       : 1.0#------------------------------------------------------------------------------##==============================================================================## ** INTRODUCTION#------------------------------------------------------------------------------## This adds a little description window to the item scene, you can then# write a larger description for the item using the specified tags.# #------------------------------------------------------------------------------##==============================================================================## ** FEATURES#------------------------------------------------------------------------------## 1.0#  Notetags! Placed in Item, Weapons, Armor noteboxes # (Anything that can be seen in the item scene)#------------------------------------------------------------------------------## <ex_description>#  Your description goes here# </ex_description>##------------------------------------------------------------------------------##==============================================================================## ** COMPATABLITIES#------------------------------------------------------------------------------## # Default Item Scene ##------------------------------------------------------------------------------##==============================================================================## ** CHANGE LOG#------------------------------------------------------------------------------### 12/04/2010 - V1.0 Completed Script ##------------------------------------------------------------------------------##==============================================================================## ** KNOWN ISSUES#------------------------------------------------------------------------------#  ##  Non at the moment##------------------------------------------------------------------------------#$imported = {} if $imported == nil$imported["IEX_EX_Description"] = true#==============================================================================# ** IEX::ITEM_EX_DES#------------------------------------------------------------------------------#==============================================================================module IEX  module ITEM_EX_DES#==============================================================================#                           Start Customization#------------------------------------------------------------------------------#==============================================================================   #--------------------------------------------------------------------------#  # * DESCRIPTION_POS  #--------------------------------------------------------------------------#  # This is the position and opacity of the description window.  # Its closed, so you won't see it on opening the item scene  # DESCRIPTION_POS = [x, y, width, height, opacity]  #--------------------------------------------------------------------------#    DESCRIPTION_POS = [0, Graphics.height - 192, Graphics.width, 192, 255]  #--------------------------------------------------------------------------#  # * BUTTON  #--------------------------------------------------------------------------#  # This is the button which toggles the Description window open/closed  #--------------------------------------------------------------------------#    BUTTON    = Input::SHIFT  #--------------------------------------------------------------------------#  # * SCROLL_DELAY  #--------------------------------------------------------------------------#  # If the description size exceeds the windows height, then it will scroll  # down, the more the delay the slower it scrolls.  #--------------------------------------------------------------------------#    SCROLL_DELAY = 1  #--------------------------------------------------------------------------#  # * SFX  #--------------------------------------------------------------------------#  # These are the sfx played when the window is opened/closed  # If you don't want any SFX use this :  # ["", 0, 100]  #--------------------------------------------------------------------------#    OPEN_SFX  = ["Book", 60, 100]    CLOSE_SFX = ["Thunder3", 60, 100]  #--------------------------------------------------------------------------#  # * DRAW_ITEM  #--------------------------------------------------------------------------#  # DRAW_ITEM will write the items name  # DRAW_ICON will draw the items icon  # DRAW_RECT is used with DRAW_ICON to border it  # *Common Sense, don't use DRAW_RECT without DRAW_ICON... It looks retarted.  # RECT_SIZE = [x, y, width, height]  # ICON_OPOS = [ox, oy]  # TEXT_OPOS = [ox, oy]  #--------------------------------------------------------------------------#      DRAW_ITEM = true    DRAW_RECT = true    DRAW_ICON = true    RECT_SIZE = [4, 4, 32, 32]    ICON_OPOS = [4, 4]    TEXT_OPOS = [40, 12]#==============================================================================#                           End Customization#------------------------------------------------------------------------------#==============================================================================   endend#==============================================================================# ** IEX::IString#------------------------------------------------------------------------------#==============================================================================module IEX  module IString        # Converts a single line string into an array, with a max char per line    # This may come out ackward at times    def self.text_to_array(wtext, char_per_line)      text = wtext.scan(/./).clone      coun = 0      rindex = 0      arra = []      last = 0      arra[rindex] = ''      allow_next = false      text.each { |ch|         allow_next = false        arra[rindex] += ch.to_s        coun += 1        if arra[rindex].scan(/./m).size >= char_per_line and ch.to_s == ' '          allow_next = true        end          if arra[rindex].scan(/./m).size >= char_per_line and allow_next          rindex += 1          arra[rindex] = ''          coun = 0        end        }       return arra    end      endend#==============================================================================# ** RPG::BaseItem#------------------------------------------------------------------------------#==============================================================================class RPG::BaseItem      def iex_xtend_des_cache    @ex_description = ''    ds_on = false    self.note.split(/[\r\n]+/).each { |line|    case line    when /<(?:EX_DESCRIPTION|ex description)>/i      ds_on = true    when /<\/(?:EX_DESCRIPTION|ex description)>/i      ds_on = false    else      if ds_on        @ex_description += line.to_s      end      end      }  end    def ex_description    iex_xtend_des_cache if @ex_description == nil    return @ex_description   end  end#==============================================================================# ** Scene_Title#------------------------------------------------------------------------------#==============================================================================class Scene_Title < Scene_Base  alias iex_xtend_des_load_database load_database unless $@  def load_database    iex_xtend_des_load_database    load_xtend_des_cache  end    def load_xtend_des_cache    for obj in $data_items + $data_weapons + $data_armors      next if obj == nil      obj.iex_xtend_des_cache    end    end  end#==============================================================================# ** Window_Base#------------------------------------------------------------------------------#==============================================================================class Window_Base < Window    #--------------------------------------------------------------------------  # * Draw Border Rect  #     x     : draw spot x-coordinate  #     y     : draw spot y-coordinate  #    width  : Rect width  #    height : Rect height  #    border : Border Size  #    color  : Rect Color  #--------------------------------------------------------------------------    def draw_border_rect(x, y, width, height, border = 4, color = system_color, enabled = true)    outline = Rect.new(0, 0, width, height)    sub_rect = Rect.new((border / 2), (border / 2), (outline.width - border), (outline.height - border))    outline_sprite = Bitmap.new(outline.width, outline.height)    outline_sprite.fill_rect(outline, color)    outline_sprite.clear_rect(sub_rect)    self.contents.blt(x, y, outline_sprite, outline, enabled ? 255 : 128)  end  end#==============================================================================# ** IEX_ExDes_Window#------------------------------------------------------------------------------#==============================================================================class IEX_ExDes_Window < Window_Selectable    include IEX::ITEM_EX_DES    attr_accessor :scroll_delay_max  attr_accessor :scroll_delay    def initialize(x, y, width, height)    super(x, y, width, height)    @item = nil    @index = -1    @text_set = []    @item_max = 15    @scroll_delay = 10    @scroll_delay_max = SCROLL_DELAY  end  def set_item(item)    return if @item == item    @item = item    self.contents.clear    @text_set = []    return if @item == nil    @scroll_delay = @scroll_delay_max    self.oy = 0    self.contents.font.size = 18    char_lim = 74    @text_set = IEX::IString.text_to_array(@item.ex_description, char_lim)    @item_max = @text_set.size    create_contents    if DRAW_ITEM      if DRAW_RECT        rect = Rect.new(RECT_SIZE[0], RECT_SIZE[1], RECT_SIZE[2], RECT_SIZE[3])        self.contents.fill_rect(rect, Color.new(166, 124, 82, 128))        draw_border_rect(rect.x, rect.y, rect.width, rect.height, 4, Color.new(126, 84, 42))      end      if DRAW_ICON        draw_icon(@item.icon_index, RECT_SIZE[0] + ICON_OPOS[0], RECT_SIZE[1] + ICON_OPOS[1])      end        self.contents.font.color = system_color        self.contents.font.size = 21      self.contents.draw_text(TEXT_OPOS[0], TEXT_OPOS[1], self.contents.width - TEXT_OPOS[0], 24, @item.name)    end      self.contents.font.color = normal_color    self.contents.font.size = 18    for i in 0..@item_max      draw_item(i)    end    end    def draw_item(index)    rect = item_rect(index)    tx = @text_set[index]    if DRAW_ITEM and DRAW_RECT      rect.y += RECT_SIZE[3] + RECT_SIZE[1]    end      self.contents.draw_text(rect.x, rect.y, self.width, 24, tx)  end    def update    super    update_help_scroll  end    def update_help_scroll    @scroll_delay -= 1 unless @scroll_delay == 0    if @scroll_delay == 0      if self.contents.height > self.height - 32        self.oy += 1        @scroll_delay = @scroll_delay_max        if (self.height + self.oy)-32 >= self.contents.height          self.oy = 0        end        end      end    end    def cursor_down(wrap = false) end  def cursor_up(wrap = false) end  def cursor_left(wrap = false) end  def cursor_right(wrap = false) end  def cursor_pageup(wrap = false) end  def cursor_pagedown(wrap = false) end       end#==============================================================================# ** Scene_Item#------------------------------------------------------------------------------#==============================================================================class Scene_Item < Scene_Base    alias iex_xd_si_start start unless $@  def start    op = IEX::ITEM_EX_DES::OPEN_SFX    cl = IEX::ITEM_EX_DES::CLOSE_SFX    @op_sfx = RPG::SE.new(op[0], op[1], op[2])    @cl_sfx = RPG::SE.new(cl[0], cl[1], cl[2])      iex_xd_si_start    exdes_pos = IEX::ITEM_EX_DES::DESCRIPTION_POS    @ex_des_window = IEX_ExDes_Window.new(exdes_pos[0], exdes_pos[1], exdes_pos[2], exdes_pos[3])    @ex_des_window.opacity = exdes_pos[4]    @ex_des_window.openness = 0    end    alias iex_xd_si_terminate terminate unless $@  def terminate    if @ex_des_window != nil      @ex_des_window.dispose      @ex_des_window = nil    end     iex_xd_si_terminate   end    alias iex_xd_si_update update unless $@  def update    iex_xd_si_update    if @ex_des_window != nil      if Input.trigger?(IEX::ITEM_EX_DES::BUTTON)        if @ex_des_window.openness > 0          @ex_des_window.close          @cl_sfx.play        else          @op_sfx.play          @ex_des_window.open        end                end        @ex_des_window.set_item(@item_window.item)      @ex_des_window.update    end   end  end
 

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Try not to post a script directly somewhere other than the original post.

Just give a link to the original post will do much better for devs that only need little info on how that script works before they actually dig deep into a full script written by someone else.

bring up a little window that you could add text to.
I almost point you to a text input script from that statement.  ;)

And what you want seems to be a mouse function (no infos from you on that, so i am just guessing), some mouse script already supports that, hover mouse over object to show text above them, and you can probably get that part to work with the scroll script. some supports right click to show commands window too, and you can simply just add a window with text there using eventing.
 

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
Try not to post a script directly somewhere other than the original post.

Just give a link to the original post will do much better for devs that only need little info on how that script works before they actually dig deep into a full script written by someone else.

I almost point you to a text input script from that statement.  ;)

And what you want seems to be a mouse function (no infos from you on that, so i am just guessing), some mouse script already supports that, hover mouse over object to show text above them, and you can probably get that part to work with the scroll script. some supports right click to show commands window too, and you can simply just add a window with text there using eventing.
Nah, nothing to do with mouse functions or text input - should clarify somewhat, you add a text in the notebox of an item, and it is displayed in a little box that displays after you press shift (or whatever button) over the item in the item scene.

Trying to hunt down the script is a little difficult, it was originally by IceDragon and I believe he's not as active here anymore, plus it was posted wayyy back on the old VX.net forums, which are gone. The most direct link I could find was here, but it's bundled up with some other scripts I believe.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
346
Primarily Uses
The only major thing I could see that absolutely needed converting was loading the tags on database load. However, the scrolling text on extra long description seems to be broken. I can take a closer look at it if you intend to have more text than fits that extended box, but otherwise I just disabled it for now.

I mean, I know there's little things like spacing is hardcoded in VX versus Ace has the spacing variable, but I'll look into that if it's something that affects your game.

Code:
#==============================================================================## ** IEX(Icy Engine Xelion) - Extended Item Description#------------------------------------------------------------------------------## ** Created by    : IceDragon ([URL="http://www.rpgmakervx.net/"]http://www.rpgmakervx.net/[/URL])# ** Script-Status : Addon (Item Scene)# ** Script Type   : Extended Description# ** Date Created  : 12/03/2010# ** Date Modified : 12/04/2010# ** Requested By  : phropheus# ** Version       : 1.0#------------------------------------------------------------------------------##==============================================================================## ** INTRODUCTION#------------------------------------------------------------------------------## This adds a little description window to the item scene, you can then# write a larger description for the item using the specified tags.##------------------------------------------------------------------------------##==============================================================================## ** FEATURES#------------------------------------------------------------------------------## 1.0#  Notetags! Placed in Item, Weapons, Armor noteboxes# (Anything that can be seen in the item scene)#------------------------------------------------------------------------------## <ex_description>#  Your description goes here# </ex_description>##------------------------------------------------------------------------------##==============================================================================## ** COMPATABLITIES#------------------------------------------------------------------------------### Default Item Scene##------------------------------------------------------------------------------##==============================================================================## ** CHANGE LOG#------------------------------------------------------------------------------### 12/04/2010 - V1.0 Completed Script##------------------------------------------------------------------------------##==============================================================================## ** KNOWN ISSUES#------------------------------------------------------------------------------#  ##  Non at the moment##------------------------------------------------------------------------------#$imported = {} if $imported == nil$imported["IEX_EX_Description"] = true#==============================================================================# ** IEX::ITEM_EX_DES#------------------------------------------------------------------------------#==============================================================================module IEX  module ITEM_EX_DES#==============================================================================#                           Start Customization#------------------------------------------------------------------------------#==============================================================================  #--------------------------------------------------------------------------#  # * DESCRIPTION_POS  #--------------------------------------------------------------------------#  # This is the position and opacity of the description window.  # Its closed, so you won't see it on opening the item scene  # DESCRIPTION_POS = [x, y, width, height, opacity]  #--------------------------------------------------------------------------#    DESCRIPTION_POS = [0, Graphics.height - 192, Graphics.width, 192, 255]  #--------------------------------------------------------------------------#  # * BUTTON  #--------------------------------------------------------------------------#  # This is the button which toggles the Description window open/closed  #--------------------------------------------------------------------------#    BUTTON    = Input::SHIFT  #--------------------------------------------------------------------------#  # * SCROLL_DELAY  #--------------------------------------------------------------------------#  # If the description size exceeds the windows height, then it will scroll  # down, the more the delay the slower it scrolls.  #--------------------------------------------------------------------------#    SCROLL_DELAY = 1  #--------------------------------------------------------------------------#  # * SFX  #--------------------------------------------------------------------------#  # These are the sfx played when the window is opened/closed  # If you don't want any SFX use this :  # ["", 0, 100]  #--------------------------------------------------------------------------#    OPEN_SFX  = ["", 60, 100]    CLOSE_SFX = ["", 60, 100]  #--------------------------------------------------------------------------#  # * DRAW_ITEM  #--------------------------------------------------------------------------#  # DRAW_ITEM will write the items name  # DRAW_ICON will draw the items icon  # DRAW_RECT is used with DRAW_ICON to border it  # *Common Sense, don't use DRAW_RECT without DRAW_ICON... It looks retarted.  # RECT_SIZE = [x, y, width, height]  # ICON_OPOS = [ox, oy]  # TEXT_OPOS = [ox, oy]  #--------------------------------------------------------------------------#      DRAW_ITEM = true    DRAW_RECT = true    DRAW_ICON = true    RECT_SIZE = [4, 4, 32, 32]    ICON_OPOS = [4, 4]    TEXT_OPOS = [40, 12]#==============================================================================#                           End Customization#------------------------------------------------------------------------------#==============================================================================  endend#==============================================================================# ** IEX::IString#------------------------------------------------------------------------------#==============================================================================module IEX  module IString        # Converts a single line string into an array, with a max char per line    # This may come out ackward at times    def self.text_to_array(wtext, char_per_line)      text = wtext.scan(/./).clone      coun = 0      rindex = 0      arra = []      last = 0      arra[rindex] = ''      allow_next = false      text.each { |ch|        allow_next = false        arra[rindex] += ch.to_s        coun += 1        if arra[rindex].scan(/./m).size >= char_per_line and ch.to_s == ' '          allow_next = true        end          if arra[rindex].scan(/./m).size >= char_per_line and allow_next          rindex += 1          arra[rindex] = ''          coun = 0        end        }      return arra    end      endend#==============================================================================# ** RPG::BaseItem#------------------------------------------------------------------------------#==============================================================================class RPG::BaseItem      def iex_xtend_des_cache    @ex_description = ''    ds_on = false    self.note.split(/[\r\n]+/).each { |line|    case line    when /<(?:EX_DESCRIPTION|ex description)>/i      ds_on = true    when /<\/(?:EX_DESCRIPTION|ex description)>/i      ds_on = false    else      if ds_on        @ex_description += line.to_s      end      end      }  end   def ex_description    iex_xtend_des_cache if @ex_description == nil    return @ex_description  end end#==============================================================================# ** Data Manager#------------------------------------------------------------------------------#==============================================================================module DataManager  class << self; alias iex_xtend_des_load_database load_normal_database; end  def self.load_normal_database    iex_xtend_des_load_database    load_xtend_des_cache  end   def self.load_xtend_des_cache    for obj in $data_items + $data_weapons + $data_armors      next if obj == nil      obj.iex_xtend_des_cache    end    end end#==============================================================================# ** Window_Base#------------------------------------------------------------------------------#==============================================================================class Window_Base < Window   #--------------------------------------------------------------------------  # * Draw Border Rect  #     x     : draw spot x-coordinate  #     y     : draw spot y-coordinate  #    width  : Rect width  #    height : Rect height  #    border : Border Size  #    color  : Rect Color  #--------------------------------------------------------------------------    def draw_border_rect(x, y, width, height, border = 4, color = system_color, enabled = true)    outline = Rect.new(0, 0, width, height)    sub_rect = Rect.new((border / 2), (border / 2), (outline.width - border), (outline.height - border))    outline_sprite = Bitmap.new(outline.width, outline.height)    outline_sprite.fill_rect(outline, color)    outline_sprite.clear_rect(sub_rect)    self.contents.blt(x, y, outline_sprite, outline, enabled ? 255 : 128)  end end#==============================================================================# ** IEX_ExDes_Window#------------------------------------------------------------------------------#==============================================================================class IEX_ExDes_Window < Window_Selectable   include IEX::ITEM_EX_DES   attr_accessor :scroll_delay_max  attr_accessor :scroll_delay   def initialize(x, y, width, height)    super(x, y, width, height)    self.z += 100    @item = nil    @index = -1    @text_set = []    @item_max = 15    @scroll_delay = 10    @scroll_delay_max = SCROLL_DELAY  end  def set_item(item)    return if @item == item    @item = item    self.contents.clear    @text_set = []    return if @item == nil    @scroll_delay = @scroll_delay_max    self.oy = 0    self.contents.font.size = 18    char_lim = 74    @text_set = IEX::IString.text_to_array(@item.ex_description, char_lim)    @item_max = @text_set.size    create_contents    if DRAW_ITEM      if DRAW_RECT        rect = Rect.new(RECT_SIZE[0], RECT_SIZE[1], RECT_SIZE[2], RECT_SIZE[3])        self.contents.fill_rect(rect, Color.new(166, 124, 82, 128))        draw_border_rect(rect.x, rect.y, rect.width, rect.height, 4, Color.new(126, 84, 42))      end      if DRAW_ICON        draw_icon(@item.icon_index, RECT_SIZE[0] + ICON_OPOS[0], RECT_SIZE[1] + ICON_OPOS[1])      end        self.contents.font.color = system_color        self.contents.font.size = 21      self.contents.draw_text(TEXT_OPOS[0], TEXT_OPOS[1], self.contents.width - TEXT_OPOS[0], 24, @item.name)    end      self.contents.font.color = normal_color    self.contents.font.size = 18    for i in 0..@item_max      draw_item(i)    end    end   def draw_item(index)    rect = item_rect(index)    tx = @text_set[index]    if DRAW_ITEM and DRAW_RECT      rect.y += RECT_SIZE[3] + RECT_SIZE[1]    end      self.contents.draw_text(rect.x, rect.y, self.width, 24, tx)  end   def update    super    #update_help_scroll  end   def update_help_scroll    @scroll_delay -= 1 unless @scroll_delay == 0    if @scroll_delay == 0      if self.contents.height > self.height        self.oy += 1        @scroll_delay = @scroll_delay_max        if ((self.height + self.oy) - spacing) >= self.contents.height          self.oy = 0        end        end      end    end   def cursor_down(wrap = false) end  def cursor_up(wrap = false) end  def cursor_left(wrap = false) end  def cursor_right(wrap = false) end  def cursor_pageup(wrap = false) end  def cursor_pagedown(wrap = false) end       end#==============================================================================# ** Scene_Item#------------------------------------------------------------------------------#==============================================================================class Scene_Item < Scene_ItemBase   alias iex_xd_si_start start unless $@  def start    op = IEX::ITEM_EX_DES::OPEN_SFX    cl = IEX::ITEM_EX_DES::CLOSE_SFX    @op_sfx = RPG::SE.new(op[0], op[1], op[2])    @cl_sfx = RPG::SE.new(cl[0], cl[1], cl[2])      iex_xd_si_start    exdes_pos = IEX::ITEM_EX_DES::DESCRIPTION_POS    @ex_des_window = IEX_ExDes_Window.new(exdes_pos[0], exdes_pos[1], exdes_pos[2], exdes_pos[3])    @ex_des_window.opacity = exdes_pos[4]    @ex_des_window.openness = 0    end   alias iex_xd_si_terminate terminate unless $@  def terminate    if @ex_des_window != nil      @ex_des_window.dispose      @ex_des_window = nil    end    iex_xd_si_terminate  end   alias iex_xd_si_update update unless $@  def update    iex_xd_si_update    if @ex_des_window != nil      if Input.trigger?(IEX::ITEM_EX_DES::BUTTON)        if @ex_des_window.openness > 0          @ex_des_window.close          @cl_sfx.play        else          @op_sfx.play          @ex_des_window.open        end                end        @ex_des_window.set_item(@item_window.item)      @ex_des_window.update    end  end end
 

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
Didn't need the scrolling with the resolution I'm using - works like a charm, thank you!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,881
Messages
1,017,227
Members
137,607
Latest member
Maddo
Top