Main Menu
  • Welcome to The RPG Maker Resource Kit.

Get Note's Data

Started by A3D, June 25, 2008, 03:49:41 AM

0 Members and 1 Guest are viewing this topic.

A3D

allow you to put your new data in note area, and you can pick them up via script.
it will make your data in each item unlimitable.


#===========================================================================
# A3D's Get Note Data
#
# << Version >>
#          : 1.2
#
# << Useful >>
# allow you to set-up your new data in note area
# it will make your data in each item unlimitable
#
# << General Command >>   
#          : A3D.gnd( [/type, /id], /code, /string )
#          : A3D.gnd(  /item      , /code, /string )
# /type    = type of your item
#            (1 = skill, 2 = item , 3 = weapon,
#            (4 = armor, 5 = enemy, 6 = state)
# /id      = id of your item
# /code    = code to call your data
# /string  = if you're expect an alphabet data (not number), set it true
# /item    = $data object of your item (not $game)
#
# << How to Use >>
# in "note" area in each "item", write your code & data in this format
#          : your_code>your_data
# example, second enemy in enemy's database, you have
#          : AP>10
#          : WD>SLASH
# you can pick-up each data by the following command
#          : A3D.gnd([5,2], "AP")
#          : A3D.gnd([5,2], "WD", true)
# or       : enemy = $data_enemies[2]
#          : A3D.gnd(enemy, "AP")
#          : A3D.gnd(enemy, "WD", true)
#
# << Note >>
# this script is for non-commercial use only, give credit if use
#
# << Contact >>
# A3D (hyper_s@hotmail.com)
#===========================================================================

module A3D
  #--------------------------------------------------------------------------
  # * Get Note Data
  #--------------------------------------------------------------------------
  def A3D.gnd(item, code, string = false)
    if item.is_a?(Array)
      case item[0]
      when 1 then item = $data_skills[item[1]]
      when 2 then item = $data_items[item[1]]
      when 3 then item = $data_weapons[item[1]]
      when 4 then item = $data_armors[item[1]]
      when 5 then item = $data_enemies[item[1]]
      when 6 then item = $data_states[item[1]]
      end
    end
    item.note.split(/[\r\n]+/).each do |line|
      if line.split(/[>]/)[0] == code
        data = line.split(/[>]/)[1]
        return string ? data : data.to_i
      end
    end
    return string ? "" : 0
  end
 
end



General Command ::
A3D.gnd( [/type, /id], /code, /string)
A3D.gnd(  /item        , /code, /string )
/type    = type of your item
           (1 = skill, 2 = item , 3 = weapon,
           (4 = armor, 5 = enemy, 6 = state)
/id        = id of your item
/code    = code to call your data
/string  = if you're expect an alphabet data (not number), set it true
/item    = $data object of your item (not $game)

in "note" area of each "item", write your code & data in this format ::
your_code>your_data

example, second enemy in enemy's database, you have ::

you can pick-up each data by the following command ::
          : A3D.gnd( [5, 2], "AP" )
          : A3D.gnd( [5, 2], "PE" )