设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1142|回复: 5
打印 上一主题 下一主题

[已经过期] 求个调用自定义物品种类的scene?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
163
在线时间
445 小时
注册时间
2013-7-18
帖子
109
跳转到指定楼层
1
发表于 2013-8-6 20:22:24 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 lottesong 于 2013-8-10 08:44 编辑

我想要建一个scene  可以用SceneManager.call调出自定义种类的道具窗口  
就是在注释里含有 \cim_category![present]  字样的道具,把它们放在一起显示
照葫芦画瓢还不是很懂  挫到家了  是用eval判断note么 为啥不好用呢……大概出了无数的纰漏 (艸)
不知道要在脚本的窗口和场景里改些什么
能不能麻烦好心人帮忙写个即用的  非常感谢  让我好好的研究一下



----------------------------------以下请无视----------------------------------------------
使用了modern algebra的 自定义道具种类脚本,简单好用~~~Yanfly大大的太深奥了看不懂
已经在道具物品栏增加了“礼物”那项  
然后……如何在和队友对话的时候,调出礼物的窗口呢
就像  SceneManager.call(Scene_Equip)这样直接调出武器这种……限定这个时候只能使用present下的物品 然后其余道具,比如回复药水不能赠送
还是要自己建个Scene什么的0。0 怎么建  (作为新人我很白,只能用现成的ruby脚本……原理不懂)
还是要建个开关……判断语句?  礼物的道具都是在注释写了 "\cim_category![present]"

RUBY 代码复制下载
  1. #==============================================================================
  2.     #    Customizable Item Menu
  3.     #    Version: 1.0.1
  4.     #    Author: modern algebra (rmrk.net)
  5.     #    Date: August 10, 2012
  6.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7.     #  Description:
  8.     #
  9.     #    This script allows you to customize various features of the default item
  10.     #   menu. It lets you:
  11.     #
  12.     #      - Increase the number of lines you can use in the description window.
  13.     #      - Change the position of the description window.
  14.     #      - Show an enlarged picture of the item in the description window.
  15.     #      - Make new categories to make the item menu cleaner to navigate.
  16.     #      - Represent categories by icons instead of plain text.
  17.     #      - Give descriptions to the categories.
  18.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  19.     #  Instructions:
  20.     #
  21.     #    Paste this script into its own slot in the Script Editor, above Main but
  22.     #   below Materials and other custom scripts.
  23.     #
  24.     #    All of the configuration for this script is done within the Editable
  25.     #   Region starting at line 71. It is heavily commented and explains what each
  26.     #   option does, so I encourage you to read it. Here, however, I will explain
  27.     #   the configuration you can do within the note field of each item.
  28.     #``````````````````````````````````````````````````````````````````````````````
  29.     #    If you set the image_in_description value at line 83 to true, then you can
  30.     #   assign an image to any given item with the following code in a note field:
  31.     #
  32.     #      \image[filename]
  33.     #    where filename is the name of an image file in the Pictures folder of
  34.     #   Graphics.
  35.     #``````````````````````````````````````````````````````````````````````````````
  36.     #    If you set the description_lines value at line 79 to more than 2, then
  37.     #   you can add new lines to the description of an item with the followinf
  38.     #   code in a note field:
  39.     #
  40.     #      \desc+{new line of description}
  41.     #   You can add as many lines as you like, and message codes like \c[n] are
  42.     #   recognized.
  43.     #``````````````````````````````````````````````````````````````````````````````
  44.     #    If you are using custom categories, then you can assign an item to appear
  45.     #   in the new category with the following code:
  46.     #
  47.     #      \cim_category[unique_1, unique_2, etc...]
  48.     #    where unique_1, unique_2, etc... are the names of the custom categories to
  49.     #    which you want to assign the item. Also, if you do not want the item to
  50.     #    appear in its default category (a weapon in Weapons, an armour in Armours,
  51.     #    etc...), then all you need to do is place an ! after category and the
  52.     #    item will then only appear in the categories you specify, like so:
  53.     #
  54.     #      \cim_category![unique_1, unique_2, etc...]
  55.     #
  56.     #    EXAMPLE:
  57.     #  Say the following is in the note field of item 1:
  58.     #      \cim_category[potion]
  59.     #        This item will now appear in the :all, :item, and :potion categories.
  60.     #
  61.     #  However, if the following is used:
  62.     #      \cim_category![potion]
  63.     #        then the item will only appear in the :all and :potion categories.
  64.     #==============================================================================
  65.  
  66.     $imported ||= {}
  67.     $imported[:"MA Customizable Item Menu 1.0.x"] = true
  68.  
  69.     MA_CUSTOM_ITEM_MENU = {
  70.     #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  71.     #    BEGIN Editable Region
  72.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  73.     # DESCRIPTION OPTIONS
  74.     #``````````````````````````````````````````````````````````````````````````````
  75.     #  description_at_top - If true, the description window will be at the top of
  76.     # the screen. If false, it will be at the bottom.
  77.     description_at_top: true,
  78.     #  description_lines - The number of lines to show in the description.
  79.     description_lines: 3,
  80.     #  image_in_description - If false, there will be no image shown in the
  81.     # description. If true, there will be. See line 29 for instructions on how to
  82.     # assign an image to an item through its notefield.
  83.     image_in_description: false,
  84.     #  image_width - If showing an image in the description window, this value is
  85.     # the number of pixels the description image requires horizontally.
  86.       image_width: 0,
  87.     #  use_enlarged_icons_as_default - If you are showing images in the description
  88.     # window and this value is true, then for any item which has no assigned image,
  89.     # an enlarged version of its icon will be shown instead. If false, then no
  90.     # image will be shown unless one is specifically assigned.
  91.       use_enlarged_icons_as_default: false,
  92.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  93.     # CATEGORY OPTIONS
  94.     #``````````````````````````````````````````````````````````````````````````````
  95.     #  use_icons_for_categories - If true, the categories will be represented by
  96.     # icons. If false, the categories will just be shown as text, as is normal
  97.     use_icons_for_categories: true,
  98.     #  show_category_label - if using icons for categories, this determines whether
  99.     # the name of the category is shown in a parallel window. If this value is true,
  100.     # then the category name is shown. If false, then it will just be the icons.
  101.       show_category_label: true,
  102.     #  icon_category_width - if using icons for categories and are showing labels,
  103.     # this determines the width of the icon category window.
  104.         icon_category_width: 288,
  105.     #  category_label_position - If using icons for categories and showing the
  106.     # category label, this determines the position of the label window relative to
  107.     # the icon window. If :left, will be to the left. If :right, will be to the
  108.     # right.
  109.         category_label_position: :left,
  110.     #``````````````````````````````````````````````````````````````````````````````
  111.     #  custom_categories - This option allows you to choose which categories are
  112.     # shown in the Item Menu. There are five default categories: :item, :weapon,
  113.     # :armor, :key_item, and :all. As you would expect, the :item shows non-key
  114.     # items, :weapon shows all weapons, :armor shows all armors, :key_item shows
  115.     # all key items, and :all shows all items held by the party. They will appear
  116.     # in the order that you set below. You can also create your own categories -
  117.     # all you need to do is first create a symbol for the category and add it to
  118.     # the array below. This can be anything as long as it is unique and in the
  119.     # format:
  120.     #      :unique
  121.     # Next, you will need to go to the category_vocab and category_icons hashes and
  122.     # assign to it a Label (if showing labels) and an icon (if using category
  123.     # icons). See the instructions above those hashes for details.
  124.     #
  125.     #    EXAMPLE:
  126.     #  If we wanted to add a Potions category, we could call it :potion and the
  127.     # array would look as follows:
  128.     #
  129.     #    custom_categories: [:item, :potion, :weapon, :armor, :key_item],
  130.     #
  131.     # To find out how to assign an item to one of the custom categories you create,
  132.     # see line 44.
  133.     custom_categories: [:item, :weapon, :armor, :key_item, :present],
  134.     #  category_vocab - In this hash, you can set the name of each category. You
  135.     # need to set a name for every category included in the custom_categories
  136.     # array unless you are using icons and not showing any label at all. You set
  137.     # each label as a "string" and that will be what shows up in-game. You can also
  138.     # set it so that the name is retrieved by evaluating an expression. To do that,
  139.     # just put a : in front of the quotation marks, like so:
  140.     #
  141.     #     :"expression"
  142.     #
  143.     #  Below, you will see examples of both - the :all category is set, by default,
  144.     # to an ordinary string, while the others are all set to retrieve the name for
  145.     # the category that is assigned in the Database.
  146.     #
  147.     #  Now, to set the name of a custom category that you create, all you need to
  148.     # do is make a new line before the } line in the following format:
  149.     #
  150.     #    :unique => "",
  151.     #
  152.     #    EXAMPLE:
  153.     #  To set the name of our new potions category, we could do the following:
  154.     #
  155.     #    :potion => "Potions",
  156.     category_vocab: {
  157.       :all =>      "All Items",
  158.       :item =>     :"Vocab::item",
  159.       :present =>   "礼物",
  160.       :weapon =>   :"Vocab::weapon",
  161.       :armor =>    :"Vocab::armor",
  162.       :key_item => :"Vocab::key_item",
  163.     }, # END VOCAB HASH
  164.     #  category_icons - If using icons to represent categories, then this is where
  165.     # you set which icons will show for each category. Just set it to whichever
  166.     # icon index you want. Similar to the vocab hash, the format is:
  167.     #
  168.     #    :unique => 0,
  169.     #
  170.     #    EXAMPLE:
  171.     #  Our potions category could be set as follows:
  172.     #   
  173.     #    :potion => 192,
  174.     category_icons: {
  175.       :all =>      672,
  176.       :item =>     260,
  177.       :present =>   122,
  178.       :weapon =>   115,
  179.       :armor =>    141,
  180.       :key_item => 597,
  181.     }, # END ICONS HASH
  182.     #  category_descriptions - If you wish you can make it so that each category
  183.     # has a description which will be shown in the help window whenever you are
  184.     # selecting a category. Similar to the above hashes, the format is:
  185.     #
  186.     #    :unique => "",
  187.     #
  188.     #  To make a new line, simply put a \\n within the string.
  189.     #
  190.     #    EXAMPLE:
  191.     #  Our potions category could have a new description as follows:
  192.     #
  193.     #    :potion => "Alchemical concoctions to \\c[3]remedy\\c[0] various\\nillnesses.",
  194.     #
  195.     #  If you are showing an image in the description of items, you can also set
  196.     # an image to show for the category description by the following code:
  197.     #
  198.     #    :unique => ["description", "image filename"],
  199.     #
  200.     #  where description is the regular description and image filename is the
  201.     # filename of an image in the Pictures folder of Graphics. You could also just
  202.     # put an integer, in which case it would draw an enlarged version of the icon
  203.     # with that index.
  204.     #
  205.     #    EXAMPLES:
  206.     #  If you wanted your potions category to show an enlarged version of icon 192
  207.     # and be described as "Alchemical concoctions", you would add the following
  208.     # line:
  209.     #
  210.     #    :potion => ["Alchemical concoctions", 192],
  211.     #
  212.     #  If you instead wanted to use a graphic from Pictures called "Potion01", then
  213.     # the line would be:
  214.     #
  215.     #    :potion => ["Alchemical concoctions", "Potion01"],
  216.     category_descriptions: {
  217.       :all =>      "",
  218.       :item =>     "",
  219.       :weapon =>   "",
  220.       :armor =>    "",
  221.       :key_item => "",
  222.     }, # END DESCRIPTIONS HASH
  223.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  224.     #    END Editable Region
  225.     #//////////////////////////////////////////////////////////////////////////////
  226.     }
  227.     MA_CUSTOM_ITEM_MENU[:category_vocab].default = ""
  228.     MA_CUSTOM_ITEM_MENU[:category_descriptions].default = ""
  229.     MA_CUSTOM_ITEM_MENU[:category_icons].default = 0
  230.  
  231.     #==============================================================================
  232.     # *** MACIM_RPG_ItemWeaponArmor
  233.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  234.     #  This method mixes in with RPG::Item, RPG::Weapon, and RPG::Armor, adding
  235.     # the following:
  236.     #    new method - macim_categories
  237.     #==============================================================================
  238.  
  239.     module MACIM_RPG_ItemWeaponArmor
  240.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  241.       # * Custom Categories
  242.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  243.       def macim_categories
  244.         if !@macim_categories
  245.           @macim_categories = [macim_default_category]
  246.           if self.note[/\\CIM[_ ]CATEGOR(Y|IES)(!?)\s*\[\s*(.+?)\s*\]/i]
  247.             @macim_categories.delete(macim_default_category) unless $2.empty?
  248.             cats = $3.scan(/[^:,;\s]+/)
  249.             cats.each { |category| @macim_categories.push(category.to_sym) }
  250.           end
  251.         end
  252.         @macim_categories
  253.       end
  254.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  255.       # * Image
  256.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  257.       def macim_desc_image
  258.         if !@macim_desc_image
  259.           @macim_desc_image = ""
  260.           if self.note[/\\IMAGE\[(.+?)\]/i]
  261.             @macim_desc_image = $1
  262.           elsif MA_CUSTOM_ITEM_MENU[:use_enlarged_icons_as_default]
  263.             @macim_desc_image = $imported[:MAIcon_Hue] ? [icon_index, icon_hue] : icon_index
  264.           end
  265.         end
  266.         @macim_desc_image
  267.       end
  268.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  269.       # * Description
  270.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  271.       def description(*args, &block)
  272.         result = super(*args, &block)
  273.         if !@macim_description_plus
  274.           @macim_description_plus = ""
  275.           self.note.scan(/\\(DESC|DESCRIPTION)\+\{(.+?)\}/im) { |line|
  276.             desc_plus = line[1].gsub(/\s*[\r\n]+\s*/, " ")
  277.             desc_plus.gsub!(/\\[Nn]/, "\n")
  278.             @macim_description_plus += "\n" + desc_plus
  279.           }
  280.         end
  281.         result + @macim_description_plus
  282.       end
  283.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  284.       # * Default Category
  285.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  286.       def macim_default_category; :item; end
  287.     end
  288.  
  289.     #==============================================================================
  290.     # *** RPG
  291.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  292.     #  This adds a few methods to the Item, Weapon, and Armor classes by mixing in
  293.     # the MACIM_RPG_ItemWeaponArmor module.
  294.     #==============================================================================
  295.  
  296.     module RPG
  297.       class Item
  298.         include MACIM_RPG_ItemWeaponArmor
  299.         def macim_default_category; key_item? ? :key_item : :item; end
  300.       end
  301.       class Weapon
  302.         include MACIM_RPG_ItemWeaponArmor
  303.         def macim_default_category; :weapon; end
  304.       end
  305.       class Armor
  306.         include MACIM_RPG_ItemWeaponArmor
  307.         def macim_default_category; :armor; end
  308.       end
  309.     end
  310.  
  311.     unless $imported[:"MA_ParagraphFormat_1.0"]
  312.     #==============================================================================
  313.     # ** MA_Window_ParagraphFormat
  314.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  315.     #  This module inserts into Window_Base and provides a method to format the
  316.     # strings so as to go to the next line if it exceeds a set limit. This is
  317.     # designed to work with draw_text_ex, and a string formatted by this method
  318.     # should go through that, not draw_text.
  319.     #==============================================================================
  320.  
  321.     module MA_Window_ParagraphFormat
  322.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  323.       # * Calc Line Width
  324.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  325.       def mapf_calc_line_width(line, tw = 0, contents_dummy = false)
  326.         return tw if line.nil?
  327.         line = line.clone
  328.         unless contents_dummy
  329.           real_contents = contents # Preserve Real Contents
  330.           # Create a dummy contents
  331.           self.contents = Bitmap.new(contents_width, 24)
  332.           reset_font_settings
  333.         end
  334.         pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
  335.         while line[/^(.*?)\e(.*)/]
  336.           tw += text_size($1).width
  337.           line = $2
  338.           # Remove all ancillaries to the code, like parameters
  339.           code = obtain_escape_code(line)
  340.           # If direct setting of x, reset tw.
  341.           tw = 0 if ($imported[:ATS_SpecialMessageCodes] && code.upcase == 'X') ||
  342.             ($imported["YEA-MessageSystem"] && code.upcase == 'PX')
  343.           #  If I need to do something special on the basis that it is testing,
  344.           # alias process_escape_character and differentiate using @atsf_testing
  345.           process_escape_character(code, line, pos)
  346.         end
  347.         #  Add width of remaining text, as well as the value of pos[:x] under the
  348.         # assumption that any additions to it are because the special code is
  349.         # replaced by something which requires space (like icons)
  350.         tw += text_size(line).width + pos[:x]
  351.         unless contents_dummy
  352.           contents.dispose # Dispose dummy contents
  353.           self.contents = real_contents # Restore real contents
  354.         end
  355.         return tw
  356.       end
  357.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  358.       # * Format Paragraph
  359.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  360.       def mapf_format_paragraph(text, max_width = contents_width)
  361.         text = text.clone
  362.         #  Create a Dummy Contents - I wanted to boost compatibility by using the
  363.         # default process method for escape codes. It may have the opposite effect,
  364.         # for some :(
  365.         real_contents = contents # Preserve Real Contents
  366.         self.contents = Bitmap.new(contents_width, 24)
  367.         reset_font_settings
  368.         paragraph = ""
  369.         while !text.empty?
  370.           text.lstrip!
  371.           oline, nline, tw = mapf_format_by_line(text.clone, max_width)
  372.           # Replace old line with the new one
  373.           text.sub!(/#{Regexp.escape(oline)}/m, nline)
  374.           paragraph += text.slice!(/.*?(\n|$)/)
  375.         end
  376.         contents.dispose # Dispose dummy contents
  377.         self.contents = real_contents # Restore real contents
  378.         return paragraph
  379.       end
  380.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  381.       # * Format By Line
  382.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  383.       def mapf_format_by_line(text, max_width = contents_width)
  384.         oline, nline, tw = "", "", 0
  385.         loop do
  386.           #  Format each word until reach the width limit
  387.           oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
  388.           return oline, nline, tw if done
  389.         end
  390.       end
  391.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  392.       # * Format By Word
  393.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  394.       def mapf_format_by_word(text, line, tw, max_width)
  395.         return line, line, tw, true if text.nil? || text.empty?
  396.         # Extract next word
  397.         if text.sub!(/(\s*)([^\s\n\f]*)([\n\f]?)/, "") != nil
  398.           prespace, word, line_end = $1, $2, $3
  399.           ntw = mapf_calc_line_width(word, tw, true)
  400.           pw = contents.text_size(prespace).width
  401.           if (pw + ntw >= max_width)
  402.             # Insert
  403.             if line.empty?
  404.               # If one word takes entire line
  405.               return prespace + word, word + "\n", ntw, true
  406.             else
  407.               return line + prespace + word, line + "\n" + word, tw, true
  408.             end
  409.           else
  410.             line += prespace + word
  411.             tw = pw + ntw
  412.             # If the line is force ended, then end
  413.             return line, line, tw, true if !line_end.empty?
  414.           end
  415.         else
  416.           return line, line, tw, true
  417.         end
  418.         return line, line, tw, false
  419.       end
  420.     end
  421.  
  422.     class Window_Base
  423.       include MA_Window_ParagraphFormat
  424.     end
  425.  
  426.     $imported[:"MA_ParagraphFormat_1.0"] = true
  427.     end
  428.  
  429.     unless $imported[:"MA_IconHorzCommand_1.0"]
  430.     #==============================================================================
  431.     # ** Window_MA_IconHorzCommand
  432.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  433.     #  This window is a base window to show a horizontal command window populated
  434.     # with icons.
  435.     #==============================================================================
  436.  
  437.     class Window_MA_IconHorzCommand < Window_HorzCommand
  438.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  439.       # * Public Instance Variable
  440.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  441.       attr_reader   :observing_procs
  442.       attr_accessor :cursor_hide
  443.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  444.       # * Object Initialization
  445.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  446.       def initialize(*args, &block)
  447.         @observing_procs = {}
  448.         super(*args, &block)
  449.       end
  450.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  451.       # * Column Max
  452.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  453.       def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end
  454.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  455.       # * Item
  456.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  457.       def item
  458.         @list[index] ? @list[index][:symbol] : nil
  459.       end
  460.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  461.       # * Enabled? / Current Item Enabled?
  462.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  463.       def enable?(index); self.index == index; end
  464.       def current_item_enabled?; !current_data.nil?; end
  465.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  466.       # * Draw Item
  467.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  468.       def draw_item(index)
  469.         rect = item_rect(index)
  470.         contents.clear_rect(rect)
  471.         draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))
  472.       end
  473.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  474.       # * Set Index
  475.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  476.       def index=(index)
  477.         old_index = self.index
  478.         super(index)
  479.         draw_item(old_index)
  480.         draw_item(self.index)
  481.       end
  482.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  483.       # * Frame Update
  484.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  485.       def update
  486.         super
  487.         @observing_procs.values.each { |block| block.call(item) }
  488.       end
  489.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  490.       # * Add/Remove Observing Window
  491.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  492.       def add_observing_proc(id, &block)
  493.         @observing_procs[id] = block
  494.         update
  495.       end
  496.       def remove_observing_proc(id)     ; @observing_procs.delete(id) ; end
  497.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  498.       # * Update Cursor
  499.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  500.       def update_cursor
  501.         super
  502.         cursor_rect.empty if @cursor_hide
  503.       end
  504.     end
  505.     $imported[:"MA_IconHorzCommand_1.0"] = true
  506.     end
  507.  
  508.     #==============================================================================
  509.     # ** Window_ItemCategory
  510.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  511.     #  Summary of Changes:
  512.     #    overwritten method - make_command_list; update_help
  513.     #==============================================================================
  514.  
  515.     class Window_ItemCategory
  516.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  517.       # * Create Command List
  518.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  519.       def make_command_list
  520.         categories = MA_CUSTOM_ITEM_MENU[:custom_categories]
  521.         vocab = MA_CUSTOM_ITEM_MENU[:category_vocab]
  522.         categories.each {|category|
  523.           text = vocab[category].is_a?(Symbol) ? eval(vocab[category].to_s) : vocab[category]
  524.           add_command(text, category)
  525.         }
  526.       end
  527.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  528.       # * Update Help
  529.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  530.       def update_help
  531.         @help_window.set_text(MA_CUSTOM_ITEM_MENU[:category_descriptions][current_symbol])
  532.       end
  533.     end
  534.  
  535.     #==============================================================================
  536.     # ** Window_ItemCategory
  537.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  538.     #  Summary of Changes:
  539.     #    aliased method - include?
  540.     #==============================================================================
  541.  
  542.     class Window_ItemList
  543.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  544.       # * Include in Item List?
  545.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  546.       alias ma_cim_includecheck_2hj7 include?
  547.       def include?(item, *args, &block)
  548.         return true if @category == :all
  549.         if item.is_a?(MACIM_RPG_ItemWeaponArmor)
  550.           item.macim_categories.include?(@category)
  551.         else
  552.           ma_cim_includecheck_2hj7(item, *args, &block)
  553.         end
  554.       end
  555.     end
  556.  
  557.     #==============================================================================
  558.     # ** Window_MACIM_ItemIconCategory
  559.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  560.     #  This window shows categories represented by icons
  561.     #==============================================================================
  562.  
  563.     class Window_MACIM_ItemIconCategory < Window_MA_IconHorzCommand
  564.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  565.       # * Object Initialization
  566.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  567.       def initialize(x = 0, y = 0, categories = MA_CUSTOM_ITEM_MENU[:custom_categories])
  568.         @cursor_hide = false
  569.         @categories = categories
  570.         super(x, y)
  571.       end
  572.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  573.       # * Window Width
  574.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  575.       def window_width
  576.         !MA_CUSTOM_ITEM_MENU[:show_category_label] ? Graphics.width :
  577.           MA_CUSTOM_ITEM_MENU[:icon_category_width]
  578.       end
  579.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  580.       # * Category=
  581.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  582.       def category=(category)
  583.         self.index = @categories.index(category) if @categories.include?(category)
  584.       end
  585.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  586.       # * Create Command List
  587.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  588.       def make_command_list
  589.         icons = MA_CUSTOM_ITEM_MENU[:category_icons]
  590.         @categories.each {|category|
  591.           add_command("", category, false, icons[category])
  592.         }
  593.       end
  594.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  595.       # * Set Item Window
  596.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  597.       def item_window=(window, *args)
  598.         add_observing_proc(:list) {|category| window.category = category }
  599.       end
  600.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  601.       # * Update Help
  602.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  603.       def update_help
  604.         desc = MA_CUSTOM_ITEM_MENU[:category_descriptions][current_symbol]
  605.         desc = [desc] if !desc.is_a?(Array)
  606.         @help_window.set_text(*desc)
  607.       end
  608.     end
  609.  
  610.     #==============================================================================
  611.     # ** Window Category Label
  612.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  613.     #  This window simply shows a label for category currently selected
  614.     #==============================================================================
  615.  
  616.     class Window_MACIM_CategoryLabel < Window_Base
  617.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  618.       # * Object Initialization
  619.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  620.       def initialize(x, y, label = "")
  621.         super(x, y, window_width, window_height)
  622.         refresh(label)
  623.       end
  624.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  625.       # * Window Attributes
  626.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  627.       def window_width; Graphics.width - MA_CUSTOM_ITEM_MENU[:icon_category_width]; end
  628.       def window_height; line_height + (standard_padding*2); end
  629.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  630.       # * Refresh
  631.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  632.       def refresh(label = @label)
  633.         @label = label.is_a?(String) ? convert_escape_characters(label) : ""
  634.         contents.clear
  635.         reset_font_settings
  636.         tw = mapf_calc_line_width(@label)
  637.         draw_text_ex((contents_width - tw) / 2, 0, @label)
  638.       end
  639.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  640.       # * Set Category
  641.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  642.       def category=(category)
  643.         return if @category == category
  644.         @category = category
  645.         vocab = MA_CUSTOM_ITEM_MENU[:category_vocab][@category]
  646.         label = vocab.is_a?(Symbol) ? eval(vocab.to_s) : vocab
  647.         refresh(label)
  648.       end
  649.     end
  650.  
  651.     #==============================================================================
  652.     # ** Window_MACIM_Help
  653.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  654.     #  This window is a help window with adjustable height and can show an image
  655.     #==============================================================================
  656.  
  657.     class Window_MACIM_Help < Window_Help
  658.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  659.       # * Set Text
  660.       #    Adds argument to change the image associated with the description
  661.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  662.       def set_text(text, filename = "")
  663.         if filename != @image || text != @text
  664.           @text = text
  665.           @image = filename
  666.           refresh
  667.         end
  668.       end
  669.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  670.       # * Set Item
  671.       #     item : Skills and items etc.
  672.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  673.       def set_item(item)
  674.         item ? set_text(item.description, item.is_a?(MACIM_RPG_ItemWeaponArmor) ? item.macim_desc_image : "") : set_text("", "")
  675.       end
  676.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  677.       # * Refresh
  678.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  679.       def refresh
  680.         contents.clear
  681.         draw_image(0, 0, MA_CUSTOM_ITEM_MENU[:image_width], contents_height, @image) unless @image == ""
  682.         # Adjust x position for text to give room for image
  683.         x = 4
  684.         x += MA_CUSTOM_ITEM_MENU[:image_width]
  685.         draw_text_ex(x, 0, @text)
  686.       end
  687.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  688.       # * Draw Image
  689.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  690.       def draw_image(x, y, w, h, filename)
  691.         contents.clear_rect(x, y, w, h)
  692.         bmp = make_image_bmp(filename, w, h)
  693.         # Adjust position and src_rect
  694.         src_rect = Rect.new(0, 0, w, h)
  695.         if w >= bmp.rect.width # If width allowed greater than width of image
  696.           x += ((w - bmp.rect.width) / 2) # Centre
  697.           src_rect.width = bmp.rect.width
  698.         else # If width allowed is less than width of image
  699.           src_rect.x += ((bmp.rect.width - w) / 2) # Cut to centre
  700.         end
  701.         if h >= bmp.rect.height # If height allowed is greater than height of image
  702.           y += ((h - bmp.rect.height) / 2) # Centre
  703.           src_rect.height = bmp.rect.height
  704.         else # If height allowed is less than height of image
  705.           src_rect.y += ((bmp.rect.height - h) / 2) # Cut to centre
  706.         end
  707.         contents.blt(x, y, bmp, src_rect)
  708.       end
  709.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  710.       # * Make the image bitmap
  711.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  712.       def make_image_bmp(filename, w, h)
  713.         case filename
  714.         when String then Cache.picture(filename)                  # Filename
  715.         when Integer then get_enlarged_icon([w, h].min, filename) # icon index
  716.         when Array                                              # [icon index, hue]
  717.           filename = filename.select {|num| num.is_a?(Integer) }
  718.           filename.slice!(2, filename.size - 2) if filename.size > 2
  719.           return if filename.empty?
  720.           get_enlarged_icon([w, h].min, *filename)
  721.         else                                                      # empty
  722.           Cache.picture("")
  723.         end
  724.       end
  725.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  726.       # * Get Enlarged Icon
  727.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  728.       def get_enlarged_icon(size, icon_index, icon_hue = 0)
  729.         iconset = Cache.system("Iconset")
  730.         src_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  731.         bmp = Bitmap.new(size, size)
  732.         bmp.stretch_blt(bmp.rect, iconset, src_rect)
  733.         # Compatibility with Icon Hues
  734.         bmp.change_hue(icon_hue) if icon_hue != 0
  735.         bmp
  736.       end
  737.     end
  738.  
  739.     #==============================================================================
  740.     # ** Scene_Item
  741.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  742.     #  Summary of Changes:
  743.     #    aliased method - start; create_category_window; create_help_window;
  744.     #      create_item_window
  745.     #    new method - create_category_label_window
  746.     #==============================================================================
  747.  
  748.     class Scene_Item
  749.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  750.       # * Start Processing
  751.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  752.       alias macim_start_2hz7 start
  753.       def start(*args, &block)
  754.         macim_start_2hz7(*args, &block) # Call Original Method
  755.         create_category_label_window if MA_CUSTOM_ITEM_MENU[:use_icons_for_categories] &&
  756.           MA_CUSTOM_ITEM_MENU[:show_category_label]
  757.       end
  758.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  759.       # * Create Help Window
  760.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  761.       alias macim_createhelp_2sk4 create_help_window
  762.       def create_help_window(*args, &block)
  763.         if MA_CUSTOM_ITEM_MENU[:description_lines] == 2 &&
  764.             !MA_CUSTOM_ITEM_MENU[:image_in_description]
  765.           macim_createhelp_2sk4(*args, &block) # Call Original Method
  766.         else
  767.           # Create special help window if showing image - otherwise normal
  768.           @help_window = MA_CUSTOM_ITEM_MENU[:image_in_description] ?
  769.             Window_MACIM_Help.new(MA_CUSTOM_ITEM_MENU[:description_lines]) :
  770.             Window_Help.new(MA_CUSTOM_ITEM_MENU[:description_lines])
  771.           @help_window.viewport = @viewport
  772.         end
  773.         @help_window.y = Graphics.height - @help_window.height unless MA_CUSTOM_ITEM_MENU[:description_at_top]
  774.       end
  775.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  776.       # * Create Category Window
  777.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  778.       alias macim_createcatwind_7jc4 create_category_window
  779.       def create_category_window(*args, &block)
  780.         if MA_CUSTOM_ITEM_MENU[:use_icons_for_categories] # If Icon Categories
  781.           # Create Icon Categories window instead of regular
  782.           x = (!MA_CUSTOM_ITEM_MENU[:show_category_label] ||
  783.             MA_CUSTOM_ITEM_MENU[:category_label_position] == :right) ? 0 :
  784.             Graphics.width - MA_CUSTOM_ITEM_MENU[:icon_category_width]
  785.           y = MA_CUSTOM_ITEM_MENU[:description_at_top] ? @help_window.height : 0
  786.           @category_window = Window_MACIM_ItemIconCategory.new(x, y)
  787.           @category_window.viewport = @viewport
  788.           @category_window.help_window = @help_window
  789.           @category_window.set_handler(:ok,     method(:on_category_ok))
  790.           @category_window.set_handler(:cancel, method(:return_scene))
  791.         else # Create regular category window if not using icons
  792.           macim_createcatwind_7jc4(*args, &block) # Call Original Method
  793.         end
  794.       end
  795.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  796.       # * Create Item Window
  797.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  798.       alias macim_cretitmwdow_4gz9 create_item_window
  799.       def create_item_window(*args, &block)
  800.         macim_cretitmwdow_4gz9(*args, &block) # Call Original Method
  801.         unless MA_CUSTOM_ITEM_MENU[:description_at_top]
  802.           @item_window.height -= @help_window.height
  803.           @item_window.refresh
  804.         end
  805.       end
  806.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  807.       # * Create Category Label Window
  808.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  809.       def create_category_label_window
  810.         # Determine position
  811.         x = MA_CUSTOM_ITEM_MENU[:category_label_position] == :right ?
  812.           MA_CUSTOM_ITEM_MENU[:icon_category_width] : 0
  813.         y = MA_CUSTOM_ITEM_MENU[:description_at_top] ? @help_window.height : 0
  814.         # Create label window
  815.         @macim_categorylabel_window = Window_MACIM_CategoryLabel.new(x, y)
  816.         @macim_categorylabel_window.viewport = @viewport
  817.         @category_window.add_observing_proc(:label) { |category|
  818.           @macim_categorylabel_window.category = category }
  819.       end
  820.     end
  821.  
  822.     #==============================================================================
  823.     # ** Scene_Battle
  824.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  825.     #  Summary of Changes:
  826.     #    aliased method - create_help_window
  827.     #==============================================================================
  828.  
  829.     class Scene_Battle
  830.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  831.       # * Create Help Window
  832.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  833.       alias macim_crthelpwind_2kf6 create_help_window
  834.       def create_help_window(*args, &block)
  835.         if MA_CUSTOM_ITEM_MENU[:description_lines] == 2 &&
  836.             !MA_CUSTOM_ITEM_MENU[:image_in_description]
  837.           macim_crthelpwind_2kf6(*args, &block) # Call Original Method
  838.         else
  839.           # Create special help window if showing image - otherwise normal
  840.           @help_window = MA_CUSTOM_ITEM_MENU[:image_in_description] ?
  841.             Window_MACIM_Help.new(MA_CUSTOM_ITEM_MENU[:description_lines]) :
  842.             Window_Help.new(MA_CUSTOM_ITEM_MENU[:description_lines])
  843.           @help_window.visible = false
  844.         end
  845.       end
  846.     end
  847.  
  848.     #==============================================================================
  849.     # ** Scene_Equip
  850.     #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  851.     #  Summary of Changes:
  852.     #    aliased method - create_help_window
  853.     #==============================================================================
  854.  
  855.     class Scene_Equip
  856.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  857.       # * Create Help Window
  858.       #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  859.       alias macim_catehelp_3nb7 create_help_window
  860.       def create_help_window(*args, &block)
  861.         if MA_CUSTOM_ITEM_MENU[:description_lines] == 2 &&
  862.             !MA_CUSTOM_ITEM_MENU[:image_in_description]
  863.           macim_catehelp_3nb7(*args, &block) # Call Original Method
  864.         else
  865.           # Create special help window if showing image - otherwise normal
  866.           @help_window = MA_CUSTOM_ITEM_MENU[:image_in_description] ?
  867.             Window_MACIM_Help.new(MA_CUSTOM_ITEM_MENU[:description_lines]) :
  868.             Window_Help.new(MA_CUSTOM_ITEM_MENU[:description_lines])
  869.           @help_window.viewport = @viewport
  870.         end
  871.       end
  872.     end

Lv1.梦旅人

梦石
0
星屑
163
在线时间
445 小时
注册时间
2013-7-18
帖子
109
6
 楼主| 发表于 2013-8-11 04:55:40 | 只看该作者
scottyfan 发表于 2013-8-10 23:17
不嫌弃,就用我写的。

(⊙A⊙)!
谢谢  试了一下。怎么做到的用简洁的篇幅,实现的这个归类功能呢 真不错
而且还是新鲜出炉编写得来着       
小白问题永远都不嫌少
虽然还是似懂非懂,但是很快乐地剽去研究了  3Q~~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
256 小时
注册时间
2013-5-27
帖子
196
5
发表于 2013-8-10 23:17:55 | 只看该作者
不嫌弃,就用我写的。
  1. #==============================================================================
  2. #  功能:[RMVA]增加物品栏类别
  3. #  作者:ScottyFan
  4. #  版本:v1.0 2013.8.8
  5. #  使用说明:
  6. #         在数据库-物品(包括装备)-备注 里写入 @itype[位置编号]
  7. #         新的物品分类编号是从 1 开始。比如 @itype[1]或者@itype[2]
  8. #==============================================================================
  9. module SFS
  10.   CATEGORY = [   #格式["显示名称", :标识],  标识随便写,不重复即可
  11.     ["",     :default], #注意,不要更改此行
  12.     ["药剂", :potion],  #此处为编号1
  13.     ["食物", :food],
  14.     ["光碟", :disc],
  15.     ["宝石", :gem],
  16.     ]
  17. end
  18.   
  19. class RPG::BaseItem
  20.   attr_reader   :category_id
  21.   def category_id
  22.     return if self.is_a?(RPG::Skill)
  23.     if @category_id.nil?
  24.       /@itype\[(.+?)\]/ =~ @note
  25.       @category_id = $1.to_i
  26.     end
  27.     @category_id
  28.   end
  29. end


  30. class Window_ItemCategory
  31.   #--------------------------------------------------------------------------
  32.   # ● 生成指令列表
  33.   #--------------------------------------------------------------------------
  34.   def make_command_list
  35.     SFS::CATEGORY.each do |itype|
  36.       next if itype[1] == :default
  37.       add_command(itype[0],  itype[1])
  38.     end
  39.     add_command("普通物品",     :item)
  40.     add_command(Vocab::weapon,   :weapon)
  41.     add_command(Vocab::armor,    :armor)
  42.     add_command(Vocab::key_item, :key_item)
  43.   end
  44. end


  45. class Window_ItemList
  46.   #--------------------------------------------------------------------------
  47.   # ● 查询列表中是否含有此物品
  48.   #--------------------------------------------------------------------------
  49.   def include?(item)
  50.     if item && item.category_id > 0 #如果是特殊类别
  51.       return @category == SFS::CATEGORY[item.category_id][1]
  52.     end
  53.     case @category   
  54.     when :item
  55.       item.is_a?(RPG::Item) && !item.key_item?
  56.     when :weapon
  57.       item.is_a?(RPG::Weapon)
  58.     when :armor
  59.       item.is_a?(RPG::Armor)
  60.     when :key_item
  61.       item.is_a?(RPG::Item) && item.key_item?
  62.     else
  63.       false
  64.     end
  65.   end
  66. end
复制代码

评分

参与人数 1梦石 +1 收起 理由
迷糊的安安 + 1 认可答案 附赠精美好人卡一张~~.

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
163
在线时间
445 小时
注册时间
2013-7-18
帖子
109
4
 楼主| 发表于 2013-8-10 08:46:46 | 只看该作者
修改了一下标题,能不能拜托大神们,实在是遇到了瓶颈  QUQ
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
163
在线时间
445 小时
注册时间
2013-7-18
帖子
109
3
 楼主| 发表于 2013-8-7 01:48:01 | 只看该作者
scottyfan 发表于 2013-8-7 01:24
第一次看到这种注释比代码还长的脚本。
按你的要求,送礼物的功能,肯定是要重新写个Scene什么的, ...

谢谢你的回复
因为这样才是傻瓜手册, 我这样的初心者能用的脚本啊,一步步教人怎么改动就好。还可以学习一下思路。
yanfly大神的就感觉超级高深莫测的风格 "喏,拿去吧,小白问题别烦我……"
其实,俺真的完全不懂怎么用 QUQ  【安装书在哪儿啊,痛哭流涕】
哦 scene要重写啊  扶墙  

点评

虽然我比较讨厌yanfly这样的态度,但是代码的确是他写的好,好代码简洁干净易读。  发表于 2013-8-7 01:57
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
256 小时
注册时间
2013-5-27
帖子
196
2
发表于 2013-8-7 01:24:59 | 只看该作者
第一次看到这种注释比代码还长的脚本。
按你的要求,送礼物的功能,肯定是要重新写个Scene什么的,
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-18 00:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表