本帖最后由 VIPArcher 于 2014-10-21 15:31 编辑
https://rpg.blue/thread-366832-1-1.html
如果看不懂在怎么用就用下面
output_directory = "ScriptTexts" # 输出目录 Dir.mkdir(output_directory) unless File.directory?(output_directory) load_data("Data/Scripts.rvdata2").each_with_index {|script, index| tag = script[1] unless tag.empty? contents = Zlib::Inflate.inflate(script[2].force_encoding("utf-8")) unless contents.empty? tag = tag.gsub(/[\\\/\:\"\?\*\<\>\|]/) {'_'} name = sprintf("#{output_directory}/[%04d]#{tag}.txt", index) txt = File.open(name, "wb") txt.write(contents) txt.close end end }
output_directory = "ScriptTexts" # 输出目录
Dir.mkdir(output_directory) unless File.directory?(output_directory)
load_data("Data/Scripts.rvdata2").each_with_index {|script, index|
tag = script[1]
unless tag.empty?
contents = Zlib::Inflate.inflate(script[2].force_encoding("utf-8"))
unless contents.empty?
tag = tag.gsub(/[\\\/\:\"\?\*\<\>\|]/) {'_'}
name = sprintf("#{output_directory}/[%04d]#{tag}.txt", index)
txt = File.open(name, "wb")
txt.write(contents)
txt.close
end
end
}
|