查看: 2060|回复: 3

[已经解决] 同时向脚本库插入两个脚本的问题

[复制链接]
梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-3-2
回帖
3
发表于 2013-8-3 13:45:15 | 显示全部楼层 |阅读模式

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

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

×
个人对脚本完全不懂……求大神
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
要怎么办?单独插入任何一个一点问题都没有,可是……可是我需要把两个同时插进去啊!(第一个是大神提供的记忆物品脚本,第二个是我替换单词出来的记忆武器脚本)
插入两个就会出现脚本错误的警告……求大神告诉我该怎么做?
梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-3-2
回帖
3
 楼主| 发表于 2013-8-3 13:46:35 | 显示全部楼层
第一个是
  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
复制代码
回复

使用道具 举报

梦石
0
星屑
1394
在线时间
989 小时
注册时间
2011-5-11
回帖
418
发表于 2013-8-3 16:20:50 | 显示全部楼层
把其中一个脚本的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
复制代码
不知道该脚本的具体用途,如还有问题请说清楚点!

评分

参与人数 1梦石 +1 收起 理由
Sion + 1 认可答案

查看全部评分

http://rpg.blue/static/image/smiley/yct/A059.gif中国字认识都不到一半,哪的心情学英语呀!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-3-2
回帖
3
 楼主| 发表于 2013-8-3 20:52:40 | 显示全部楼层
345912390 发表于 2013-8-3 16:20
把其中一个脚本的2-4行改成如不知道该脚本的具体用途,如还有问题请说清楚点! ...

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

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部