Project1
标题: 对话框脚本出错,就大侠帮解决 [打印本页]
作者: w20160 时间: 2011-5-18 22:45
标题: 对话框脚本出错,就大侠帮解决
由于本人是脚本小白,又特想制作一个自己的RPG游戏。所以花钱请人代写了脚本。现在脚本的对话框出错。出错问题在于对话完这话,对话框不消失。游戏就卡死了。所以想请大侠帮忙修改下。我也不知道出错了那里,所以只有发 全部脚本!
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#——说明
#默认为一个字一个字的方式,如果需要一次全部显示,
#请在游戏中使用脚本:$game_system.typing = true
#默认对话字没有声音,如果需要声音,
#请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
#我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音
# 其他在对话中可以使用的功能:
#
[1]:显示1号角色的姓名
#
ame[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
# p[1]:对话框出现在1号事件的上方
# p[0]:主人公上方出现对话框
#——————————————————使用p功能后可以自动调整对话框大小
# :显示""这个符号
# v[1] :显示变量1
# v[a1] :显示防具1
# v[w1] :显示武器1
# v[i1] :显示物品1
# v[s1] :显示特技1
# c[1-8]:更改颜色
# g:显示金钱窗口
# a[SE文件名]:对话的时候播放SE
# s[1-19]:更改弹字的速度
# . :停顿一刹那(1、2帧)
# | :停顿片刻(20帧)
# > :文字不用打字方式
# < :文字使用打字方式
# ! :等待玩家按回车再继续
# ~ :文字直接消失
# I :下一行从这个位置开始
# o[123]:文字透明度改为123,模拟将死之人(汗)
# h[12]:改用12号字
# [50]:空50象素
# K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效
# L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
# R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
# Lk:清除左边的图像
# Rk:清除右边的图像
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# 处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
# $game_system 。
#==============================================================================
class Game_System
attr_accessor :typing
attr_accessor :soundname_on_speak
alias carol3_ini initialize
def initialize
carol3_ini
@typing = true
@soundname_on_speak = nil
end
end
$加密 = true
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化状态
#--------------------------------------------------------------------------
def initialize
super(80, 304, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.z = 9998
@fade_in = false
@fade_out = false
@contents_showing = false
@cursor_width = 0
self.active = false
self.index = -1
if $game_system.soundname_on_speak == nil then
$game_system.soundname_on_speak = ""
end
@opacity_text_buf = Bitmap.new(32, 32)
self.windowskin = RPG::Cache.windowskin("001-Blue01")
self.contents.font.color = Color.new(0,0,0,255)
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
terminate_message
$game_temp.message_window_showing = false
if @input_number_window != nil
@input_number_window.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 处理信息结束
#--------------------------------------------------------------------------
def terminate_message
self.active = false
self.pause = false
self.index = -1
self.contents.clear
# 清除显示中标志
@contents_showing = false
# 呼叫信息调用
if $game_temp.message_proc != nil
$game_temp.message_proc.call
end
# 清除文章、选择项、输入数值的相关变量
$game_temp.message_text = nil
$game_temp.message_proc = nil
$game_temp.choice_start = 99
$game_temp.choice_max = 0
$game_temp.choice_cancel_type = 0
$game_temp.choice_proc = nil
$game_temp.num_input_start = 99
$game_temp.num_input_variable_id = 0
$game_temp.num_input_digits_max = 0
# 开放金钱窗口
if @gold_window != nil
@gold_window.dispose
@gold_window = nil
end
if @name_window_frame != nil
@name_window_frame.dispose
@name_window_frame = nil
end
if @name_window_text != nil
@name_window_text.dispose
@name_window_text = nil
end
if @right_picture != nil and @right_keep == true
@Messageing.dispose
@right_picture.dispose
end
if @left_picture != nil and @left_keep == true
@Messageing.dispose
@left_picture.dispose
end
end
def refresh
# 初期化
self.contents.clear
#self.contents.font.color = Color.new(0,0,0,255)
self.contents.font.size = Font.default_size
@x = @y = @max_x = @max_y = @indent = @lines = 0
@left_keep = @right_keep = false
@face_indent = 0
@opacity = 255
@cursor_width = 0
@write_speed = 0
@write_wait = 0
@mid_stop = false
@face_file = nil
@popchar = -2
if $game_temp.choice_start == 0
@x = 8
end
if $game_temp.message_text != nil
@now_text = $game_temp.message_text
#——头像设置
if (/[Ff][(.+?)]/.match(@now_text))!=nil then
@face_file = $1 + ".png"
@x = @face_indent = 142
if FileTest.exist?("Graphics/Face/" + $1 + ".png")
self.contents.blt(16, 16, Bitmap.new("Graphics/Face/"+@face_file), Rect.new(0, 0, 96, 96))
end
@now_text.gsub!(/[Ff][(.*?)]/) { "" }
end
#——左半身像设置
if (/[Ll][(.+?)]/.match(@now_text))!=nil then
@face = $1 + ".png"
if $加密 == true
if @left_picture != nil
@left_picture.dispose
end
@left_picture = Sprite.new
@left_picture.bitmap = Bitmap.new("Graphics/Face/#{@face}")
@left_picture.y = 180
@left_picture.x = 105
@left_picture.z = 9999
@Messageing = Sprite.new
@Messageing.bitmap = Bitmap.new("Graphics/Face/Left")
@Messageing.x= 0;@Messageing.y= 328;
@Messageing.z = 9999
@now_text.gsub!(/[Ll][(.*?)]/) { "" }
else
if FileTest.exist?("Graphics/Face/#{@face}")
if @left_picture != nil
@left_picture.dispose
end
@left_picture = Sprite.new
@left_picture.bitmap = Bitmap.new("Graphics/Face/#{@face}")
@left_picture.y = 180
@left_picture.x = 105
@left_picture.z = 9999
@Messageing = Sprite.new
@Messageing.bitmap = Bitmap.new("Graphics/Face/Left")
@Messageing.x= 0;@Messageing.y= 328;
@Messageing.z = 9999
@now_text.gsub!(/[Ll][(.*?)]/) { "" }
end
end
end
#——右半身像设置
if (/[Rr][(.+?)]/.match(@now_text))!=nil then
@face = $1 + ".png"
if $加密 == true
if @right_picture != nil
@right_picture.dispose
end
@right_picture = Sprite.new
@right_picture.bitmap = Bitmap.new("Graphics/Face/#{@face}")
@right_picture.y = 180
@right_picture.x = 416
@right_picture.z = 9999
@Messageing = Sprite.new
@Messageing.bitmap = Bitmap.new("Graphics/Face/Right")
@Messageing.x= 0;@Messageing.y= 328;
@Messageing.z = 9999
@now_text.gsub!(/[Rr][(.*?)]/) { "" }
else
if FileTest.exist?("Graphics/Face/#{@face}")
if @right_picture != nil
@right_picture.dispose
end
@right_picture = Sprite.new
@right_picture.bitmap = Bitmap.new("Graphics/Face/#{@face}")
@right_picture.y = 180
@right_picture.x = 416
@right_picture.z = 9999
@Messageing = Sprite.new
@Messageing.bitmap = Bitmap.new("Graphics/Face/Right")
@Messageing.x= 0;@Messageing.y= 328;
@Messageing.z = 9999
@now_text.gsub!(/[Rr][(.*?)]/) { "" }
end
end
end
if (/[Rr]k/.match(@now_text)) != nil
@right_keep = true
@now_text.sub!(/[Rr]k/) { "" }
end
if (/[Ll]k/.match(@now_text)) != nil
@left_keep = true
@now_text.sub!(/[Ll]k/) { "" }
end
# 显示人物姓名
name_window_set = false
if (/[Nn]ame[(.+?)]/.match(@now_text)) != nil
name_window_set = true
name_text = $1
@now_text.sub!(/[Nn]ame[(.*?)]/) { "" }
end
# 文字位置的判定
if (/[Pp][([-1,0-9]+)]/.match(@now_text))!=nil then
@popchar = $1.to_i
if @popchar == -1
@x = @indent = 48
@y = 4
end
@now_text.gsub!(/[Pp][([-1,0-9]+)]/) { "" }
end
# 开始
begin
last_text = @now_text.clone
@now_text.gsub!(/[Vv][([IiWwAaSs]?)([0-9]+)]/) { convart_value($1, $2.to_i) }
end until @now_text == last_text
@now_text.gsub!(/[Nn][([0-9]+)]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
@now_text.gsub!(//) { "