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

Project1

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

[已经解决] 請問有沒有甚麼程式可以將純文字檔編譯成RM的腳本檔?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
80
在线时间
243 小时
注册时间
2007-2-10
帖子
50

开拓者

1
发表于 2015-8-6 13:40:47 | 显示全部楼层
  1. =begin
  2. #===============================================================================
  3. Title: External Script Loader
  4. Author: Tsukihime
  5. Date: Dec 2, 2013
  6. URL: http://himeworks.wordpress.com/2013/12/02/external-script-loader/
  7. --------------------------------------------------------------------------------
  8. ** Change log
  9. Dec 2, 2013
  10.    - Initial release
  11. --------------------------------------------------------------------------------   
  12. ** Terms of Use
  13. * Free to use in commercial/non-commercial projects
  14. * No real support. The script is provided as-is
  15. * Will do bug fixes, but no compatibility patches
  16. * Features may be requested but no guarantees, especially if it is non-trivial
  17. * Credits to Tsukihime in your project
  18. * Preserve this header
  19. --------------------------------------------------------------------------------
  20. ** Description

  21. This script allows you to load external scripts into the game. It supports
  22. loading from encrypted archives as well.

  23. --------------------------------------------------------------------------------
  24. ** Installation

  25. Place this script below Materials and above Main

  26. --------------------------------------------------------------------------------
  27. ** Usage

  28. To load and evaluate script, use the following function call:

  29.    load_script(script_path)

  30. --------------------------------------------------------------------------------
  31. ** Example

  32. I have a folder called "Scripts" and a script called "test.rb" in that folder.
  33. If I want to load the script, I would just write

  34.    load_script("Scripts/test.rb")

  35. This will evaluate the test script.

  36. #===============================================================================
  37. =end
  38. $imported = {} if $imported.nil?
  39. $imported["TH_ExternalScriptLoader"] = true
  40. #===============================================================================
  41. # * Rest of Script
  42. #===============================================================================
  43. #-------------------------------------------------------------------------------
  44. # Convenience function. Equivalent to
  45. #   script = load_data(path)
  46. #   eval(script)
  47. # It supports loading from encrypted archives
  48. #-------------------------------------------------------------------------------
  49. def load_script(path)
  50.   eval(load_data(path))
  51. end

  52. #-------------------------------------------------------------------------------
  53. # Load files from non-RM files
  54. #-------------------------------------------------------------------------------
  55. class << Marshal
  56.   alias_method(:th_core_load, :load)
  57.   def load(port, proc = nil)
  58.     th_core_load(port, proc)
  59.   rescue TypeError
  60.     if port.kind_of?(File)
  61.       port.rewind
  62.       port.read
  63.     else
  64.       port
  65.     end
  66.   end
  67. end unless Marshal.respond_to?(:th_core_load)
复制代码
load_script("Scripts/setup.rb")  *使用这个加载

点评

可以不限檔名和數量載入嗎?  发表于 2016-10-26 23:54
要是.rb的话直接用默认的 load 不就成了...  发表于 2015-8-6 21:13
。。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-5-4 22:08

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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