Jump to content
Sign in to follow this  
shadow2k

Array-based "database" script?

Recommended Posts

I have a need to dump about 15 variables worth of data into various "records" which can then be accessed again later, by pulling the data out of the records and back into those 15 variables again.  The variables contain both integers and strings.

 

I know a bit about arrays from other programming languages but I'm very new to RGSS and I'm not entirely sure how to go about setting up something like this.

 

The main thing is that I need a very large number of records and I'd need to access the records via a variable.  For instance, if I wanted to access the 15 variables of data in record 7, I'd set variable 275 to 7, run a script call, and variables 250-265 would be filled with the data from record 7.  It's fine if the input/output is sequential.  The variables would always be loaded and saved in the same order.

 

I've done this sort of thing in other programming languages, but I don't really know how it would work in RGSS.  As I am learning, I'm curious if anyone with more experience would be willing to show me how this is done.

Share this post


Link to post
Share on other sites

Easiest thing that comes to my mind would be defining a new class that holds the data and then Marshal.dump it and later Marshal.load again for retrieval.

Share this post


Link to post
Share on other sites

Easiest thing that comes to my mind would be defining a new class that holds the data and then Marshal.dump it and later Marshal.load again for retrieval.

 

How would this work exactly?  I've only ever been able to use marshal.dump for file I/O.  Or is that what you're getting at?  Storing the variables in an external file?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted