设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1161|回复: 0
打印 上一主题 下一主题

输出部分脚本

[复制链接]

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

跳转到指定楼层
1
发表于 2014-6-14 20:37:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 taroxd 于 2014-7-28 12:36 编辑

需要用到这个功能的人自然知道怎么用

RUBY 代码复制
  1. #==============================================================================
  2. # ★ 输出脚本
  3. #==============================================================================
  4.  
  5. path = 'scripts'
  6. ext  = '.rb'
  7.  
  8. output = lambda do
  9.   Dir.mkdir(path) unless File.directory?(path)
  10.   $RGSS_SCRIPTS.each_with_index do |(_, tag, _, contents), i|
  11.     next unless tag.start_with?('★')..tag.start_with?('☆')
  12.     next if contents.force_encoding("utf-8").empty?
  13.     filename = tag.delete('/:*?"<>|\\')
  14.     if filename.empty?
  15.       msgbox "Warning: script #{i} with an invalid tag"
  16.     else
  17.       File.open("#{path}/#{filename}#{ext}", "wb") {|f| f << contents }
  18.     end
  19.   end
  20.   msgbox 'Scripts output successfully.'
  21.   exit
  22. end
  23.  
  24. #~ output.call if $TEST
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-22 09:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表