| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2015-4-25 |
| 在线时间 | 72 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 72 小时
- 注册时间
- 2013-8-26
- 回帖
- 30
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
比如喵呜喵5大人的脚本合集里,直接把脚本复制下来是不行的,只能在帖子上弄代码复制才可以,例如这几个
[pre lang="ruby" line="1"]
=begin
===============================================================================
视觉小说 By喵呜喵5
===============================================================================
【说明】
滚动文字变成视觉小说模式,支持对话中使用的转义字符“\.”、“\!”等
本质上不过是修改了传统的文字对话框,将其大小变为全屏幕罢了……
使用的时候先用事件指令中的脚本输入“m5_novel”(不包含双引号),
然后输入滚动文字
实际运行的时候就会以视觉小说的形式显示出来
(切换对话请使用转义字符“\!”)
因为是初版,并没有添加太多的功能,之后有时间可能会对这个脚本进行优化吧
=end
#==============================================================================
# 脚本部分
#==============================================================================
class Window_Message
alias m5_update_placement update_placement
def update_placement
@position = $game_message.position
if @position == 3
self.width = Graphics.width
self.height = Graphics.height
self.x = 0
self.y = 0
else
self.width = m5_window_width
self.height = m5_window_height
m5_update_placement
end
end
alias m5_need_new_page? need_new_page?
def need_new_page?(text, pos)
if @position == 3
return (pos[:y] + pos[:height] > (Graphics.height - standard_padding * 2)\
&& !text.empty?)
else
return m5_need_new_page?(text, pos)
end
end
alias m5_initialize initialize
def initialize
m5_initialize
self.width = m5_window_width
self.height = m5_window_height
end
alias m5_window_width window_width
def window_width
Graphics.width
end
alias m5_window_height window_height
def window_height
Graphics.height
end
end
class Game_Interpreter
def m5_novel
index,list = @index,@list
if list[index+1].code == 105
list[index+1].code = 101
list[index+1].parameters = ["",0,2,3]
index += 2
while list[index].code == 405
list[index].code = 401
index += 1
end
end
end
end[/pre]
[pre lang="ruby" line="1"]
=begin
===============================================================================
对话框光标 By喵呜喵5
===============================================================================
【说明】
允许使用任意图片作为对话框下一句提示的光标
=end
$m5script = {} if $m5script.nil?
$m5script["M5MessageCursor"] = true
module M5MessageCursor
#==============================================================================
# 设定部分
#==============================================================================
FILENAME = "Cursor"
#光标图片的文件名,放到Graphics\System文件夹下
FRAME = 4
#光标图片的帧数,只有一张图片并且不需要动画效果这里填写1就好了
DURA = 10
#光标播放动画效果时每张图片的持续时间
POS1 = [491,387]
#对话框居下时光标的[X,Y]坐标
POS2 = [491,239]
#对话框居中时光标的[X,Y]坐标
POS3 = [491,91]
#对话框居上时光标的[X,Y]坐标
Z = 201
#光标的Z坐标,当光标遮住某些窗口时请尝试修改这里
SWI = 1
#对应ID的开关打开的时候,不显示光标
#==============================================================================
# 设定结束
#==============================================================================
#==============================================================================
# 脚本部分
#==============================================================================
end
#--------------------------------------------------------------------------
# ● 光标精灵的类
#--------------------------------------------------------------------------
class Sprite_MessageCursor < Sprite_Base
#--------------------------------------------------------------------------
# ●载入
#--------------------------------------------------------------------------
include M5MessageCursor
def initialize
@viewport = Viewport.new(-Graphics.width/2, -Graphics.height/2,
Graphics.width*2, Graphics.height*2)
@viewport.z = Z
super(@viewport)
self.bitmap = Cache.system(FILENAME)
self.visible = false
update_placement
@duration = @frame = 0
@width = self.bitmap.width / FRAME
update
end
#--------------------------------------------------------------------------
# ●设置位置
#--------------------------------------------------------------------------
def update_placement(pos = 2)
self.x,self.y = pos == 2 ? POS1 : (pos == 1 ? POS2 : POS3)
self.x += Graphics.width/2
self.y += Graphics.height/2
end
#--------------------------------------------------------------------------
# ●释放
#--------------------------------------------------------------------------
def dispose
@viewport.dispose
super
end
#--------------------------------------------------------------------------
# ● 更新动画效果
#--------------------------------------------------------------------------
def update
super
if self.visible
hide if $game_switches[SWI]
if @duration > 0
@duration -= 1
else
self.src_rect.set(@frame * @width, 0, @width, self.bitmap.height)
@duration = DURA
@frame = (@frame == FRAME-1) ? 0 : @frame +1
end
end
end
#--------------------------------------------------------------------------
# ● 显示光标
#--------------------------------------------------------------------------
def show
self.visible = true
end
#--------------------------------------------------------------------------
# ● 隐藏光标
#--------------------------------------------------------------------------
def hide
self.visible = false
end
#--------------------------------------------------------------------------
# ● 是否显示?
#--------------------------------------------------------------------------
def need_show?
return false if $game_switches[SWI]
!self.visible
end
end
#--------------------------------------------------------------------------
# ●对话框的类
#--------------------------------------------------------------------------
class Window_Message
#--------------------------------------------------------------------------
# ● 载入光标精灵
#--------------------------------------------------------------------------
alias m5_20140305_initialize initialize
def initialize
m5_20140305_initialize
@message_cursor = Sprite_MessageCursor.new
end
#--------------------------------------------------------------------------
# ● 释放光标精灵
#--------------------------------------------------------------------------
alias m5_20140305_dispose dispose
def dispose
m5_20140305_dispose
@message_cursor.dispose
end
#--------------------------------------------------------------------------
# ● 更新光标精灵
#--------------------------------------------------------------------------
alias m5_20140305_update update
def update
m5_20140305_update
@message_cursor.update
@message_cursor.show if self.pause && self.open? && @message_cursor.need_show?
@message_cursor.hide if @message_cursor.visible and
((!self.pause && self.open? && @message_cursor.visible) or $game_switches[M5MessageCursor::SWI])
end
#--------------------------------------------------------------------------
# ● 更新光标位置
#--------------------------------------------------------------------------
alias m5_20140305_update_placement update_placement
def update_placement
m5_20140305_update_placement
@message_cursor.update_placement(@position)
end
end[/pre]
[pre lang="ruby" line="1"]
=begin
===============================================================================
对话显示姓名 By喵呜喵5
===============================================================================
【说明】
通过在对话中加入
\name[姓名]
则可以在对话中显示姓名,通过修改设定部分的设定乃至修改脚本可以让这个姓名显示脚本看起
来更漂亮一些
实在不会修改的话,默认的样式应该也还过得去吧……
=end
module M5Name
#==============================================================================
# 设定部分
#==============================================================================
LINE = 4
#文章显示的行数,姓名框会占用一行
FONT = ["黑体"]
#姓名所使用的字体
SIZE = 20
#姓名字体的大小,不建议超过你默认的文字大小,不然会发生奇怪的换页……
COLOR = Color.new(0,0,0, 210)
#姓名的颜色,四个数值分别是R、G、B以及透明度
BOLD = false
#姓名是否加粗
ITALIC = false
#姓名是否斜体
SHADOW = false
#姓名是否有阴影
OUT = true
#姓名是否加边框
OUT_COLOR = Color.new(255, 255, 255, 100)
#姓名边框的颜色,四个数值分别是R、G、B以及透明度
ALIGN = 0
#姓名的对齐方式,0,1,2分别是居左、居中、居右
COLOR1 = Color.new(255, 255, 255, 128)
#姓名的背景框左边的颜色,四个数值分别是R、G、B以及透明度
#有能力建议直接修改下方的脚本调整成适合自己游戏的样式
COLOR2 = Color.new(255, 255, 255, 0)
#姓名的背景框右边的颜色,四个数值分别是R、G、B以及透明度
#有能力建议直接修改下方的脚本调整成适合自己游戏的样式
#==============================================================================
# 设定结束
#==============================================================================
end
#==============================================================================
# 脚本部分
#==============================================================================
class Window_Message < Window_Base
def visible_line_number
return M5Name::LINE
end
def process_all_text
open_and_wait
text = convert_escape_characters($game_message.all_text)
text.slice!(/\ename\[(.+?)\]/i)
@showname = $1
pos = {}
new_page(text, pos)
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
def new_line_x
$game_message.face_name.empty? ? 0 : 112
end
def new_page(text, pos)
contents.clear
draw_face($game_message.face_name, $game_message.face_index, 0,0)
contents.font.name = M5Name::FONT
contents.font.bold = M5Name::BOLD
contents.font.italic = M5Name::ITALIC
contents.font.outline = M5Name::OUT
contents.font.shadow = M5Name::SHADOW
contents.font.color = M5Name::COLOR
contents.font.out_color = M5Name::OUT_COLOR
contents.font.size = M5Name::SIZE
if @showname != nil
draw_namebackground(text_size(@showname))
draw_text($game_message.face_name.empty? ? 0 : 112,0,contents_width,
M5Name::SIZE, @showname,M5Name::ALIGN)
pos[:y] = M5Name::SIZE
else
pos[:y] = 0
end
reset_font_settings
pos[:x] = new_line_x
pos[:new_x] = new_line_x
pos[:height] = calc_line_height(text)
@showname = ""
clear_flags
end
def reset_font_settings
change_color(normal_color)
contents.font.bold = Font.default_bold
contents.font.italic = Font.default_italic
contents.font.name = Font.default_name
contents.font.outline = Font.default_outline
contents.font.shadow = Font.default_shadow
contents.font.size = Font.default_size
contents.font.out_color = Font.default_out_color
end
#==============================================================================
# 以下内容用来描绘姓名框的背景,有能力的建议自行对其修改成适合自己游戏的样式
#==============================================================================
def draw_namebackground(rect)
temp_rect = rect.clone
temp_rect.x = $game_message.face_name.empty? ? 0 : 112
temp_rect.width = 460
contents.gradient_fill_rect(temp_rect, name_color1, name_color2)
end
def name_color1
M5Name::COLOR1
end
def name_color2
M5Name::COLOR2
end
end
#==============================================================================
# 脚本结束
#==============================================================================[/pre]
有什么别的方法能把这些脚本不发代码地复制下来呢?求教! |
|