Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

ruby /rmxp question

apparently, the script:
include 'file.rb'
just takes a ruby file from the game folder.
/facepalm/ took me too long to figure why i can't load ruby libraries this way.
so if I need to load a library/gem, I need to get its ruby code. but where do I get it?
I have ruby installed in my PC, and when I search .rb files I get no results. is ruby code saved with a different extension? or is it saved on a server, and gems just refer to it? I tried searching the ruby website, but it mainly has docs and small snippets of code. I saw people writing complex scripts, like 3D modes, and keyboard/mouse support, so I assumed it's possible. do people just write everything from scratch?
 
RPG Maker doesn't use Rubygems, so you'll need to find a stand-alone way to achieve whatever it is you're trying to do. This is why netplay was such a pain in the ass to achieve back in the day.

Rubygems is Ruby's method of distributing libraries, which you can install from the repository through command line. As far as I know, you can't use any 'include x' in your code, because RM games use what's in the script editor as the scripts (which are technically all merged into one file). It may be possible to store scripts in a folder beside Audio and Data if you wrote your own 'include' equivalent, but they will not be compressed and packaged so people could open it and edit it whenever they want.

You can find the core scripts at (assuming it's the same layout as 1.9.x, and you're on Windows):
[installdir]/lib/ruby/x.x.x/


You can find installed gems at:
[installdir]/lib/ruby/gems/x.x.x/gems
 
thanks, ZenVirZan. I'll search there.
hopefully I can make this work. cause now that I think of this, I'll have to handle dependencies.
include 'x' works for me, not sure what you mean. I can't remember if I used eval(text), or it was done automatically but I can call methods/classes written in separate .rb file.

Princess Amy,
yeah, I heard about the .so thing.

so.. can I just use DLL files? I've seen people use them in scripts.
 
silver wind":aw2vey4x said:
thanks, ZenVirZan. I'll search there.
hopefully I can make this work. cause now that I think of this, I'll have to handle dependencies.
include 'x' works for me, not sure what you mean. I can't remember if I used eval(text), or it was done automatically but I can call methods/classes written in separate .rb file.

Princess Amy,
yeah, I heard about the .so thing.

so.. can I just use DLL files? I've seen people use them in scripts.
Right, I must have been thinking of something else. You'll need to store it in your own format though if you don't want people tampering with it.

And yeah DLL calls work perfectly fine; the Win32API is available.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top