Page 1 of 1

Ruby Game Scripting System

Posted: Fri Dec 29, 2017 7:26 pm
by Illusion11316
Some Know about how to search value on Game based Ruby Game Scripting System ?

Re: [REQ] Ruby Game Scripting System Unsearchable ?

Posted: Fri Dec 29, 2017 9:43 pm
by Slade
A quick google search shows that this is the RPG Maker game scripting language. That usually uses a <value> x 2 + 1 system.

If you have 30 health, multiply it by 2 (==60), then add 1 (==61). Newer versions may be a little different. You can always search for RPG Maker and references to Cheat Engine and see what else you find out.

Re: Ruby Game Scripting System

Posted: Sat Mar 10, 2018 9:06 am
by Husky2490
First time posting.
I've been trying to get at this for a while (about a month). I'm doing this with an RPGMaker XP game, which uses RGSS (v1 omitted). Here's what I've come up with:
  • NOTE: When I say Ruby booleans, I mean what Ruby classifies as true, false, or nil
  • Ruby stores Ruby integers as either a FixedNum or BigNum depending on its size.
  • FixedNums and Ruby booleans are stored in

    Code: Select all

    typedef unsigned long VALUE;
    which is used for many pointers.
  • A FixedNum is a 31 bit integer, the least significant bit (bit 32) is set to 1 in a flag called FIXEDNUM_FLAG

    Code: Select all

    #define FIXNUM_FLAG 0x01
    #define INT2FIX(i) ((VALUE)(((long)(i))<<1 | FIXNUM_FLAG))
  • Ruby booleans are stored as follows:

    Code: Select all

    /* special contants - i.e. non-zero and non-fixnum constants */
    #define Qfalse 0
    #define Qtrue  2
    #define Qnil   4
  • @ denotes instance variables in Ruby
  • @@ denotes class variables in Ruby (not sure if it's relevant)
  • $ denotes global variables in Ruby
  • CAPS_LOCK denotes global constants in Ruby (someone tell me the difference)
  • Ruby uses hash tables with bins that are essentially linked lists of entries for just about everything that has an identifier
  • RGSS was first introduced with RPGMaker XP and used in RPGMaker VX and VX Ace before being retired with the introduction of RPGMaker MV
  • RGSS is just the library, the Ruby scripts are the actual game code
  • From what I can gather, in most cases everything that is not part of the standard game code as shipped with RPGMaker is an event or a RGSS data structure
  • Events are RGSS data structures
  • The Ruby scripts and serialized data files can be extracted and repackaged with a Ruby gem that I found (Some modification required)
  • RPGMaker XP uses Ruby 1.8.1 (the source code for which is only available on mirrors)
  • The Ruby scripts put important Ruby classes in global variables, including those used to store switches (read booleans) and variables (read integers)
  • The particular RGSS Ruby scripts I'm working with store switches and variables in arrays named @data within their respective classes
  • Global variables are stored in a special hash table that has a static pointer located in RGSS103J.dll's memory region :D
  • All variable names in Ruby are symbols
  • Symbols are stored as IDs
  • IDs are assigned almost incrementally:

    Code: Select all

    /* id is set to a constant based on what it is (global, constant, etc.)
       last_id starts at 359 and ID_SCOPE_SHIFT is 3 */
    id |= ++last_id << ID_SCOPE_SHIFT;
  • IDs are not hashed when used as keys in a hash table
  • There is a hash table that stores the names of ALL symbols and used the associated ID as a key (jackpot!)
  • It is said that the hashing function Ruby uses is seeded randomly :x [citation needed]
Right now I'm writing a lua script that takes these two hash tables, turns them into a single lua table, and spits out the addresses where the arrays begin. I just finished just enough of the pseudo-classes (lua doesn't have classes, according to the lua tutorial I'm using, which I borrowed the class creation method from) standing in for structures to extract the symbol table. I'm not proud of it and it looks ugly, especially where I used 0/0 as a replacement for nil since I was checking for whether a variable had been assigned and nil was a valid value for that variable.

Info on RGSS can be found here: ... index.html (replace 'xp' with the RPGMaker version you're working with)
A guide to the source code for Ruby 1.8 can be found here (when the server isn't down):