Author Topic: [RESOLVED] (massive knowledge included) Extracting data from an .rxdata...  (Read 13850 times)

Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #20 on: April 07, 2008, 01:30:00 AM »
Thanks, Zeriab! That helped out with the scripts. And now I know that RMXP REALLY compresses those scripts.

As an illustration of how insane the file size differences were:

.rxdata.txt
2,842KB14,205KB

So, yea. Thanks again. Now all I need is that subclass information and I will rule the world!

Ah, who am I kidding? I will rule my 24x24 bedroom!
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Extracting data from an .rxdata...
« Reply #21 on: April 07, 2008, 02:21:07 AM »
lol! So can someone point me to more references on Zlib stuff?
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #22 on: April 07, 2008, 03:29:45 AM »
@Fantasist:
http://www.zlib.net is their homepage. I don't think that'd be a good resource. ;D

@Zeriab: Just out of curiosity, how would I add in a new line after every script, so that the file is easier to read?
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Extracting data from an .rxdata...
« Reply #23 on: April 07, 2008, 10:18:45 AM »
Add a new line while printing out?
I'll tell you something. In his code, replace

Code: [Select]
p script
with this:

Code: [Select]
  file = File.open("Script Slots/#{i+1}. #{script_data[i][1]}.txt", 'w') rescue File.open("Script Slots/#{i+1}. Invalid characters in filename.txt", 'w')
  file.write(scripts[i])

Now make a new folder named 'Script Slots' in your game folder and try running the game for interesting results.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20015
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Extracting data from an .rxdata...
« Reply #24 on: April 07, 2008, 01:50:50 PM »
5) :P



Here's the help file BTW. I also has a beginner tute about scripting by an unknown author included.

http://www.sendspace.com/file/tgb7sg

Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #25 on: April 08, 2008, 01:12:41 AM »
@Blizzard: The unknown author is the person who wrote the japanese help file. For some reason, they removed that very useful section for the English release. And they did it again for VX! Sheesh...

@Fantasist: Thanks! That worked really well! I had something that did something like that, but it kept giving me an error message. I never realized that it was just a rescue thing. Also, why does it never get the first script?

So, i'm apparently almost out of questions about this thing, and most of them are fairly easy:

1) How do you get a table to display? (it's not .inspect, I tried that)
2) I'm still not very clear on how to get the maps out correctly.
and lastly, so ghastly:
3) Is it possible to get the save data out (Like saved games) in a similar method?
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20015
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Extracting data from an .rxdata...
« Reply #26 on: April 08, 2008, 08:17:40 AM »
1) I guess you'll have to do it manually, iterate through each dimension, etc. and write out the data.

2) Maps are loaded as I have shown you before. You can get an array of existing map IDs by loading MapInfos.rxdata and using the .keys method on the loaded data. Then iterate through the array and use the "load_data(sprintf(...))" command to load each map.

3) Sure, but that's done easier, you can simply use the same way the Scene_Load does it.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #27 on: April 08, 2008, 02:29:09 PM »
1) And how exactly would I go about this... iteration of dimensions (I think I just found a new game title: Reiteration of Dimensions! OK, maybe not, but I should at least get a patent for it)? I just tried using table.self
  • , but that gets me an error message. And believe me, I've gotten my fair share of error messages this week.


2) I wasn't sure on how exactly to do the second part of that.

3) OK... done! I got a save file! And it looks like... well... this is a pretty small portion of the file (which makes this very scary. This is a save file in text:

(click to show/hide)

I didn't think that everything was saved! I mean, the map data is still there, even! Come ON! This is ridiculous! The save went from 48 to 188 KB.

(Can you tell I'm excited?)
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20015
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Extracting data from an .rxdata...
« Reply #28 on: April 08, 2008, 03:10:51 PM »
1)

Code: [Select]
(0...table.xsize).each {|x|
  (0...table.ysize).each {|y|
    (0...table.zsize).each {|z|
      p table[x, y, z] # this would print out the element at x, y, z
    }
  }
}

or

Code: [Select]
for x in 0...table.xsize
  for y in 0...table.ysize
    for z in 0...table.zsize
      p table[x, y, z] # this would print out the element at x, y, z
    end
  end
end

Keep in mind that some tables have only 1 or 2 dimensions, it doesn't have to be 3, but this piece of code is universal as .ysize and .zsize will simply return 1 if the array doesn't have yet another dimension.

And error messages are good. At least they tell you wtf is wrong while logical errors need to be tracked thorough the code. #_#

2)
3)

Code: [Select]
map_data = load_data('MapInfos.rxdata')
maps = []
for id in map_data.keys
  maps.push(load_data(sprintf("Data/Map%03d.rxdata", id)))
end

or

Code: [Select]
map_data = load_data('MapInfos.rxdata')
maps = []
map_data.each_key {|id|
    maps.push(load_data(sprintf("Data/Map%03d.rxdata", id)))
}

"maps" will contain an array of all maps then.

3) Yeah, I can. :) It's not really ridiculious if you take into account that a kind of "dictionary compression" was applied to the Marshal format files. :P
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #29 on: April 08, 2008, 03:33:35 PM »
1) I replace "table" with "actor.parameters", correct? Because if so, then it gives me an error on the first } or end in the code you gave me.

2) By second part, I meant getting the text file(s) open and printing the data. Oh, well. I got that done! ;D

3) Good point. I guess it was just the fact that the other files were all nice and ordered and had a lot of next lines, and this thing is this:

Code: [Select]
"#{$game_system.inspect}\n" +
"#{$game_switches.inspect}\n" +
"#{$game_variables.inspect}\n" +
"#{$game_self_switches.inspect}\n" +
"#{$game_screen.inspect}\n" +
"#{$game_actors.inspect}\n" +
"#{$game_party.inspect}\n" +
"#{$game_troop.inspect}\n" +
"#{$game_map.inspect}\n" +
"#{$game_player.inspect}\n"

so I don't have a lot of control over it.

4) So, is it possible to get this back in as a save file?
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20015
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Extracting data from an .rxdata...
« Reply #30 on: April 08, 2008, 03:37:59 PM »
1) If it is a Data_Actor instance, then yes. What is the error message anyway?

4) Yes, but this would be quite a nasty job. Do you know what an FSM is? Well, you need to use an FSM to parse the text from the file, create new instances and set their variables. Of course you can't set most variables from the outside, so you have to do it from within the class. -_-
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #31 on: April 08, 2008, 03:50:47 PM »
1) Script '.rxdata to .txt' line 108: SyntaxError Occurred.

Line 108:
Code: [Select]
                       }
4) Never heard of a FSM.
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20015
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Extracting data from an .rxdata...
« Reply #32 on: April 08, 2008, 04:42:20 PM »
1) What the...?! O_O It works fine with me. Try this:
Code: [Select]
table = Table.new(2, 2, 2)
(0...table.xsize).each {|x|
    (0...table.ysize).each {|y|
        (0...table.zsize).each {|z|
            p table[x, y, z]}}}
it's basically the same, but RMXP might being a bitch.

4) Finite States Machine. Nevermind then, in any case you need a reader that reads classes and stuff. Your main problem is of course that you need to add characters and stuff that say "the next string is a class name and it is X bytes long" like "s7". Of course 7 is binary, not the actual character 7 (which would be 55 as numeric). In other words, you need to create an alternative format next to Marshal. I don't suggest that you do that. Why are you not just using Marshal format anyways?
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Extracting data from an .rxdata...
« Reply #33 on: April 09, 2008, 02:42:48 AM »
Quote
Also, why does it never get the first script?
:???: It doesn't? It should, it worked fine for me. You didn't change any "i"s ti "i+1", did you?

Quote
I got a save file! And it looks like... well... this is a pretty small portion of the file (which makes this very scary. This is a save file in text: (somescarylookingcode)

There's one property for the Object class called 'instance_variables'. Instead of doing what you did to display that instance of Game_System, you can do this:

Let's say $game_system is an instance of gGame_System you extracted from the savefile.

file = File.open('Savefile Inspect.txt', 'w')
for var in $game_system.instance_variables
   file.write(var)
   file.write("\n")
end

So, since you have many other objects (like Game_Player, etc) in the savefile, you can load all the data with Marshal.load into an array, then iterate through that array to write the data to a file, with nice formatting. Let's say save_data is that array.

Code: [Select]
file = File.open('Savefile Inspect.txt', 'w')
for object in save_data
   file.write("---::#{object.class}::---\n")
   for var in object.instance_variables
      file.write(var)
      file.write("\n")
   end
end

You'll get a text file with everything listed down neatly. I've learnt about instance_variables from Blzzard's CP Debugger script. That's how it lets you read Game_System without making every variable an attr_accessor.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #34 on: April 09, 2008, 03:02:20 PM »
@Blizzard:
1) It still is. It's probably something really stupid I did earlier, or that I didn't know about some ****ed up rule. Here's the relevant section of coding:

(click to show/hide)

The error message has (slightly) changed, though! It now says: Line 105 ("(0...table.xsize).each {|x|"): SyntaxError occurred. And a strange thing is that I don't think it's caused by a problem I made earlier, because it doesn't give me any errors at all when I comment those lines out.

4) OK, here's the main reason I've been trying to make this script: Our school's computers are, to put it as bluntly as possible, crap. Actually, they are a lot worse, it's just that I'm a bit glad we have computers to begin with. Everything the computer does not recognize doesn't run. And a lot of things the computer does recognize won't run either. You can't get into the C:\ drive normally. Luckily, Notepad ++ (which is my... just about everything editor) let me sneak into the C:\ drive. That's the only reason I got a help file open. I had to do some renaming to get it to open (as long as Game Maker was doing it, because the computer trusts an application that has crashed at least three computers, but not the guy who double clicked on the icon).

On top of this overbearing limitation, the computers are about as slow as moving glaciers. Like in Game Maker (that's the program we're using in our Intro to Programming (we hit scripting for about three days and the teacher just dropped it. This is programming?) class. Probably because it's only 15 bucks), it takes the better part of a minute to open an Object Properties thing. Every computer I have tried it on can do that in well under a second. So, not only would I be unable to open RPG Maker XP over there, but if I could, it'd take the better part of the class (90 minutes) to get anything done. Also, I don't have an English to Marshal dictionary. (If you've seen one, do let me know. :D)

So, this leaves me with .txt files and jumbled up .rxdata files that I can't read because I can't get the reader on. Oh, and while we're at it: The version of Notepad++ the schools are using is almost a full version off (theirs are on 3.7-ish and the newest one is 4.8), so it doesn't really recognize Ruby code when it sees it.

Also, returning to the point ::), couldn't you just get Marshal to rencrypt the file in a way similar to how it decrypted them?

@Fantasist: It doesn't get the first script. This looks right, yes?

(click to show/hide)

And thanks for the instance_variables thing. The problem is, it looks like this:

(click to show/hide)

It's missing what the variable is equal to.

PS. Blizzard, just as a heads up, I didn't really hack the .dll file for dream, I just looked at the .rb and then altered the piece of code that we were supposed to put in the scripts, so technically does that mean that the license redefinition doesn't apply? ::)

PPS. The license redef was pretty funny.
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20015
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: Extracting data from an .rxdata...
« Reply #35 on: April 09, 2008, 04:16:48 PM »
Lol, you have some really funny syntax errors there.

Code: [Select]
         "      @parameters = '#{Actor[i].parameters}'\n" +
                   table = Actor[i].parameters#.new(2, 2, 2)

This here will work:

Code: [Select]
  Actor = load_data('Data/Actors.rxdata')
  (1...Actor.size).each {|i|
      unless Actor[i] == nil
        file.write("    when #{i}\n" +
                   "      @id = '#{Actor[i].id}'\n" +
                   "      @name = '#{Actor[i].name}'\n" +
                   "      @class_id = '#{Actor[i].class_id}'\n" +
                   "      @initial_level = '#{Actor[i].initial_level}'\n" +
                   "      @final_level = '#{Actor[i].final_level}'\n" +
                   "      @exp_basis = '#{Actor[i].exp_basis}'\n" +
                   "      @exp_inflation = '#{Actor[i].exp_inflation}'\n" +
                   "      @character_name = '#{Actor[i].character_name}'\n" +
                   "      @character_hue = '#{Actor[i].character_hue}'\n" +
                   "      @battler_name = '#{Actor[i].battler_name}'\n" +
                   "      @battler_hue = '#{Actor[i].battler_hue}'\n" +
                   "      @parameters = '#{Actor[i].parameters}'\n")
        table = Actor[i].parameters#.new(2, 2, 2)
        (0...table.xsize).each {|x|
          (0...table.ysize).each {|y|
            (0...table.zsize).each {|z|
              file.write("      @parameters = '#{table[x, y, z]}'\n")
        }}}
        file.write("      @weapon_id = '#{Actor[i].weapon_id}'\n" +
                   "      @armor1_id = '#{Actor[i].armor1_id}'\n" +
                   "      @armor2_id = '#{Actor[i].armor2_id}'\n" +
                   "      @armor3_id = '#{Actor[i].armor3_id}'\n" +
                   "      @armor4_id = '#{Actor[i].armor4_id}'\n" +
                   "      @weapon_fix = '#{Actor[i].weapon_fix}'\n" +
                   "      @armor1_fix = '#{Actor[i].armor1_fix}'\n" +
                   "      @armor2_fix = '#{Actor[i].armor2_fix}'\n" +
                   "      @armor3_fix = '#{Actor[i].armor3_fix}'\n" +
                   "      @armor4_fix = '#{Actor[i].armor4_fix}'\n")
      end}
  file.close
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline Sase

  • Transcended Spirit
  • ***
  • Posts: 174
  • LV: 5
  • Gender: Male
    • View Profile
Re: Extracting data from an .rxdata...
« Reply #36 on: April 09, 2008, 05:17:37 PM »
Well it's nice reading this stuff. It makes me feel myself stupid :(

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Extracting data from an .rxdata...
« Reply #37 on: April 09, 2008, 09:53:59 PM »
Code: [Select]
(1...scripts.size).each {|i|
It's
Code: [Select]
0...scripts.size. And you can use array.each_index to iterate through the array completely.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline shdwlink1993

  • Ethereal Devastator
  • ****
  • Posts: 435
  • LV: 63
  • Gender: Male
    • View Profile
    • YouTube Profile
Re: Extracting data from an .rxdata...
« Reply #38 on: April 10, 2008, 12:50:08 AM »
And this one isn't nearly as long :D!

@Blizzard: OK, it's official. I am a certified nimrod.

The problem? Actor.parameters's table has two dimensions. TWO! And I never thought that the 'z' thing might be the problem. You know, over the last half month, I have realized two things:

1) I'm getting a bit better at this whole scripting thing.
2) This forum needs a slap face (or duh) emote.

Oh, yea. I left a note for you at the bottom of the last post, Blizz. I don't think you saw it, though.

@Fantasist: I can't find exactly where array.each_index goes in the code. I've tried in a few places to no avail.
Stuff I've made:

(click to show/hide)

"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2223
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: Extracting data from an .rxdata...
« Reply #39 on: April 10, 2008, 11:02:21 AM »
Use
Code: [Select]
scripts.each_index {|i|
   code
}

instead of
Code: [Select]
(1...scripts.size).each {|i|
   code
}

That's it :)

Hey, you either didn't read Blizzy's Scripting Tute, or you've forgotten some points. It'll really helpful, believe me :)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews