Posted By
|
Message
|
Jason Orme Using Klik Products Since 1998
Registered 24/05/2002
Points 960
|
3rd March, 2010 at 00:47:29 -
Well, i've always had some genius help me with my problems.
This time its a problem with my arch enemy, the evil INI.
For the life of me, in over 10 years I just can't master these objects.
Below is a rpg inventory system i've been working on, its pretty crude at the moment. I includes dropped items, items in an inventory and equiped items.
Download the file to see what I mean.
http://www.jsofts.com/rpgopensource/rpg.zip
The only things that need saving are the inventory items and the equiped item.
the item settings that are only important at this time are the animation and direction of each object so that they stay the same on restarting the app.
Can anyone help, i'm just completely lost.
Thanks in advance
- Jason
Edited by Jason Orme
www.jsofts.com
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1970
|
3rd March, 2010 at 03:43:04 -
Inis are really very simple (suggest you look at a few examples) but if you don't like them, don't use them - you could use arrays, lists, xml, etc for something like this instead.
Personally, I'd probably use a combination of the string parser extension, and a list object. By using a list, you don't have to do any kind of fast-looped search for the first vacant inventory slot when adding items - you just add a new line.
Here's a simple little example I just made:
http://cid-b1e7ee094271bbda.skydrive.live.com/self.aspx/Public/Inventory.mfa
If you want I can comment it, and give it a graphical interface instead, but not til tomorrow.
Also, if you do a search, you'll find a very thorough series of articles on the subject (using arrays to store the inventory information).
btw: You should plan out and explain *exactly* what you're going to need now - it'll be a lot harder to add extra features to an inventory system later on.
eg. Will some items require two hands to use? Can items only be used in certain places? Anything else you can think of?
Edited by Sketchy
n/a
|
Silveraura God's God
Registered 08/08/2002
Points 6747
|
3rd March, 2010 at 05:48:03 -
I'd only use INI's for settings or options. That's basically exactly what they are used for in main stream products. I'd use encrypted arrays or the save game object for anything else.
http://www.facebook.com/truediamondgame
|
Jason Orme Using Klik Products Since 1998
Registered 24/05/2002
Points 960
|
3rd March, 2010 at 16:35:15 -
Hello, thanks for the replies.
I've tried your example and while impressive I can't see how String Parser can help me with how my system works since its animation and directional data I need saving rather than a name.
As for planning ahead, i've done alot of that, i'm at the moment trying to work out how to use INIs, everything shown is just a small example. I already have a system in place for comparing stats of different items, dmg, speed, type, value etc and a gui that shows it all. Its just storing the data i'm having the biggest problem with, even when testing INI objects I can't even find a INI object saved anywhere on my computer, I always thought it appeared in the same directory as the app.
www.jsofts.com
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1970
|
3rd March, 2010 at 17:16:15 -
You can still use a parsed string.
In the example I made, the string has the following format:
Item Name / Can be worn on head? / Can be held in right hand? / Can be held in left hand? / Can be worn on torso?
You could very easily change it to:
Animation / Direction / Can be worn on head? / Can be held in right hand? / Can be held in left hand? / Can be worn on torso?
Like Silverfire, I honestly don't think an INI is the best way to go here - an array would be better if you don't want to do it my way. Just use a different X position for each inventory slot (1-40) and body slot (41-53), and a different Y position for each piece of data you need to store.
eg. X=5, Y=2 would hold the second piece of information (the animation for example) of the item in the 5th inventory slot.
eg. X=42, Y=1 would hold the first piece of information (the direction for example) of the item in the 42nd slot (the item worn on the head?).
Re: The INI file itself - you should use the following action:
+ Start of Frame
-> INI: Set current file to Apppath$ + "Inventory.ini"
If you just enter a filename in the properties box, it will be saved to the C:\Windows\ folder, which is VERY annoying, so don't do it.
btw: Stick to the regular Ini object if you're having difficulty with it. The Ini++ extension has loads more options you won't need, and will just confuse you even more.
Edited by Sketchy
n/a
|
Jason Orme Using Klik Products Since 1998
Registered 24/05/2002
Points 960
|
3rd March, 2010 at 19:11:52 -
Ah, I see what you mean now.
I will see how far I can get with it.
Thanks for the help.
www.jsofts.com
|
|
|