Project1
标题: 分享一个方便导出导入RM脚本成RB格式的小东西 [打印本页]
作者: 夜白雪 时间: 2023-5-26 03:21
标题: 分享一个方便导出导入RM脚本成RB格式的小东西
需要先在电脑里安装ruby 否则不能使用
将以下内容放进新建的文本里 然后将后缀改成.RB
(导出)
# -*- encoding: utf-8 -*-
require "kconv"
require "zlib"
def export_rxdata(filename)
File.open(filename, "rb") {|handle|
script = Marshal.load(handle)
index = 0
script.each {|row|
filename = row[1].tosjis.gsub(/\//, "_") + ".rb"
no = sprintf("%04d", index)
index += 10
File.open("Scripts/#{no}_#{filename}", "wb") {|output|
output.write Zlib::Inflate.inflate(row[2])
}
}
}
end
if !FileTest::exists?("Scripts")
Dir::mkdir("Scripts")
end
export_rxdata("Data/Scripts.rxdata")
# -*- encoding: utf-8 -*-
require "kconv"
require "zlib"
def export_rxdata(filename)
File.open(filename, "rb") {|handle|
script = Marshal.load(handle)
index = 0
script.each {|row|
filename = row[1].tosjis.gsub(/\//, "_") + ".rb"
no = sprintf("%04d", index)
index += 10
File.open("Scripts/#{no}_#{filename}", "wb") {|output|
output.write Zlib::Inflate.inflate(row[2])
}
}
}
end
if !FileTest::exists?("Scripts")
Dir::mkdir("Scripts")
end
export_rxdata("Data/Scripts.rxdata")
其中里面RXDATA 可以改成RVDATA RVDATA2 来导出 VX 和 VA 的脚本 现在这个默认是导出XP的
# -*- encoding: utf-8 -*-
require "kconv"
require "zlib"
require "date"
scripts = []
index = 0
Dir.entries("Scripts").sort.each {|file|
next if file=="." || file==".."
next if file !~ /\.rb$/
filename = file.toutf8
filename.slice!(".rb")
filename = filename[5..-1]
script = File.read("Scripts/#{file}")
raw = [index, filename, Zlib::Deflate.deflate(script)]
scripts.push(raw)
index += 1
}
if FileTest.exists?("Data/Scripts.rxdata")
File.rename("Data/Scripts.rxdata", "Data/Scripts.rxdata_"+DateTime.now.strftime("%Y%m%d_%H%M%S"))
end
File.open("Data/Scripts.rxdata", "wb") {|output|
Marshal.dump(scripts, output)
}
# -*- encoding: utf-8 -*-
require "kconv"
require "zlib"
require "date"
scripts = []
index = 0
Dir.entries("Scripts").sort.each {|file|
next if file=="." || file==".."
next if file !~ /\.rb$/
filename = file.toutf8
filename.slice!(".rb")
filename = filename[5..-1]
script = File.read("Scripts/#{file}")
raw = [index, filename, Zlib::Deflate.deflate(script)]
scripts.push(raw)
index += 1
}
if FileTest.exists?("Data/Scripts.rxdata")
File.rename("Data/Scripts.rxdata", "Data/Scripts.rxdata_"+DateTime.now.strftime("%Y%m%d_%H%M%S"))
end
File.open("Data/Scripts.rxdata", "wb") {|output|
Marshal.dump(scripts, output)
}
使用方法同上
作者: qq634488405 时间: 2023-5-26 08:48
好像有个叫Gemini script editor的,可以打开RMXP/VX/VA脚本,并支持导出为.rb,无需安装ruby
作者: 夜白雪 时间: 2023-5-26 23:28
诶诶诶! 发晚了吗,..几年前用过这个 然后一直放角落吃灰来着的...
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |