Project1

标题: 同时向脚本库插入两个脚本的问题 [打印本页]

作者: 610347499    时间: 2013-8-3 13:45
标题: 同时向脚本库插入两个脚本的问题
个人对脚本完全不懂……求大神
class Game_Party
  alias initialize_2013_5_26 initialize
  def initialize
    initialize_2013_5_26
    @item_box = {}
  end
  def save_items(i)
    @item_box[i] =
      (@item_box[i] || {}).merge(@items) {|key, old, new|
        [old + new, max_item_number(nil)].min
      }
    @items = {}
  end
  def load_items(i)
    @items =
      (@item_box[i] || {}).merge(@items) {|key, old, new|
        [old + new, max_item_number(nil)].min
      }
    @item_box.delete(i)
  end
end
要同时插入以上和以下
class Game_Party
  alias initialize_2013_5_26 initialize
  def initialize
    initialize_2013_5_26
    @weapon_box = {}
  end
  def save_weapons(i)
    @weapon_box[i] =
      (@weapon_box[i] || {}).merge(@weapons) {|key, old, new|
        [old + new, max_weapon_number(nil)].min
      }
    @weapons = {}
  end
  def load_weapons(i)
    @weapons =
      (@weapon_box[i] || {}).merge(@weapons) {|key, old, new|
        [old + new, max_weapon_number(nil)].min
      }
    @weapon_box.delete(i)
  end
end
要怎么办?单独插入任何一个一点问题都没有,可是……可是我需要把两个同时插进去啊!(第一个是大神提供的记忆物品脚本,第二个是我替换单词出来的记忆武器脚本)
插入两个就会出现脚本错误的警告……求大神告诉我该怎么做?

作者: 610347499    时间: 2013-8-3 13:46
第一个是
  1. class Game_Party
  2.   alias initialize_2013_5_26 initialize
  3.   def initialize
  4.     initialize_2013_5_26
  5.     @item_box = {}
  6.   end
  7.   def save_items(i)
  8.     @item_box[i] =
  9.       (@item_box[i] || {}).merge(@items) {|key, old, new|
  10.         [old + new, max_item_number(nil)].min
  11.       }
  12.     @items = {}
  13.   end
  14.   def load_items(i)
  15.     @items =
  16.       (@item_box[i] || {}).merge(@items) {|key, old, new|
  17.         [old + new, max_item_number(nil)].min
  18.       }
  19.     @item_box.delete(i)
  20.   end
  21. end
复制代码
第二个是
  1. class Game_Party
  2.   alias initialize_2013_5_26 initialize
  3.   def initialize
  4.     initialize_2013_5_26
  5.     @weapon_box = {}
  6.   end
  7.   def save_weapons(i)
  8.     @weapon_box[i] =
  9.       (@weapon_box[i] || {}).merge(@weapons) {|key, old, new|
  10.         [old + new, max_weapon_number(nil)].min
  11.       }
  12.     @weapons = {}
  13.   end
  14.   def load_weapons(i)
  15.     @weapons =
  16.       (@weapon_box[i] || {}).merge(@weapons) {|key, old, new|
  17.         [old + new, max_weapon_number(nil)].min
  18.       }
  19.     @weapon_box.delete(i)
  20.   end
  21. end
复制代码

作者: 345912390    时间: 2013-8-3 16:20
把其中一个脚本的2-4行
  1. alias initialize_2013_5_26 initialize
  2.   def initialize
  3.     initialize_2013_5_26
复制代码
改成如
  1. alias initialize_2013_5_24 initialize
  2.   def initialize
  3.     initialize_2013_5_24
复制代码
不知道该脚本的具体用途,如还有问题请说清楚点!
作者: 610347499    时间: 2013-8-3 20:52
345912390 发表于 2013-8-3 16:20
把其中一个脚本的2-4行改成如不知道该脚本的具体用途,如还有问题请说清楚点! ...

果然可以了多谢大神!第一个是其他大神提供的记忆物品脚本,第二个是我替换单词出来的记忆武器脚本




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1