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.
Icons in Menu

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 73
Artista
2012 Best Artist2012 Best RPG Maker User (Graphical)2011 Best RPG Maker User (Graphical)Winner - 2011 Summer Project of the Season
I have (what I hope is) a simple request. I would like to have icons on the left side of the menu commands. Ideally, there would be a customization area of the script where I could input the Icon ID and the menu commands would be shifted to the right, so the icon doesn't overlap them.

The icons I'm using are 24x24 pixels in size.

I am using modern algebra's Quest Journal and Paragraph Formatter. So, there should be an icon for it as well. I'm not using any other menu scripts, but do let me know if you'd like a complete list of the scripts I'm using.

Thank you in advance!~
My current project:

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, you could do it using my Global Text Codes script. You'd just need to put \icon[id] before the names of each in the terms tab of the database. For the quest journal, you would need to go to where the label is set and do the same, except with an extra \

If there's a problem with that though, it would be easy enough to write up a more specific script for you.

*
Rep:
Level 73
Artista
2012 Best Artist2012 Best RPG Maker User (Graphical)2011 Best RPG Maker User (Graphical)Winner - 2011 Summer Project of the Season
That is a far simpler solution!

It works perfectly, not to mention that it gives me an opportunity to add some text formatting.  ^-^

Thank you so much!
My current project:

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Alternatively, you could use Erzengle's Database Icons script. I'm sure that MA's scripts is just as good, if not better, but ERZ's script worked fine for me. If you don't mind, I'll post the script here

Spoiler for Code:
Code: [Select]
#==============================================================================
# ** [ERZVX] Enhanced Bitmap#draw_text (by ERZENGEL at 27-April-2008 at 19:53)
#------------------------------------------------------------------------------
#  Bitmap#draw_text is able to convert control characters.
#==============================================================================
=begin
###############################################################################

Default control characters:

\V[n]    Replaced by the value of variable n (n = ID of a variable).
\N[n]    Replaced by the name of actor n (n = ID of an actor).
\C[n]    Change the color of the following text(n = 0 til 31).
\G       Replaced by the current gold amount.
\\       Replaced by the '\' character.

Control characters from woratanas NMS (v2.52):

\MAP      Replaced by the current map name.
\NC[n]    Replaced by the class of actor n (n = ID of an actor).
\NP[n]    Replaced by the name of actor n in the party (n = integer between 1 and 4).
\NM[n]    Replaced by the name of enemy n (n = ID of an enemy).
\NT[n]    Replaced by the name of troop n (n = ID of a troop).
\NI[n]    Replaced by the name of item n (n = ID of an item).
\NW[n]    Replaced by the name of weapon n (n = ID of a weapon).
\NA[n]    Replaced by the name of armor n (n = ID of an armor).
\NS[n]    Replaced by the name of skill n (n = ID of a skill).
\PRICE[n] Replaced by the price of the item n (n = ID of an item).
\IC[n]    Replaced by the icon with the index n (n = Index of icon in the Iconset).
\DW[n]    Replaced by the icon and name of weapon n (n = ID of a weapon).
\DI[n]    Replaced by the icon and name of item n (n = ID of an item).
\DA[n]    Replaced by the icon and name of armor n (n = ID of an armor).
\DS[n]    Replaced by the icon and name of skill n (n = ID of a skill).
\FN[str]  Following text is in font str (str = name of a font).
\FS[n]    Following text is in fontsize n (n = integer. Standard is 20).

Other control characters:

\BO       Following text is or isn't bold.
\IT       Following text is or isn't italic.
\SH       Folling text is or isn't shadowed.
\AL[n]    Align text (n = integer between 0 and 2 (0 = left, 1 = center, 2 = right)).

###############################################################################
=end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
  #--------------------------------------------------------------------------
  # * Draw text
  #--------------------------------------------------------------------------
  alias :erzvx_draw_text :draw_text unless $@
  def draw_text(*args)
    # Falls erstes Argument ein Rectobjekt ist
    if args[0].is_a?(Rect)
      if args.size > 3 then raise(ArgumentError) end
      x, y, width, height = args[0].x, args[0].y, args[0].width, args[0].height
      str = args[1]
      align = args[2]
    else
      if args.size > 6 then raise(ArgumentError) end
      x, y, width, height, str, align = args[0..5]
    end
    # Links ausrichten, falls Wert von align nil oder größer als 2 ist
    align = 0 if align.nil? || align > 2
    # Standardeigenschaften in Variablen speichern
    name, size,   color  = self.font.name, self.font.size,   self.font.color
    bold, italic, shadow = self.font.bold, self.font.italic, self.font.shadow
    # Temporäre Variablen erstellen
    tstr = (str.is_a?(String) ? str : str.to_s) + "\n";  tc = '';  tx = 0
    begin
      lasttstr = tstr.clone
      tstr = convert_special_characters(tstr)
    end until tstr == lasttstr
    while (!(c = tstr.slice!(/./m)).nil?)
      case c
      when "\x01"  # \C[n]
        tstr.sub!(/\[([0-9]+)\]/, "")
        tcolor = $1.to_i
        self.font.color = text_color(tcolor) if tcolor >= 0 && tcolor <= 31
      when "\x02"  # \C[n]
        tstr.sub!(/\[([0-2]+)\]/, "")
        align = $1.to_i       
      when "\x83"  # \IC[n]
        tstr.sub!(/\[([0-9]+)\]/, "")
        icon_index = $1.to_i
        draw_icon(icon_index, x, y)
        tx += 24
      when "\x84"  # \FN[*]
        tstr.sub!(/\[(.*?)\]/, "")
        self.font.name = $1.to_s
      when "\x85"  # \FS[n]
        tstr.sub!(/\[([0-9]+)\]/, "")
        self.font.size = $1.to_i
      when "\x88"  # \BO
        self.font.bold = !self.font.bold
      when "\x89"  # \IT
        self.font.italic = !self.font.italic
      when "\x93"  # \SH
        self.font.shadow = !self.font.shadow
      when "\n"    # Neue Zeile
        if align == 1     # Zentriert
          tx = width - tx
          tx = tx / 2
          erzvx_draw_text((x + tx), y, (width - tx), height, tc)
        elsif align == 2  # Rechts
          tx = width - tx
          erzvx_draw_text((x + tx), y, (width - tx), height, tc)
        end
        # Temporäre Variablen zurücksetzen
        tc = tstr = '';  tx = 0
      else         # Normal text character
        # Ausrichtungsabfrage (Links)
        if align == 0
          erzvx_draw_text((x + tx), y, width, height, c, align)
          tx += text_size(c).width
        else
          tc += c
          tx += text_size(c).width
        end
      end
    end
    # Standardeigenschaften wiederherstellen
    self.font.name, self.font.size,   self.font.color  = name, size,   color
    self.font.bold, self.font.italic, self.font.shadow = bold, italic, shadow
  end
  #--------------------------------------------------------------------------
  # * Convert Special Characters
  #--------------------------------------------------------------------------
  def convert_special_characters(str)
    # Mit Wert einer Variable ersetzen
    str.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    # Mit Namen eines Heldens ersetzen
    str.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    # Nachfolgenden Text in anderer Farbe anzeigen
    str.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
    # Mit dem aktuellen Goldbetrag ersetzen
    str.gsub!(/\\G/) { $game_party.gold.to_s }
    # Backslash anzeigen
    str.gsub!(/\\\\/) { "\\" }
    # Ausrichtung ändern
    str.gsub!(/\\AL\[([0-2]+)\]/i) { "\x02[#{$1}]" }
    # Woratana's :: Map Name
    str.gsub!(/\\MAP/i) { get_map_name }
    # Woratana's :: Actor Class Name
    str.gsub!(/\\NC\[([0-9]+)\]/i) {
      $data_classes[$data_actors[$1.to_i].class_id].name }
    # Woratana's :: Party Actor Name
    str.gsub!(/\\NP\[([0-9]+)\]/i) { $game_party.members[($1.to_i - 1)].name }
    # Woratana's :: Monster Name
    str.gsub!(/\\NM\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name }
    # Woratana's :: Troop Name
    str.gsub!(/\\NT\[([0-9]+)\]/i) { $data_troops[$1.to_i].name }
    # Woratana's :: Item Name
    str.gsub!(/\\NI\[([0-9]+)\]/i) { $data_items[$1.to_i].name }
    # Woratana's :: Weapon Name
    str.gsub!(/\\NW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name }
    # Woratana's :: Armor Name
    str.gsub!(/\\NA\[([0-9]+)\]/i) { $data_armors[$1.to_i].name }
    # Woratana's :: Skill Name
    str.gsub!(/\\NS\[([0-9]+)\]/i) { $data_skills[$1.to_i].name }
    # Woratana's :: Item Price
    str.gsub!(/\\PRICE\[([0-9]+)\]/i) { $data_items[$1.to_i].price.to_s }
    # Woratana's :: Draw Icon
    str.gsub!(/\\IC\[([0-9]+)\]/i) { "\x83[#{$1}]" }
    # Woratana's :: Draw Weapon Name + Icon
    str.gsub!(/\\DW\[([0-9]+)\]/i) {
      "\x83[#{$data_weapons[$1.to_i].icon_index}]\\NW[#{$1.to_i}]" }
    # Woratana's :: Draw Item Name + Icon
    str.gsub!(/\\DI\[([0-9]+)\]/i) {
      "\x83[#{$data_items[$1.to_i].icon_index}]\\NI[#{$1.to_i}]" }
    # Woratana's :: Draw Armor Name + Icon
    str.gsub!(/\\DA\[([0-9]+)\]/i) {
      "\x83[#{$data_armors[$1.to_i].icon_index}]\\NA[#{$1.to_i}]" }
    # Woratana's :: Draw Skill Name + Icon
    str.gsub!(/\\DS\[([0-9]+)\]/i) {
      "\x83[#{$data_skills[$1.to_i].icon_index}]\\ns[#{$1.to_i}]" }
    # Woratana's :: Font Name Change
    str.gsub!(/\\FN\[(.*?)\]/i) { "\x84[#{$1}]" }
    # Woratana's :: Font Size Change
    str.gsub!(/\\FS\[([0-9]+)\]/i) { "\x85[#{$1}]" }
    # Woratana's :: BOLD Text
    str.gsub!(/\\BO/i) { "\x88" }
    # Woratana's :: ITALIC Text
    str.gsub!(/\\IT/i) { "\x89" }
    # Woratana's :: SHADOW Text
    str.gsub!(/\\SH/i) { "\x93" }
    return str
  end
  #--------------------------------------------------------------------------
  # * Get Text Color
  #--------------------------------------------------------------------------
  def text_color(n)
    x = 64 + (n % 8) * 8
    y = 96 + (n / 8) * 8
    windowskin = Cache.system('Window')
    return windowskin.get_pixel(x, y)
  end
  #--------------------------------------------------------------------------
  # * Get Map Name
  #--------------------------------------------------------------------------
  def get_map_name
    $data_mapinfos = load_data('Data/MapInfos.rvdata') if $data_mapinfos.nil?
    map_id = $game_map.map_id
    return $data_mapinfos[map_id].name
  end
  #--------------------------------------------------------------------------
  # * Draw Icon
  #--------------------------------------------------------------------------
  def draw_icon(icon_index, x, y)
    bitmap = Cache.system('Iconset')
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    self.blt(x, y, bitmap, rect)
  end
end
Just write \IC[icon ID] and it will work. You can also use it for other things like descriptions.
it's like a metaphor or something i don't know

*
Rep:
Level 73
Artista
2012 Best Artist2012 Best RPG Maker User (Graphical)2011 Best RPG Maker User (Graphical)Winner - 2011 Summer Project of the Season
I think I spoke too soon.

I am, actually, using Imp1's Simple Battle Icons script to have dynamic icons in battle. If I change the database with \icon[ID], two icons appear instead of one. I'd really like to keep the script.

Code: [Select]
#===============================================================================
# RMVX
# Simple Battle Icons by IMP1 | Version 2.1 | 14th July 2010
#-------------------------------------------------------------------------------
# This script was made as an after-thought to MBA. It gives the user options of
# icons to accompany the battle options "Attack", "Skill", etc.
#-------------------------------------------------------------------------------
#
# Credits:
#
#  * IMP1
#     - for the code.
#
#  * Enterbrain
#     - for the programme.
#
#===============================================================================
$imported = {} if $imported.nil?
$imported["IMP1"] = {} if $imported["IMP1"].nil?
$imported["IMP1"]["Simple Battle Icons"] = 2.1
#===============================================================================
# Instructions:
#===============================================================================
=begin

   * Choose which icons you want, or whether you want them to be dynamic.
   * If you're having dynamic Fight icons, put the following note into the
     enemy's notebox:
     
  SBI:5
 
     Bare in mind, if the troop has more than one enemy in it,
     it will take the icon from the enemy with the highest ID.
   
   * Enjoy.
 
=end 
module IMP1_SBI
#===============================================================================
# Customisation Begin
#===============================================================================

  # If this is true, then the "Fight" icon will be that listed in the Troop's
  # Notebox
  Dynamic_Fight_Icon = false
 
  # If Dynamic_Fight_Icon is set to false, this will determine the icon that
  # represents "Fight" in the window.
  Fight_Icon = 10
 
  # This is the Flee icon
  Flee_Icon = 1782

  # If this is true, the "Attack" icon will be that of the actor's equiped
  # weapon.
  Dynamic_Attack_Icon = true
 
  # If Dynamic_Attack_Icon is set to false, this will determine the icon that
  # represents "Attack" in the window.
  Attack_Icon = 26
 
  # If this is true, each class will have it's own icon for "Skills", if false,
  # then one icon will represent "Skills"
  Dynamic_Skill_Icon = true
 
  # If Dynamic_Skill_Icon is set to false, this will determine the icon that
  # represents "Skills" in the window.
  Skill_Icon = 135
 
  # If Dynamic_Skill_Icon is set to true, which classes are linked to which
  # icons?
  Class_Skill_IDs = {
 
  #class_id => icon_id
 
  1 => 2050,
  2 => 2272,
  3 => 3253,
  4 => 2812,
  5 => 1795,
  6 => 2787,
  7 => 3364,
  8 => 2721,
 
  } # Don't remove this. (End of Class_Skill_IDs)
 
  # If this is true, the "Guard" icon will be that of the actor's equiped
  # shield.
  Dynamic_Guard_Icon = false
 
  # If Dynamic_Guard_Icon is set to false, this will determine the icon that
  # represents "Guard" in the window.
  Guard_Icon = 52
 
  # This is the icon that represents "Items" in the window.
  Item_Icon = 144

#===============================================================================
# Customisation End
#===============================================================================
end # IMP1_SBI

#===============================================================================
# Window_ActorCommand
#===============================================================================
class Window_ActorCommand < Window_Command
  #-----------------------------------------------------------------------------
  # Edited to give room for the icons
  #-----------------------------------------------------------------------------
  def setup(actor)
    s1 = "    "+Vocab::attack
    s2 = "    "+Vocab::skill
    s3 = "    "+Vocab::guard
    s4 = "    "+Vocab::item
    if actor.class.skill_name_valid     # Skill command name is valid?
      s2 = "  "+actor.class.skill_name  # Replace command name
    end
    @commands = [s1, s2, s3, s4]
    @item_max = 4
    refresh
    draw_icons(actor)
    self.index = 0
  end # setup
  #-----------------------------------------------------------------------------
  # Draw Icons
  #-----------------------------------------------------------------------------
  def draw_icons(actor)
    # Attack
    if IMP1_SBI::Dynamic_Attack_Icon and (actor.weapon_id != 0)
      id = $data_weapons[actor.weapon_id].icon_index
    else
      id = IMP1_SBI::Attack_Icon
    end
    self.draw_icon(id, 0, 0)
    # Skill
    if IMP1_SBI::Dynamic_Skill_Icon
      id = IMP1_SBI::Class_Skill_IDs[actor.class_id]
    else
      id = IMP1_SBI::Skill_Icon
    end
    self.draw_icon(id, 0, 24)
    # Guard
    if (IMP1_SBI::Dynamic_Guard_Icon) and (not actor.two_swords_style) and (actor.armor1_id != 0)
      id = $data_armors[actor.armor1_id].icon_index
    else
      id = IMP1_SBI::Guard_Icon
    end
    self.draw_icon(id, 0, 48)
    # Item
    id = IMP1_SBI::Item_Icon
    self.draw_icon(id, 0, 72) # item
  end # draw_icons
 
end # Window_ActorCommand
#===============================================================================
# Window_Party_Command
#===============================================================================
class Window_PartyCommand
  #-----------------------------------------------------------------------------
  # Edited to add icons.
  #-----------------------------------------------------------------------------
  def initialize
    s1 = "    "+Vocab::fight
    s2 = "    "+Vocab::escape
    super(128, [s1, s2], 1, 4)
    draw_item(0, true)
    draw_item(1, $game_troop.can_escape)
    if IMP1_SBI::Dynamic_Fight_Icon
      id = get_enemy_icon
    else
      id = IMP1_SBI::Fight_Icon
    end
    self.draw_icon(id, 0, 0)
    id = IMP1_SBI::Flee_Icon
    self.draw_icon(id, 0, 24)
    self.active = false
  end # initialize
 
  def get_enemy_icon
    enemies = $game_troop.members
    bad_guys = {}
    for enemy in enemies
      bad_guys[enemy.id] = enemy
    end
    id = get_enemy_note(bad_guys[bad_guys.keys.max])
    return id
  end # get_enemy_icon
 
  def get_enemy_note(enemy)
    note = $data_enemies[enemy.enemy_id].note
    note.gsub!(/\r/) { "" }
    note = note.split(/\n/)
    for line in note
      if line.include?("SBI")
        line = line.split(/:/)[1]
        icon_id = line
      end
    end
    return icon_id.to_i
  end # get_enemy_note
 
end # Window_PartyCommand

(Also using bulletxt's Remove Attack Command and a patch script that makes it compatible with battle icons).
My current project: