[RESOLVED] (massive knowledge included) Extracting data from an .rxdata...

Started by shdwlink1993, March 30, 2008, 02:16:12 pm

Previous topic - Next topic

shdwlink1993

Hey. I've been working on this script that takes the information from a .rxdata file, copys it, and decompresses it in another folder as a .txt file.

So, i've been having a few problems with it:

1) First up, is there any way to get an array to come out correctly, so instead of this: 123456791015, it looks like this: [1, 2, 3, 4, 5, 6, 7, 9, 10, 15] or something that people would read easier.

2) I've been getting the information as to what to extract from the Help File (which I don't think was really made for people who are starting out with the program), and I can get Animation, but I can't figure out how to get Animation::Frame. Also, where are the odd things like Weather?

3) How the crud do you get the scripts out?

4) Is there a way to reverse the process, and import the information from a text file?

Thanks to anyone who can answer any of my questions.
Stuff I've made:




"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."

Blizzard

March 30, 2008, 03:07:37 pm #1 Last Edit: March 30, 2008, 03:08:58 pm by Blizzard
1) ARRAY.inspect, the inspect method will write it out exactly like that.

2) Find RPG::Weather for the built-in weather script. If I'm not wrong, an animation has the array "frames" (animation.frames) which is an array of Animation::Frame instances.

3) They are compressed with a compression method, most probably zip. It's a nasty job to decode that, but it can be done. If I'm not wrong, the basic is an array of compressed strings, then you'd have to decompress the strings afterwards.

4) You just need a correct reader of the text file so you can import the text file data into RMXP. Actually, that's what the rxdata format is for: to compress the data into a special format, then the files get smaller. You can use Marshal.dump(FILE, ARRAY) (or was it Marshal.dump(ARRAY, FILE)...?) for the dumping into rxdata format.

I hope this was helpful. :)
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

1) OK, slight problem: I don't know where in this line of code that would go:
file.write("    when #{i}\n"
             {...}
"  @element_set = '#{item[i].element_set}'\n

Specifically, the last line.

2) I've been trying to figure out how to get that animation.frames thing out of animation. Probably the same as #1, right?

3) Doesn't Zlib::Inflate have something do to with that?

4) Ah. Marshal.dump. OK.

5) (Because I forgot to mention it in the first post) All of the maps (mapxyz.rxdata) have different file names. Is there any way to get it to automatically run through (000, 001, 002, 003, etc.) and if the file exists, make a new text file for each one with the information inside it? As opposed to copy and pasting the exact same phrase and changing two numbers a lot of times.
Stuff I've made:




"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."

Blizzard

March 31, 2008, 05:49:36 am #3 Last Edit: March 31, 2008, 05:52:57 am by Blizzard
1)
file.write("    when #{i}\n"
             {...}
"  @element_set = '#{item[i].element_set.inspect}'\n"


2) Yeah, but Animation::Frame instances won't work directly. You'll have to copy the attributes (variables and stuff). Here an example of that. I had to iterate through the frames to resize the animations for Bizz-ABS.

  def self.animations_size_down
    # iterate through all animations
    $data_animations[1, $data_animations.size-1].each {|animation|
        # iterate through all frames and all cells
        animation.frames.each {|frame| (0...frame.cell_data.xsize).each {|i|
            # if cell contains image
            if frame.cell_data[i, 0] != nil && frame.cell_data[i, 0] != -1
              # size down x position, y position and zoom by half
              (1..3).each {|j| frame.cell_data[i, j] /= 2}
            end}}}
  end


or more readable:

  def self.animations_size_down
    # iterate through all animations
    for animation in $data_animations[1, $data_animations.size-1]
      # iterate through all frames
      for frame in animation.frames
        # iterate through all cells
        for i in 0...frame.cell_data.xsize
          # if cell contains image
          if frame.cell_data[i, 0] != nil && frame.cell_data[i, 0] != -1
            # size down x position, y position and zoom by half
            for j in 1..3
              frame.cell_data[i, j] /= 2
            end
          end
        end
      end
    end
  end


3) I think yes, I haven't tried that, though.

5) MapInfos.rxdata is a dumped hash. Simply load the file and use .keys method on the loaded data and you will have an array of all existing map IDs.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

Blizzard

A couple of posts were lost...

Quote from: shdwlink1993 on March 31, 2008, 10:43:18 am
1) Works perfectly, thanks!

2) I'm still not sure how to get that into a text document. But then again, maybe trying to get an animation file into a text file may be a bad idea... Like, how would I get the enemy actions into the file. I'm pretty sure that's in the same file as the enemies, but I can't get it out.

3) Nevermind. I got something together.

5) So i'd use keys on it to get the array, and then... use the array as the file names?

6) (These things don't stop, do they?) The way I got the scripts out is rather... annoying. Lemme show you:

s1 = load_data('Data\Scripts.rxdata')
a = s1[1]
b = s1[2]
...(etc)
file = File.open('Extract/Script1.txt', 'w')
  file.write("#{a}\n")
file.close
file = File.open(Extract/Script2.txt', 'w')
  file.write("#{b}\n")
file.close
...(etc)

Is there any way to do this without using half a ton of code and forcing people to comment out the stuff they don't need? I do know there is a limit to the number of scripts you can have (remember the bunch of scripts I had in the same project a while back?), but I don't think that someone using it really wants to comment every line they aren't using.


2) I agree, better you just move it into the other file.

5) The array contains map IDs, just use the same call for each ID like in Game_Map#setup (the line with load_data and sprintf).

6) You can try if false/if true branches instead.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

Oh, thanks for getting that post back! I was worried when almost five minutes after it gave me the maintenance mode thing.

2) "move it into the other file"? What other file did I mention?

3) Nevernevermind, it works on about two scripts and then it gives me garbled stuff, like poor Window_InputNumber over here:

Spoiler: ShowHide
78627028Window_InputNumberxœ½WmoÓ0þŽÄ8µLJÛ4´!V˜o• âÃ,,"7qZ£Ä	¶£nüzÎ/i"¶,,šEíßù|oÏÝyýð¨Ïý{}áãI±Žæ¼¬Ô‡*_PŒñQ­	¾¬˜,,µQø-˜Ö©_7Š¥,,'š[IšàfµbÔŠšr*%YRwF€´cÇãþ½8#R	<«‰/‰Ds Ž"sáã⠍Ì9SŒdìQ¬à-©Ÿ,,-™'QN®afWX"Ð"ãÌ ÞVó@sζ,,
Ã×f9KèÃÉâ*#ŠB\ ‰©_³D­ Eîrï(Þd|ôgE2GЀ(
©Œ´SŸTy~-˜ÊI‰Z^š--€Óµ÷èÔ‡G§µ•VWd
[b¢×*'Ú»Þ¤7ìž<Ý×$L¢ÔrdURáM|ÀO[Á°-h[ž<v¶Hš¥A\pE¹'m›­ôØì_Q¶\)³h
þ,Qgø4hEIb¦n¶Q>G€ÒëíZÐTP¹²‹ªL0~'3X Î4ò¤#,¿¥
ênÒ <ùæpí©ª¯q×­cŸÛŽ™Êtž¦³aXg^‡žýìÖÛÕ•}Et~...>L'ºÇ79†)òßIw1»°5‰¨#|™QøjÐØQŒC½.Á-5Ty®h†íZÞ¯îM[é.JoÉï$4FV÷ç¹ææGdž®ãƒÃ »ð'tÁaM$"ˆœËV†¥`æc hI‰zá™ÕlöõÓ@Ÿs÷êã·³ -èn$o¤¢9¦"*3rã=@ûHMtñ--t#Ó7}éÛ( DLëâÓs"^!¼(à`TEÝÁm
])x;µ€_‹Ž{ë'zè¤OPºæ×¼qˆ[‡vÃÖ@I'$0õuL@eµJîÓ¦ã˜˜Ìé·tOæì/2­@÷±ðä¶ëÓè€O­9âàofº­j¡'Ö호œ¿}÷ecîjæày§5ëÿPÑ}u=»°žï^Mì{'Ñô/Ž¼ýæ®ý؁ë?{u×ÿr‹'W
ƒ­»Tg"ˆCŒ_p•z2òBä$‹ÌÒmFª,ã*õz'"aÒó›'õëšpé1ÿ¯à¥&AÈ@[w"È:ÒWLíÎÌéc3_ì]Õ yÅüé÷A+æÇüù
뉙


No clue why that happened. It got the first two right OK.

5) Since i'm still a newb at this sort of thing, I'm not sure how exactly to do that.

6) By annoying, I primarily meant that I have to have 1000 different files maximum. You saw how I was doing that.

a = s1[1]
b = s1[2]


1000 scripts... and most of them won't even display correctly for reasons unknown. That was what I meant by annoying.

And yes, i'll need to use if false/true branches. Thanks.

Sorry if this is getting annoying. The rate this is going, you'd deserve as much credit for it as me.
Stuff I've made:




"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."

Blizzard

April 01, 2008, 02:34:03 am #6 Last Edit: April 01, 2008, 02:39:31 am by Blizzard
2) Nvm, I misread your post. Enemies have an array called "actions" with instances of RPG::Enemy::Action (I think). Just iterate through it.

3)

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

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.

6) This is a little bit complicated if you don't know Ruby's Marshal format. I was able to figure the format out recently, I could post a topic explaining it.

The thing is that the first byte, if it's less than 128, can be taken as direct value as well as 0, except for 1, 2, 3 and 4. If it's 1, 2, 3 or 4, it shows how many of the folllowing bytes are part of the number. Before an integer, there is an 'i' in the file. The byte order is "little endian". Before an array there is a [ in the file followed by an integer with the number of elements in the array. The file always starts with the version of the format in two numbers (4 and 8 in RMXP) This is all still fairly simple until it comes to the method of compression (strings are marked with s, then comes the length, the comes the string). I think I should really post a topic about that...

7) As I said, I figured out the format when I was working on the configuration application for Blizz-ABS so I could display game data in an external application. When I post the topic, I might even post the C# code pieces of my partial decoder (I didn't need a full decoder, so I made a partial decoder only).
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

April 01, 2008, 08:43:21 am #7 Last Edit: April 01, 2008, 08:46:08 am by shdwlink1993
2) The RPG::Enemy::Action thing was what I meant. I just didn't get what you meant by other file.

5) I can get that working, but I'm not sure how to get this written into a bunch of .txt files. My attempt at that was shot down by flaming legions of error messages

6) Interesting... You probably should post about that. A lot of it goes over my head :'(, but theres some people who could use that.
Stuff I've made:




"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."

Blizzard

2) You are trying to export the stuff from the files, right? I meant the output file. Nvm if I got you wrong earlier.

5) Just open a file in writing mode and use .write on the instance. This writes a string argument into the file.

6) It's not really complicated if you have it all there. Even figuring out the format isn't that complicated, it took me less than a day to figure out the format and make a partial reader.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

April 02, 2008, 04:26:10 am #9 Last Edit: April 02, 2008, 05:18:53 am by shdwlink1993
2) Oh. I should have realized that. >.< In that case, I was meaning that I don't know what syntax to get it out of there. I know that it's RPG::Enemy::Actions, and I'm fairly certain it's in enemies.rxdata, but I don't know exactly what to tell it to get that I need that.

5) OK. I've been trying that, but I'm not sure exactly how to write that in. At all.

6) And you're using that for your game, chances are, right? See? You're really smart with this kind of stuff. I'm horrible, but I'm trying ::).

7) (Don't worry, this is a lot easier.) On the title screen, I have it write something on the screen (version). How do I get it to go away after the title screen? It stays there while I'm playing the game, and it's fairly annoying.
Stuff I've made:




"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."

Blizzard

2) Well, if you put it into a text file, you will need to parse the file to get the data out again. I suggest using a text file only if you want to print out data, it's not really suited for data storage. You'd have to create a new format if you want to save the stuff and load it again. But creating one isn't as easy, especially if you work from scratch, so I suggest you keep using the Marshal format, you don't have to use .rxdata as extension, though.

5)
file = File.open('NAME', 'w')
file.write('Hello file!')
file.close

The stuff will be written into the file AFTER you use .close.

6) Actually for the configuration application for Blizz-ABS. :D You're not horrible, you're still learning. I couldn't figure out that format earlier either, because I had no idea where to start from. When you have more experience (points, LOL), you will figure out half of it by just looking at some saved data in a hex editor.

7) Are you using a separate sprite or window? You need to call the .dispose methods for such, so they get removed from memory. Don't use a global variable for that (variable with $ before the name), but use an instance variable (with a leading @ instead) in Scene_Title#main. Create the sprite/window and draw the version before the "Graphics.transition" and "loop do" and after the "Graphics.freeze" dispose it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

2) OK. The entire point of the script is just to see how it does stuff. That's it.

5) I meant that I don't know how to specifically write in that string you meant. I can get something like 'Hello file' in easy. I mean the string you mentioned.

6) That's part of the problem: I don't earn Experience Points in games, usually I try and makethe game give me the points (read: usually I hack the crap out of it)

7) Worked perfectly. Thanks.
Stuff I've made:




"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."

Blizzard

5) Oh, you mean how to put the string together? Well, you can do something like
...
for animation in $data_animations
  if animation != nil
    str = animation.id.to_s + ' - '
    str += animation.name + '; '
    str += 'Frames: ' + animation.frames.size.to_s
    ...
  else
    str = 'NIL'
  end
  file.write(str)
end
file.close


Just put in there the information you need. Don't forget to use .to_s for non-string values or you'll get an error.

6) Just lol!
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

Sally

are you doing this to let us be able to cheat in our games?

shdwlink1993

@Susys: I'm not sure how you'd be able to do it. Ideally, the goal is that if you are going on an extended vacation or something like that and you will have a computer but not RPG Maker XP (like when I go to school. Those computers are darn near under lock and key), you can change text files and have RPG Maker XP reincrypt them into marshall format so you can edit them.

@Blizzard:
5) OK. Slight thing: that's not the string i'm looking for.

I'm looking for something that would get animation.frames.cell_max or enemy.action.basic. Things like that. And how exactly to get the maps thing working properly. Then that might be applicable to the scripts thing, since it's kinda similar yea, right....

6) I also think that posting about that Marshall format would be helpful to a lot of people here.
Stuff I've made:




"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."

Fantasist

QuoteI also think that posting about that Marshall format would be helpful to a lot of people here.

Seconded. I've learnt some things from this topic, thanks guys *powers up Bliz and shdwlink*
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




Blizzard

5) Do you have the english help file? You have the complete structure in there. I can upload the file if you don't.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

5) The only reason I know all this stuff is because I had the English help file. I also have the Japanese help file and the translated help file (that for some reason isn't finished). Screw it, i've even got the VX English and Japanese help files! It's just that none of them say how to get the information from a "subsubclass" of RPG. Actually, they don't say anything about getting info. I've just been getting lucky guesses because most of the info is named after a file. I just don't know how to get info out of something that
a) does not have a file.rxdata named after it, like weather, or
b) is a "subclass", like how I can get to Class, but not Class::Learning.
Stuff I've made:




"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."

Zeriab

For the Scripts.rxdata :3
script_data = load_data("Data/Scripts.rxdata")
scripts = []
for raw_script in script_data
scripts << Zlib::Inflate.inflate(raw_script[2])
end
for script in scripts
  p script
end


I am sure you can figure out the rest ^^

Fantasist

Wow, a little change to that code and I got very interesting results =D
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




shdwlink1993

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:




"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."

Fantasist

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




shdwlink1993

@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:




"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."

Fantasist

Add a new line while printing out?
I'll tell you something. In his code, replace

p script


with this:


  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




Blizzard

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 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

@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:




"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."

Blizzard

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 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

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:

    Spoiler: ShowHide
    #<Game_System:0x440d5a0 @analyzed=[], @FURY_STATUS=true, @EQUIPMENT_REQUIREMENT=false, @teleport_permit=true, @face_graphic_justification=2, @show_pause=true, @message_frame=0, @CHARGE_SKILL=false, @UNIQUE_SKILL_COMMANDS=true, @system_words=["Gold", "HP", "SP", "Strength", "Dexterity", "Agility", "Intelligence", "Attack Power", "Phys Defense", "Mag Defense", "Weapon", "Shield", "Helmet", "Armor", "Accessory", "Fight", "Skill", "Defend", "Item", "Equip"], @load_count=0, @ums_mode=0, @FACESETS=false, @map_interpreter=#<Interpreter:0x440d1b0 @button_input_variable_id=0, @list=nil, @main=true, @parameters=["$scene = Scene_SavePoint.new"], @move_route_waiting=false, @depth=0, @map_id=9, @branch={}, @message_waiting=false, @index=2, @loop_count=3, @child_interpreter=nil, @event_id=12, @wait_count=0>, @minimap_h=160, @DOOM_STATUS=true, @known=[], @choice_position=3, @map_name_id=9, @BETTER_TILEMAP_UPDATE=true, @animation_pause=80, @fontname="Arial", @MINIMAP=true, @window_height=128, @FACESETS_DSS=false, @DEMI_SKILL=false, @escaping_exp_cost_max=8, @name_window=true, @save_disabled=false, @cam=0, @FPS_MODULATOR=true, @SHADED_TEXT=false, @back_opacity=160, @INVINCIBLE_STATUS=true, @ITEM_REQUIREMENT=false, @face_graphic_position=1, @minimap_visible=false, @ENERGY_SKILL=false, @sound_effect="", @save_count=1, @skip_mode=1, @CATERPILLAR=true, @HEAL_AT_LVLUP=false, @message_event=-1, @minimap_a=160, @ABSORB_HP_SP=false, @name_timer=0, @CENTER_BATTLER=true, @face_frame_width=100, @window_width=480, @STATUS_ICONS=false, @fontsize=24, @ZOMBIE_STATUS=true, @order_only=false, @ENEMY_STATUS=false, @font="", @menu_disabled=false, @REVENGE_SKILL=false, @HUD=false, @chaos_party=[], @window_image=nil, @SPEED_MODULATOR=true, @shadowed_text=false, @minimap_x=0, @SP_COST_MOD=true, @HP_SP_CRUSH=false, @magic_number=76156056, @slave_windows={}, @version_id=0, @name="", @ddns_off=false, @HPSPPLUS=false, @text_skip=true, @ARROW_OVER_PLAYER=true, @train_actor=-1, @battle_interpreter=#<Interpreter:0x440be48 @button_input_variable_id=0, @main=false, @move_route_waiting=false, @depth=0, @map_id=0, @branch={}, @message_waiting=false, @child_interpreter=nil, @event_id=0, @wait_count=0>, @DEATH_ROULETTE=false, @escaping_gold_cost_min=0, @resting_face="", @BARS=false, @battle_order_only=false, @REGEN_STATUS=true, @SKILL_SEPARATION=false, @window_justification=1, @ANIBATTLERS_NON_ACTION_BS=false, @opacity=255, @encounter_disabled=false, @DESTRUCTOR_SKILL=false, @index=0, @encounter_count=0, @font_color=nil, @used_codes=["\\v", "\\n", "\\c", "\\g", "\\skip", "\\m", "\\height", "\\width", "\\jr", "\\jc", "\\jl", "\\face", "\\fl", "\\fr", "\\b", "\\i", "\\s", "\\e", "\\t1", "\\t2", "\\th", "\\nm", "\\font", "\\p", "\\w", "\\ws", "\\oa", "\\oi", "\\os", "\\ow", "\\tl", "\\tr", "\\tc", "\\ignr", "\\shk", "\\slv", "\\ind", "\\inc"], @DEATH_TOLL=false, @enemy_defeated=0, @TREMBLE=false, @FROZEN=true, @window_mode=0, @shadow_color=(0.000000, 0.000000, 0.000000, 100.000000), @minimap_y=0, @show_clock=true, @release="Alpha Testing", @indy_windows={}, @TARGET_EM_ALL=true, @write_speed=2, @ANIMATED_BATTLE_BACKGROUND=false, @bar_style=0, @BLUE_MAGIC_SKILL=false, @escaping_gold_cost_max=20, @comic_enabled=false, @bgm_volume=100, @timer=0, @LOCATION_NAMES=true, @resting_animation_pause=80, @MULTI_HIT=false, @AUTO_REVIVE=true, @DEATH_IMAGE=false, @face_graphic="", @analyze_mode=0, @teleport_dest=[], @message_position=2, @tileset_settings={}, @text_justification=2, @SP_DAMAGE_SKILL=false, @actor_defeated=0, @WINDOW_BATTLERESULT=false, @shortcuts={}, @ANIMATION_STACK=true, @shake=0, @minimap_w=160, @choice_justification=0, @BLUE_MAGIC_STATUS=false, @beasts=[], @animated_faces=false, @QUICK_PASSABILITY_TEST=true, @bar_opacity=255, @MAP_AS_BATTLEBACK=false, @text_mode=0, @timer_working=false, @comic_style=0, @escaping_exp_cost_min=0, @EMP_SKILL=false, @sfx_volume=100, @BLACKFADE=false, @windowskin="", @version=0.001>
    #<Game_Switches:0x4409460 @data=[nil, true]>
    #<Game_Variables:0x44093d0 @data=[nil, 1, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 21, nil, nil, nil, nil, nil, nil, nil, nil, 0]>
    #<Game_SelfSwitches:0x4409340 @data={}>
    #<Game_Screen:0x44092b0 @flash_color=(0.000000, 0.000000, 0.000000, 0.000000), @shake_power=0, @weather_duration=0, @weather_type=0, @tremble_power=0, @shake_direction=1, @tone_duration=0, @weather_max_target=0.0, @tremble=0, @shake_duration=0, @tone_target=(0.000000, 0.000000, 0.000000, 0.000000), @weather_type_target=0, @pictures=[nil, #<Game_Picture:0x4409028 @opacity=255.0, @angle=0, @name="", @target_y=0.0, @zoom_x=100.0, @y=0.0, @target_opacity=255.0, @tone_duration=0, @target_x=0.0, @origin=0, @x=0.0, @target_zoom_y=100.0, @tone_target=(0.000000, 0.000000, 0.000000, 0.000000), @duration=0, @number=1, @blend_type=1, @rotate_speed=0, @target_zoom_x=100.0, @tone=(0.000000, 0.000000, 0.000000, 0.000000), @zoom_y=100.0>,
    (You get the idea)


    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:




"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."

Blizzard

1)

(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

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)
Quote from: Blizzard on April 01, 2008, 02:34:03 am
3)

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

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 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

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:


"#{$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:




"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."

Blizzard

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 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

1) Script '.rxdata to .txt' line 108: SyntaxError Occurred.

Line 108:
                       }


4) Never heard of a FSM.
Stuff I've made:




"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."

Blizzard

1) What the...?! O_O It works fine with me. Try this:
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 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

Fantasist

QuoteAlso, 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?

QuoteI 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.

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




shdwlink1993

@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:

Spoiler: ShowHide
  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|
                               "      @parameters = '#{table[x, y, z]}'\n" +  # this would print out the element at x, y, z
                   }}}
                   "      @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


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?

Spoiler: ShowHide
      Dir.mkdir(EXTRACT_LOCATION + "/" + SCRIPTS_LOCATION) unless File.exist?(EXTRACT_LOCATION + "/" + SCRIPTS_LOCATION)
      script_data = load_data("Data/Scripts.rxdata")
      scripts = []
      for raw_script in script_data
        scripts << Zlib::Inflate.inflate(raw_script[2])
      end
      (1...scripts.size).each {|i|
        unless scripts[i] == nil
          file = File.open(EXTRACT_LOCATION + "/" + SCRIPTS_LOCATION + "/#{i+1}. #{script_data[i][1]}.rb", 'w') rescue File.open(EXTRACT_LOCATION + "/" + SCRIPTS_LOCATION + "/#{i+1}. Invalid characters in filename.rb", 'w')
          file.write(scripts[i])
        end}
      file.close


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

Spoiler: ShowHide
@analyzed
@FURY_STATUS
@EQUIPMENT_REQUIREMENT
@order_only
@face_graphic_justification
@show_pause
@message_frame
@CHARGE_SKILL
@UNIQUE_SKILL_COMMANDS
@system_words
@load_count
@ums_mode
@FACESETS
@map_interpreter
@minimap_h
@DOOM_STATUS
@known
@choice_position
@map_name_id
@BETTER_TILEMAP_UPDATE
@animation_pause
@fontname
@MINIMAP
@window_height
@FACESETS_DSS
@DEMI_SKILL
@escaping_exp_cost_max
@name_window
@save_disabled
@cam
@FPS_MODULATOR
@SHADED_TEXT
@back_opacity
@INVINCIBLE_STATUS
@ITEM_REQUIREMENT
@battle_order_only
@face_graphic_position
@minimap_visible
@ENERGY_SKILL
@sound_effect
@save_count
@skip_mode
@CATERPILLAR
@HEAL_AT_LVLUP
@message_event
@minimap_a
@ABSORB_HP_SP
@name_timer
@CENTER_BATTLER
@face_frame_width
@release
@window_width
@STATUS_ICONS
@fontsize
@ZOMBIE_STATUS
@ENEMY_STATUS
@font
@menu_disabled
@REVENGE_SKILL
@HUD
@chaos_party
@window_image
@SPEED_MODULATOR
@shadowed_text
@teleport_dest
@minimap_x
@SP_COST_MOD
@HP_SP_CRUSH
@magic_number
@slave_windows
@version_id
@name
@ddns_off
@HPSPPLUS
@text_skip
@ARROW_OVER_PLAYER
@train_actor
@battle_interpreter
@DEATH_ROULETTE
@escaping_gold_cost_min
@resting_face
@BARS
@REGEN_STATUS
@SKILL_SEPARATION
@window_justification
@ANIBATTLERS_NON_ACTION_BS
@opacity
@encounter_disabled
@DESTRUCTOR_SKILL
@index
@encounter_count
@font_color
@used_codes
@DEATH_TOLL
@enemy_defeated
@TREMBLE
@FROZEN
@window_mode
@shadow_color
@teleport_permit
@minimap_y
@show_clock
@indy_windows
@TARGET_EM_ALL
@write_speed
@ANIMATED_BATTLE_BACKGROUND
@bar_style
@BLUE_MAGIC_SKILL
@escaping_gold_cost_max
@comic_enabled
@bgm_volume
@timer
@LOCATION_NAMES
@resting_animation_pause
@MULTI_HIT
@AUTO_REVIVE
@DEATH_IMAGE
@face_graphic
@analyze_mode
@message_position
@tileset_settings
@text_justification
@SP_DAMAGE_SKILL
@actor_defeated
@WINDOW_BATTLERESULT
@shortcuts
@ANIMATION_STACK
@shake
@minimap_w
@choice_justification
@BLUE_MAGIC_STATUS
@beasts
@animated_faces
@QUICK_PASSABILITY_TEST
@bar_opacity
@MAP_AS_BATTLEBACK
@text_mode
@timer_working
@comic_style
@escaping_exp_cost_min
@EMP_SKILL
@sfx_volume
@BLACKFADE
@windowskin
@version
@data
@data
@data
@flash_color
@shake_power
@weather_duration
@weather_type
@tremble_power
@shake_direction
@tone_duration
@weather_max_target
@tremble
@shake_duration
@tone_target
@weather_type_target
@pictures
@flash_duration
@shake_speed
@tone
@weather_max
@tremble_direction
@shake
@data
@event_armor
@armor_recipes_made
@gold
@weapons
@item_recipes_made
@event_weapon
@weapon_recipe_availible
@items
@mission
@event_item
@weapon_recipes_made
@steps
@armor_recipe_availible
@armors
@item_recipe_availible
@actors
@enemies
@display_y
@panorama_hue
@terrain_tags
@fog_tone
@fog_sy
@events
@scroll_speed
@passables
@fog_opacity
@fog_opacity_duration
@display_x
@panorama_name
@priorities
@fog_oy
@fog_sx
@common_events
@scroll_rest
@map
@fog_hue
@fog_tone_duration
@map_id
@autotile_names
@passages
@fog_ox
@fog_zoom
@scroll_direction
@fog_name
@fog_tone_target
@tileset_name
@battleback_name
@fog_blend_type
@need_refresh
@fog_opacity_target
@opacity
@anime_count
@character_name
@original_pattern
@move_type
@real_y
@direction_fix
@jump_peak
@y
@pattern
@move_route
@original_move_route_index
@tile_id
@original_direction
@prelock_direction
@real_x
@step_anime
@jump_count
@x
@direction
@move_frequency
@original_move_route
@transparent
@always_on_top
@locked
@blend_type
@walk_anime
@stop_count
@id
@character_hue
@move_speed
@move_route_index
@encounter_count
@move_route_forcing
@through
@animation_id
@wait_count
@members


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:




"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."

Blizzard

Lol, you have some really funny syntax errors there.

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


This here will work:

  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 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

Sase

Well it's nice reading this stuff. It makes me feel myself stupid :(

Fantasist

(1...scripts.size).each {|i|


It's
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




shdwlink1993

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:




"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."

Fantasist

Use
scripts.each_index {|i|
   code
}


instead of
(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




shdwlink1993

OK... this is gonna sound a bit stupid. Because I have no clue where that would go in the code, I can only guess. And guesses on my part tend to end in miserable errors and RMXP's whining.

This is the blob of code I'm using. Sorry if it seems like I'm asking you guys about every little step. I'm still learning. :-[

Spoiler: ShowHide
class Scene_Title
  def main
  save = File.open(EXTRACT_LOCATION + '/Save1.txt', 'w')
  file = File.open("save1.nhav", "rb")
  var = []
  scripts = []
  # Read character data for drawing save file
  characters = Marshal.load(file)
  # Read frame count for measuring play time
  Graphics.frame_count = Marshal.load(file)
  # Read each type of game object
  $game_system        = Marshal.load(file)
  $game_switches      = Marshal.load(file)
  $game_variables     = Marshal.load(file)
  $game_self_switches = Marshal.load(file)
  $game_screen        = Marshal.load(file)
  $game_actors        = Marshal.load(file)
  $game_party         = Marshal.load(file)
  $game_troop         = Marshal.load(file)
  $game_map           = Marshal.load(file)
  $game_player        = Marshal.load(file)
  scripts.each_index {|i|
    for var in $game_system.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_switches.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_variables.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_self_switches.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_screen.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_actors.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_party.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_troop.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_map.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    for var in $game_player.instance_variables
      save.write(var" = "scripts)
      save.write("\n")
    end
    save.write("#{$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")
  }
  save.close
  p ".rxdata extraction successful! Time needed: #{Time.now-$time} seconds."
  exit
  end
end


And now, I'll be leaving for school. Quickly.
Stuff I've made:




"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."

Blizzard

April 10, 2008, 11:45:34 am #41 Last Edit: April 10, 2008, 11:51:36 am by Blizzard
Put it in main, just above "begin" and add "exit" (without the double quotes) at the end (also above "begin"). The stuff will get executed and RMXP will exit.

Quote from: shdwlink1993 on April 09, 2008, 06:50:08 pm
Oh, yea. I left a note for you at the bottom of the last post, Blizz. I don't think you saw it, though.


I did see it. Smart way to protect my work, eh? ^_^ WcW said the same when he hacked DREAM. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

April 10, 2008, 09:35:32 pm #42 Last Edit: April 10, 2008, 10:30:51 pm by shdwlink1993
I was meaning Fantasist's line of code with the scripts.each_index. I'm not quite sure what you're talking about, Blizzard. Also, exit is already in there. Also also, the reason it's in scene_title is mainly that I had a bug problem and I forgot to switch it back, something that's happening... now.

Also, just wondering Blizz, how exactly did you get the .dll encrypted in the first place?
Stuff I've made:




"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."

Blizzard

I thought you were refering to this:

QuotePPS. The license redef was pretty funny.


When you said this:

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


And the encryption is pretty simply. I put DREAM into a text file, opened it in RMXP as string and encrypted every character with its ASCII value. Then I put all numbers into an array and dumped the array into a Marshal file. The decoder is in DREAM_ext.rb, which is only a dumped string.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

I got that bit, Blizz. I was referring to this line:

QuotePut it in main, just above "begin" and add "exit" (without the double quotes) at the end (also above "begin"). The stuff will get executed and RMXP will exit.


I wasn't sure what you meant. I understand exactly what you meant with the latter part. Sorry for the confusion over that.
Stuff I've made:




"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."

Blizzard

Original Main script:

#==============================================================================
# ** Main
#------------------------------------------------------------------------------
#  After defining each class, actual processing begins here.
#==============================================================================

begin
  # Prepare for transition
  Graphics.freeze
  # Make scene object (title screen)
  $scene = Scene_Title.new
  # Call main method as long as $scene is effective
  while $scene != nil
    $scene.main
  end
  # Fade out
  Graphics.transition(20)
rescue Errno::ENOENT
  # Supplement Errno::ENOENT exception
  # If unable to open file, display message and end
  filename = $!.message.sub("No such file or directory - ", "")
  print("Unable to find file #{filename}.")
end


YOUR Main script:

#==============================================================================
# ** Main
#------------------------------------------------------------------------------
#  After defining each class, actual processing begins here.
#==============================================================================

### Here goes your code.
exit

begin
  # Prepare for transition
  Graphics.freeze
  # Make scene object (title screen)
  $scene = Scene_Title.new
  # Call main method as long as $scene is effective
  while $scene != nil
    $scene.main
  end
  # Fade out
  Graphics.transition(20)
rescue Errno::ENOENT
  # Supplement Errno::ENOENT exception
  # If unable to open file, display message and end
  filename = $!.message.sub("No such file or directory - ", "")
  print("Unable to find file #{filename}.")
end
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

OOOhhhh. That's what you meant. OK, sorry about that, I wasn't quite understanding you.

And I had a question for you, Blizz: I'm trying to get a battle similar to the Prologue fight with Rivy, you know, where the entire thing is automated, and I was wondering: How the heck did you get it to skip selecting attacks at the beginning  ??? ?  I've been trying to to almost every stupid option on that selection for when it happens, but it either skips all the actions or it won't skip the fight selection.
Stuff I've made:




"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."

Blizzard

Make a status effect, call it Normal, make its rating 10 and inflict it at the beginning of the battle. That's it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

Fantasist

April 18, 2008, 11:52:32 am #48 Last Edit: April 18, 2008, 11:54:22 am by Fantasist
QuoteMake a status effect, call it Normal, make its rating 10 and inflict it at the beginning of the battle. That's it.


Here's what I did:


I've got to set the rating I see ^.^
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




Blizzard

Not really. You can set it to 1 alternatively. This will make every other status effect be displayed before. If two or more states are inflicted only the ones with the highest rating will be displayed if there isn't enough space to display them.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

Fantasist

So rating is only for displaying? I thought it was something else...
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




Blizzard

Just search for .rating in the scripts, you will find out that the only place where it is used is the sorting of the state ID array where the topmost are being displayed.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

ARGH! I can't believe it was so obvious! A state! I was thinking it was going to have to be some script editing. I really need to remember that there are other things in RPG Maker that I should learn other than scripts (although scripts are one of the biggest and coolest things to learn ;D).

But just one other thing: I want there to be a very small Battle Tutorial that occurs in the battle itself. A state won't help much here, because the turn pretty much looks like this:

Actor 1 selects attack
Actor 2 selects attack
Messages and stuff
Actor 1 attacks
Actor 2 attacks

The problem is that I need to move messages and stuff above selecting things. Is there a similar, hopefully less "I-am-such-an-idiot-for-not-thinking-of-such-a-thing" method, way of doing that?

Oh, and yes, the state thing deals heaping amounts of help to my Introduction scene. Thanks ;D.

PS. Is it just me, or am I asking for help here a lot?
Stuff I've made:




"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."

Blizzard

It's no problem, I wouldn't be having this forum if I wouldn't want to help. ^_^ And your questions are different from the stuff everybody asks. ^_^

If you want a tute that actually selected attack and stuff, you need some rather complicated scripting of an alternate battle scene.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


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

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

shdwlink1993

Nothing nearly that ridiculous. I mean that the guy would say what you should be doing before you select the commands, and not after.
Stuff I've made:




"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."

Fantasist

Try using the battle event commands (in the Monster Troop tab in Database). You might not be able to explain anything while the turn has started (i think), but explain a cuple of things each turn.

And btw, RPG Advocate did it in his game Phylomortis Avante Grande, a real-time battle tutorial. If you're desperate or curious, check it out, the project is unencrypted.
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




shdwlink1993

Slight catch, Fantasist: Phylomortis went down at the end of March >:(. That and I don't know where else to get that game.
Stuff I've made:




"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."

Fantasist

I have it, but too bad I can't upload it right now :(
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