Sign in to follow this  

Making an Item Editor for an RPG in VB6

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First of all, i have a series of textboxes and comboboxes on the form to change the properties of an item. The properties for an item are stored in a custom type I built to hold data for items. The problem is how to save the array and then load it back again. I have a text box at the bottom of the form that has all the data for all items exactly as it was put into the array. I was thinking about saving the data in the textbox as a text file until the game is complete, and then encrypt it. Then the problem is when it gets loaded, how to put it back into the array. If any code from the program is needed to do what i asked here, just tell me.

Share this post


Link to post
Share on other sites
Write the list with individual items seperated by a slash, period, semicolon, whatever.

Then all you have to do is when you read the list of items is to parse the list looking for the special character you made to seperate each item.

Example:

pie;large swimming pool;rubber hose;floppy;carpet cleaning agent

Read in until you find the token you use to seperate, and then write that to your array. Go on to the next item and the next item after that until you are left with no more items.

Share this post


Link to post
Share on other sites
You can save or load any variable in visual basic with Get and Put (I find it's best to always use files in Binary format). If you want to output in a specific format, (you might need to limit variables to byte size for example) it's best to copy them to a temporary variable first, but generally VB6 is pretty easy to save and load with.

The thing that really annoys me about VB6 is the stupid out of bounds errors (which seem to vanish when you use hex) and the lack of shift and rotate commands!

Mark
Sound Effects For Game Developers
http://www.indiesfx.co.uk

Share this post


Link to post
Share on other sites
i forgot to put i had each item in the textbox seperated by a comma, so that would work for the parsing, but i dont know how to code something to parse it. Could someone shed some light on this topic?

Share this post


Link to post
Share on other sites
Here are a few things to look at:

String Parsing

There is about 40 or so code samples on how to parse strings of all kinds in VB. This one is probably what you're looking for.

In that sample source code:


Split(Text1.Text, vbCrLf, , vbTextCompare)


You'll want to replace vbCrLf with whatever delimiter token you want to use. (vbCrLf is the newline character for VB).

Share this post


Link to post
Share on other sites

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this