加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 taroxd 于 2014-7-28 12:36 编辑
需要用到这个功能的人自然知道怎么用
#============================================================================== # ★ 输出脚本 #============================================================================== path = 'scripts' ext = '.rb' output = lambda do Dir.mkdir(path) unless File.directory?(path) $RGSS_SCRIPTS.each_with_index do |(_, tag, _, contents), i| next unless tag.start_with?('★')..tag.start_with?('☆') next if contents.force_encoding("utf-8").empty? filename = tag.delete('/:*?"<>|\\') if filename.empty? msgbox "Warning: script #{i} with an invalid tag" else File.open("#{path}/#{filename}#{ext}", "wb") {|f| f << contents } end end msgbox 'Scripts output successfully.' exit end #~ output.call if $TEST
#==============================================================================
# ★ 输出脚本
#==============================================================================
path = 'scripts'
ext = '.rb'
output = lambda do
Dir.mkdir(path) unless File.directory?(path)
$RGSS_SCRIPTS.each_with_index do |(_, tag, _, contents), i|
next unless tag.start_with?('★')..tag.start_with?('☆')
next if contents.force_encoding("utf-8").empty?
filename = tag.delete('/:*?"<>|\\')
if filename.empty?
msgbox "Warning: script #{i} with an invalid tag"
else
File.open("#{path}/#{filename}#{ext}", "wb") {|f| f << contents }
end
end
msgbox 'Scripts output successfully.'
exit
end
#~ output.call if $TEST
|