I have been learning ruby and here are some of my discoveries.
本人学过ruby,最近钻研Ruby后有了些发现,特不揣谫陋,略伸管见。
rmpx uses ruby version 1.8.1, I found out by checking the RUBY_VERSION global constant.
RMXP采用的ruby版本是1.8.1,这个东西便是通过查询RUBY_VERSION的全局常量发现的。-_-0
The ruby 1.8.1 download is worthwhile if you write scripts.
It comes with better documentation, samples, and a code editor that has syntax checking .
倘若你想学写脚本,那么下载一个 ruby 1.8.1 还是很值得的,不一定非得死磨RGSS。
这个版本有了更优良的文件,范例,还附带一个代码编辑器,能够检查语法……
I think it is a good idea to write scripts and save them as a .rb file, and then load them into rmxp like so.
个人感觉把写完的脚本存为一个.rb扩展名的文件,然后再在RMXP中导入这个文件不失为一个写脚本的好方法,如下:
require 'Scripts\Test.rb'
复制代码
search directories for scripts are added like this.
# $: is a global array. Each string specifies a directory to be searched for Ruby scripts.
# $: 是一个全局数组,每一个字符都指定了一个文件夹以供搜索Ruby的脚本。
$: << Dir.getwd
# Dir.getwd Returns the path to the current working directory (where the game.exe and .rxproj are)
(If you want to load scripts used by events you may have to load them in a rmxp script near the top of the list, I dont know, I have not yet worked with events much.Notice the ' ' strings, they are different then the " " strings, single quotes done use all the \ codes.)
(如果你想在事件的脚本中导入,可能需要在脚本编辑器中靠上的地方导入,未经测试,不太清楚。注意一下导入时的字符串,上面的例子中使用的是单引号 ' ',和双引号 " " 是不同的。在' '中,文件路径中的分隔符号都是用 \ ,而" "中却反之。)
I have been learning ruby and here are some of my discoveries.
本人学过ruby,最近钻研Ruby后有了些发现,特不揣谫陋,略伸管见。
rmpx uses ruby version 1.8.1, I found out by checking the RUBY_VERSION global constant.
RMXP采用的ruby版本是1.8.1,这个东西便是通过查询RUBY_VERSION的全局常量发现的。-_-0
The ruby 1.8.1 download is worthwhile if you write scripts.
It comes with better documentation, samples, and a code editor that has syntax checking .
倘若你想学写脚本,那么下载一个 ruby 1.8.1 还是很值得的,不一定非得死磨RGSS。
这个版本有了更优良的文件,范例,还附带一个代码编辑器,能够检查语法……
I think it is a good idea to write scripts and save them as a .rb file, and then load them into rmxp like so.
个人感觉把写完的脚本存为一个.rb扩展名的文件,然后再在RMXP中导入这个文件不失为一个写脚本的好方法,如下:
require 'Scripts\Test.rb'
复制代码
search directories for scripts are added like this.
# $: is a global array. Each string specifies a directory to be searched for Ruby scripts.
# $: 是一个全局数组,每一个字符都指定了一个文件夹以供搜索Ruby的脚本。
$: << Dir.getwd
# Dir.getwd Returns the path to the current working directory (where the game.exe and .rxproj are)
(If you want to load scripts used by events you may have to load them in a rmxp script near the top of the list, I dont know, I have not yet worked with events much.Notice the ' ' strings, they are different then the " " strings, single quotes done use all the \ codes.)
(如果你想在事件的脚本中导入,可能需要在脚本编辑器中靠上的地方导入,未经测试,不太清楚。注意一下导入时的字符串,上面的例子中使用的是单引号 ' ',和双引号 " " 是不同的。在' '中,文件路径中的分隔符号都是用 \ ,而" "中却反之。)