| 
 
| 赞 | 23 |  
| VIP | 22 |  
| 好人卡 | 18 |  
| 积分 | 609 |  
| 经验 | 44466 |  
| 最后登录 | 2020-9-19 |  
| 在线时间 | 1933 小时 |  
 Lv6.析梦学徒 Fuzzy Ginkgo Taciturn Knight
 
	梦石0 星屑60940 在线时间1933 小时注册时间2010-6-26帖子1605  
 | 
| 
本帖最后由 orzfly 于 2011-8-23 07:09 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 致伸手党、非脚本编写者:
 本脚本需和其他脚本配合使用。
 
 能与本接入包共同使用的脚本:
 
 
 致脚本编写者:
 # 为插件脚本的注释调用提供支持。需配合其他脚本使用。
 #------------------------------------------------------------------------------
 # PowerComments.register_command(args, proc)
 #   - args 为 Regexp 或包含 Regexp 的 Array
 #   - proc 为 Proc 对象
 #          当 args 中任意一个 Regexp 对象能匹配事件注释中的文字时,将会调用 proc
 #          调用 proc 时,将会传递下列参数:
 #            o 当前事件解释器实例
 #            o 成功匹配的 Regexp 的 last_match 数组
 #
 #          proc 的返回值将决定事件解释器的下一步动作
 #            o 若 proc 的执行结果是 true
 #                当前事件解释器实例 powercomments_repeat_count 归零
 #                将继续执行事件中下一指令
 #            o 若 proc 的执行结果是 false
 #                当前事件解释器实例 powercomments_repeat_count 累加(+= 1)
 #                将重复执行事件中当前指令
 复制代码#==============================================================================
# ■ 注释调用系统接入包 1.0 [VX]
#   http://orzFly.com/RM/PowerComments
#------------------------------------------------------------------------------
# 为插件脚本的注释调用提供支持。需配合其他脚本使用。
#------------------------------------------------------------------------------
# PowerComments.register_command(args, proc)
#   - args 为 Regexp 或包含 Regexp 的 Array
#   - proc 为 Proc 对象
#          当 args 中任意一个 Regexp 对象能匹配事件注释中的文字时,将会调用 proc
#          调用 proc 时,将会传递下列参数:
#            o 当前事件解释器实例
#            o 成功匹配的 Regexp 的 last_match 数组
#
#          proc 的返回值将决定事件解释器的下一步动作
#            o 若 proc 的执行结果是 true
#                当前事件解释器实例 powercomments_repeat_count 归零
#                将继续执行事件中下一指令
#            o 若 proc 的执行结果是 false
#                当前事件解释器实例 powercomments_repeat_count 累加(+= 1)
#                将重复执行事件中当前指令
#------------------------------------------------------------------------------
# - 1.0 [VX] by orzFly [[email protected]]
#   * 首个版本
#==============================================================================
module PowerComments
  Version = "1.0"
  Commands = {}
  module_function
  def register_command(args, proc)
    if args.is_a?(Array)
      args.each { |arg| register_command_single(arg, proc) }
    else
      register_command_single(args, proc)
    end
  end
  def register_command_single(regexp, proc)
    if Commands.include?(regexp)
      raise("PowerComments Command " + regexp.to_s + " already exists")
    end
    Commands[regexp] = proc
  end
end 
class Game_Interpreter
  alias :execute_command_powercomment :execute_command
  def execute_command
    if @index >= @list.size-1
      command_end
      return true
    else
      @params = @list[@index].parameters
      @indent = @list[@index].indent
      case @list[@index].code
        when 108
          return powercomments(@params[0])
        else
          return execute_command_powercomment
        return true
      end
    end
  end
  
  def powercomments(text)
    PowerComments::Commands.each {|k, v|
      if k =~ text
        result = v.call(self, *Regexp.last_match.to_a)
        @powercomments_repeat_count += 1 unless result
        @powercomments_repeat_count = 0 if result
        return result
      end
    }
    return true
  end
  
  attr_accessor :wait_count
  
  def powercomments_repeat_count
    return @powercomments_repeat_count.nil? ? 0 : @powercomments_repeat_count
  end
  
  def powercomments_repeat_count=(value)
    @powercomments_repeat_count = value
  end
end
 | 
 |