- 注册时间
- 2007-6-8
- 最后登录
- 2019-5-19
⑤进阶
- 积分
- 816
|

楼主 |
发表于 2007-9-19 09:49:58
|
显示全部楼层
嗯。那么请问,像如下的这段脚本为什么贴在脚本编辑器中就能执行了呢?没看见在哪儿有调用的呀。它跟系统是怎样联系起来的呢?谢谢。
#=========================================================================
# ■ 续行符文章连辍显示 by SailCat
#=========================================================================
class Window_Message
alias sailcat_refresh refresh
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
lines = 0
$game_temp.message_text.each {lines += 1}
lines = 4 if lines < 4
self.height = lines * 32 + 32
self.contents = Bitmap.new(width - 32, height - 32)
reset_window
sailcat_refresh
end
#--------------------------------------------------------------------------
# ● 设置窗口位置与不透明度
#--------------------------------------------------------------------------
def reset_window
if $game_temp.in_battle
self.y = 16
else
case $game_system.message_position
when 0 # 上
self.y = 16
when 1 # 中
self.y = 240 - self.height / 2
when 2 # 下
self.y = 464 - self.height
end
end
if $game_system.message_frame == 0
self.opacity = 255
else
self.opacity = 0
end
self.back_opacity = 160
end
end
class Interpreter
#--------------------------------------------------------------------------
# ● 显示文章
#--------------------------------------------------------------------------
def command_101
# 另外的文章已经设置过 message_text 的情况下
if $game_temp.message_text != nil
# 结束
return false
end
# 设置信息结束后待机和返回调用标志
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# message_text 设置为 1 行
$game_temp.message_text = @list[@index].parameters[0] + "\\n"
line_count = 1
# 最大 4 行
line_max = 4
# 循环
loop do
# 下一个事件指令为文章两行以上的情况
if @list[@index+1].code == 401
# message_text 添加到第 2 行以下
$game_temp.message_text += @list[@index+1].parameters[0] + "\\n"
line_count += 1
# 下一个事件指令为显示文章,且本行末尾有续行标记的情况
elsif @list[@index+1].code == 101 and @list[@index].parameters[0][-2, 2] == " _"
# 如果已经达到 12 行就返回
if line_count == 12
# 清除续行标记
$game_temp.message_text.gsub!(/ _$/, "")
# 继续
return true
end
# message_text 添加到第 2 行以下
$game_temp.message_text += @list[@index+1].parameters[0] + "\\n"
line_count += 1
# 增加 4 行空间,最多 12 行
line_max += 4 if line_max < 12
# 事件指令不在文章两行以下的情况
else
# 如果本行末尾有续行标记则增加到 12 行
if @list[@index].parameters[0][-2, 2] == " _"
line_max = 12
end
# 下一个事件指令为显示选择项的情况下
if @list[@index+1].code == 102
# 如果选择项能收纳在画面里
if @list[@index+1].parameters[0].size <= line_max - line_count
# 推进索引
@index += 1
# 设置选择项
$game_temp.choice_start = line_count
setup_choices(@list[@index].parameters)
end
# 下一个事件指令为处理输入数值的情况下
elsif @list[@index+1].code == 103 or
# 如果数值输入窗口能收纳在画面里
if line_count < line_max
# 推进索引
@index += 1
# 设置输入数值
$game_temp.num_input_start = line_count
$game_temp.num_input_variable_id = @list[@index].parameters[0]
$game_temp.num_input_digits_max = @list[@index].parameters[1]
end
end
# 清除续行标记
$game_temp.message_text.gsub!(/ _$/, "")
# 继续
return true
end
# 推进索引
@index += 1
end
end
end |
|