Externally Calling Require

● ARCHIVED · READ-ONLY
Started by Milena 5 posts View original ↗
  1. I have been reading this article:

    http://ruby.learncodethehardway.org/book/ex51.html

    and I was thinking if what is a way to call the 'require' method that was in Ruby. Also, if I ever create a ruby file externally on the game folder, what can I do to execute those files? For example, a simple ruby file creating text files. Instead of putting the script on RM, I want it to call the rb file instead and execute it. Is it possible?
  2. I don't know for sure, but I think the Ruby interpreter in RGSS is running in what Ruby calls a "sandbox mode."  This is normally used for security reasons --- it makes it harder for malicious code (scripts, whatever) to do harm.  If it is, that mode forbids external "requires" and only allows access to specified API calls.  For example, network calls aren't allowed.

    At least I know when I tried using "requires" to bring in the XML parsing components, which are included in Ruby, they failed.
  3. I see. I was planning to make a simple thing on it, like reading something or just calling a certain function and being interpreted by RGSS, but it seems I am lost how. I recently learned how to create, read and write files in RGSS3, but I can't seem to find a way to make a script in the script editor that would execute the rb file instead :(
  4. RGSSx are variants of Ruby, but they not only added RM-specific functions, they also removed parts of Ruby that were considered not needed.


    I can't tell you what was removed from the interpreter, you have to check the help file and some fansites for that (I know that there is or was a site for RGSS-functions, but I don't have the link to it).