| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 11 |
| 经验 | |
| 最后登录 | 2024-6-25 |
| 在线时间 | 126 小时 |
- 梦石
- 0
- 星屑
- 1107
- 在线时间
- 126 小时
- 注册时间
- 2020-11-27
- 回帖
- 48
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
我使用了一个脚本,按照脚本注释后,在游戏进行时,脚本
会出现错误。
这是脚本。- ##----------------------------------------------------------------------------##
- ## 物品说明窗口 v1.0
- ## Created by Neon Black
- ##
- ## For both commercial and non-commercial use as long as credit is given to
- ## Neon Black and any additional authors. Licensed under Creative Commons
- ## CC BY 3.0 - http://creativecommons.org/licenses/by/3.0/.
- ##----------------------------------------------------------------------------##
- ##
- ##----------------------------------------------------------------------------##
- ## Revision Info:
- ## v1.0 - 3.3.2013
- ## Wrote and debugged main script
- ##----------------------------------------------------------------------------##
- ##
- $imported ||= {} ##
- $imported["EFFECTS_BOX"] = 1.0 ##
- ##
- ##----------------------------------------------------------------------------##
- ## Instructions:
- ## 前置脚本: Neon Black - 特性和效果模块. You can
- ## obtain it from http://cphouseset.wordpress.com/modules/. If you do not
- ## import it, you will get errors.
- ##
- ## This script is plug and play. It allows a pop-up boxes to display on equips,
- ## items, and skills. You can choose to have these pop-ups be constant, toggle
- ## with a button press, or only appear while a key is held down. These display
- ## 3 bits of information. First an added note, second all the stats equipping
- ## the item will provide, and finally all the effects or features of the item.
- ## A note can be added using <effect note> and </effect note> and placing your
- ## note in between those tags, like so:
- ##
- =begin
- 使用物品/武器/护甲备注:
- <effect note>
- 第一行文字
- 第二行文字
- </effect note>
-
- =end
- ##
- ##----------------------------------------------------------------------------##
- ##
- module CP # Do not touch ##
- module EFFECTS_WINDOW # these lines. ##
- ##----------------------------------------------------------------------------##
- ## Config:
- ## The config options are below. You can set these depending on the flavour of
- ## your game. Each option is explained in a bit more detail above it.
- ##
- ##------
- # 窗口边框宽度
- EDGES = 8
- # 字体大小
- FONT_SIZE = 16
- # 是否显示文字阴影和描边
- SHADOW = true
- OUTLINE = true
- # 是否显示装备的说明窗口
- SHOW_STATS = true
- # 显示说明窗口的按键
- BOX_KEY = :A
- # 显示类型
- # 0 = 按住按键才会显示
- # 1 = 按下按键显示或隐藏
- # 2 = 始终显示
- SHOW_TYPE = 2
- # 如果上面设定为2,在这里设定是否默认显示
- @show = true
- ##----------------------------------------------------------------------------##
- ##
- ##
- ##----------------------------------------------------------------------------##
- ## The following lines are the actual core code of the script. While you are
- ## certainly invited to look, modifying it may result in undesirable results.
- ## Modify at your own risk!
- ###----------------------------------------------------------------------------
- def self.toggle_effects
- @show = !@show if Input.trigger?(BOX_KEY)
- return @show
- end
- end
- end
- module SceneManager
- class << self
- alias :cp_rshp_run :run unless method_defined?(:cp_rshp_run)
- end
- def self.run
- cp_module_check_features
- cp_rshp_run
- end
- def self.cp_module_check_features
- return if $imported["CP_FEATURES_EFFECTS"]
- a1 = "One or more scripts require Neon Black's Features and Effects module."
- a2 = "This can be obtained at http://cphouseset.wordpress.com/modules/"
- a3 = "Please add this module and try again."
- a4 = "Please contact the creator of the game to resolve this issue."
- if $TEST || $BTEST
- msgbox "#{a1}/n#{a2}/n#{a3}"
- Thread.new{system("start http://cphouseset.wordpress.com/modules/#features")}
- else
- msgbox "#{a1}/n#{a4}"
- end
- end
- end
- class Window_Selectable < Window_Base
- def item
- return nil
- end
- alias :cp_itembox_update :update
- def update(*args)
- cp_itembox_update(*args)
- show_fet_window
- end
- def show_fet_window
- key = key_show_features_box
- show_feature_box if key && active && open?
- remove_feature_box unless key && active && open?
- end
- def key_show_features_box
- case CP::EFFECTS_WINDOW::SHOW_TYPE
- when 0
- return Input.press?(CP::EFFECTS_WINDOW::BOX_KEY)
- when 1
- return CP::EFFECTS_WINDOW.toggle_effects
- when 2
- return true
- else
- return false
- end
- end
- def show_feature_box ## Creates the box if shift is held.
- if item != @last_box_item
- if feature_box_item?
- @feature_box.dispose unless @feature_box.nil?
- rect = item_rect(@index)
- x = rect.x + self.x + padding + 24 - ox
- y = rect.y + line_height + self.y + padding - oy - 2
- @feature_box = Window_FeaturesShow.new(item, x, y, self)
- @last_box_item = item
- else
- remove_feature_box
- end
- end
- end
- def feature_box_item?
- item.is_a?(RPG::EquipItem) || item.is_a?(RPG::UsableItem)
- end
- def remove_feature_box ## Dispose the box.
- @feature_box.dispose unless @feature_box.nil?
- @feature_box = nil
- @last_box_item = nil
- end
- end
- class Window_FeaturesShow < Window_Base
- def initialize(item, x, y, parent)
- @parent = parent
- @bx = x; @by = y
- @item = item
- super(0, 0, 500, 500)
- self.z = @parent.z + 500
- self.windowskin = Cache.system("Window")
- self.back_opacity = 255
- self.tone = Tone.new
- make_width
- make_height
- make_position
- draw_all_items
- end
- def make_width
- contents.font.size = line_height
- contents.font.outline = CP::EFFECTS_WINDOW::OUTLINE
- contents.font.shadow = CP::EFFECTS_WINDOW::SHADOW
- i = 120
- unless notes.empty?
- i = [i, notes.collect{|n| contents.text_size(n).width}.max + 2].max
- end
- unless effects.empty?
- i = [i, effects.collect{|e| contents.text_size(e.vocab).width}.max + 2].max
- end
- unless stats.empty?
- i = [i, stats.collect{|s| contents.text_size(s).width}.max + 2].max
- end
- self.width = i + standard_padding * 2
- end
- def make_height
- sw = self.width - standard_padding * 2
- i = standard_padding * 2
- i += notes.size * line_height
- i += effects.size * line_height
- i += seps * line_height / 2
- unless stats.empty?
- w = stats.collect{|s| contents.text_size(s).width}.max + 2
- n = [sw / w, 1].max
- i += (stats.size + n - 1) / n * line_height
- end
- self.height = i
- self.visible = false if i == standard_padding * 2
- create_contents
- contents.font.size = line_height
- contents.font.outline = false
- contents.font.shadow = false
- change_color(normal_color)
- end
- def make_position
- self.x = @bx + self.width > Graphics.width ? Graphics.width - self.width :
- @bx
- self.y = @by + self.height <= Graphics.height ? @by :
- @by - self.height - @parent.line_height + 4 > 0 ? @by -
- self.height - @parent.line_height + 4 : Graphics.height -
- self.height
- end
- def standard_padding
- CP::EFFECTS_WINDOW::EDGES
- end
- def line_height
- CP::EFFECTS_WINDOW::FONT_SIZE
- end
- def seps
- i = -1
- i += 1 unless effects.empty?
- i += 1 unless notes.empty?
- i += 1 unless stats.empty?
- return [i, 0].max
- end
- def stats
- return [] unless CP::EFFECTS_WINDOW::SHOW_STATS && @item.is_a?(RPG::EquipItem)
- r = []
- 8.times do |i|
- next if @item.params[i] == 0
- r.push("#{Vocab.param(i)} #{@item.params[i]}")
- end
- return r
- end
- def notes
- @item.effect_desc
- end
- def effects
- if @item.is_a?(RPG::EquipItem)
- @item.features
- elsif @item.is_a?(RPG::UsableItem)
- @item.effects
- end
- end
- def draw_all_items
- contents.clear
- y = 0
- notes.each do |l|
- draw_text(1, y, contents.width, line_height, l)
- y += line_height
- end
- y += line_height / 2 unless y == 0
- unless stats.empty?
- w = stats.collect{|s| contents.text_size(s).width}.max + 2
- xt = contents.width / w
- xw = contents.width / xt
- xn = 0
- y -= line_height
- stats.each_with_index do |s, index|
- y += line_height if index % xt == 0
- case s
- when /(.*) (-?)(\d+)/i
- draw_text(xw * (index % xt) + 1, y, xw, line_height, "#{$1.to_s}")
- draw_text(xw * (index % xt) + 1, y, xw, line_height,
- "#{$2.to_s}#{$3.to_s} ", 2)
- end
- end
- y += line_height
- end
- y += line_height / 2 unless y == 0
- effects.each do |e|
- draw_text(1, y, contents.width, line_height, e.vocab)
- y += line_height
- end
- end
- end
- class RPG::BaseItem
- def effect_desc
- make_effect_desc if @effect_desc.nil?
- return @effect_desc
- end
- def make_effect_desc
- @effect_desc = []
- noted = false
- self.note.split(/[\r\n]+/i).each do |line|
- case line
- when /<effect note>/i
- noted = true
- when /<\/effect note>/i
- break
- else
- @effect_desc.push("#{line}")
- end
- end
- end
- end
- ###--------------------------------------------------------------------------###
- # End of script. #
- ###--------------------------------------------------------------------------###
复制代码 |
-
|