Posted By
|
Message
|
Brian Haase (FSP)
Registered 22/01/2005
Points 691
|
31st May, 2005 at 02:38:38 -
I seem to have hit a weird little wall here. I'm using the INI PLUS object in MMF, and the EDIT Object. The EDIT Object is set to multiline. When I save the text data to the INI though, it discards everything past the first line - It really does not like multiple line strings in the INI file.
Does anyone know how I can work around this? Do I have to use the string parser to replace the line breaks? If so, I haven't the faintest clue how to use the parser. Has anyone else had this problem?
Current Projects:
Bomb Squad (Total Progress - 3%)
:: Current Task Progress: 40%
:: Current Task - Level Editor Shell
|
»xerus
Registered 28/06/2002
Points 675
|
31st May, 2005 at 02:47:40 -
I thought you weren't supposed to use the INI Plus in MMF... =|
n/a
|
Brian Haase (FSP)
Registered 22/01/2005
Points 691
|
31st May, 2005 at 02:51:30 -
... You aren't?
Current Projects:
Bomb Squad (Total Progress - 3%)
:: Current Task Progress: 40%
:: Current Task - Level Editor Shell
|
Crystal Clear (H.E.S) Possibly Insane
Registered 06/10/2002
Points 2548
|
31st May, 2005 at 03:03:59 -
You can use the Ini-Plus object in MMF
there is no real difference between the two, except one is already built into MMF and a few little things.
So be assured that this problem would bear no difference if you were using the built in INI object.
Now onto your problem, ive had some problems like that before with multiline and INI's im not exactly sure what it is, if i was you id just try and fiddle around a bit with the structure of the data being saved, or replace the EDIT object with a Rich Edit object. another thing, could you explain maybe a bit more info on what your using this for? then maybe some alternate methods could be suggested.
Or the simplest way to solve this would be to try replacing the INI with an array object and see if the array has problems with multilines.
HES homepage:
http://www.distinctiv-efair.com/heretic/studios
Crystal Clear Productions: http://www.distinctiv-efair.com/heretic/crystalclear
|
Brian Haase (FSP)
Registered 22/01/2005
Points 691
|
31st May, 2005 at 03:11:02 -
Well, I'm using this for the Level Data in Bomb Squad. The new version has a full-featured level editor for making the campaign levels and to let players build their own levels. That's all working perfectly.
The catch is when it comes to serve up the mission briefing and mission tips in the Briefing Screen. Right now, that string data is being saved (atleast most of it is) in an INI file. The Ini contains a bunch of other data too, but it's all flags and such. Integer data. Theres already two other array files being used also, one is a series of X/Y coordinates in string mode for 'triggered' text. The other is the map array which stores tile ID numbers. All this ends up bundled in a BSM (Bomb Squad Module) file courtasy of the ZIP Object.
For whatever reason though, after filling out the Mission Briefing and Mission Tips boxes and saving the data, it loses the extra lines. All i'm trying to do is write multiple line strings to disk and retrieve them later, basically.
There's a pretty good chance I could use the array object, yeah. I'm not sure if I want to use that for this particular system though... Just because it's kinda weird having three files per level as it is. (.INI for Level Information, .ARR for Level Map, .STA for Level Strings) But if it comes down to it, I suppose I could drop in another array. Atleast it saves and loads with incredible ease.
Current Projects:
Bomb Squad (Total Progress - 3%)
:: Current Task Progress: 40%
:: Current Task - Level Editor Shell
|
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
|
31st May, 2005 at 04:01:45 -
I think you should just use the Edit object to save the mission briefing. That way it won't be messy. The amount of files you have doesn't matter. A small txt file will only be a few Kbs.
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
|
Crystal Clear (H.E.S) Possibly Insane
Registered 06/10/2002
Points 2548
|
31st May, 2005 at 07:51:30 -
Oh okay i see now, If its the Mission Briefing text that is messing it up then what AA suggested would be the best way, thatll solve your problem. however if thats one extra file per mission and you really dont want that then if i was you id just have an Array which would contain the mission briefing text for ALL the missions.
HES homepage:
http://www.distinctiv-efair.com/heretic/studios
Crystal Clear Productions: http://www.distinctiv-efair.com/heretic/crystalclear
|
Brian Haase (FSP)
Registered 22/01/2005
Points 691
|
31st May, 2005 at 10:30:01 -
Well, I can't use an array to store the text for them all, you wouldn't be able to make and exchange custom missions then. And i'm not concerned about the size of the text files, they get packed into an encrypted zip file anyway. So far it packs about 15 K down to 499 bytes. Probably close to the worlds smallest level file.
I guess i'll just go with the Assault Andy's idea though and use the edit object to save them. Theres only two boxes, hardly even justifies an array. And since it all gets zipped into a bundle, It won't be too messy I suppose.
Thanks everyone, I appreciate the help.
Current Projects:
Bomb Squad (Total Progress - 3%)
:: Current Task Progress: 40%
:: Current Task - Level Editor Shell
|
Klikmaster Master of all things Klik
Registered 08/07/2002
Points 2599
|
31st May, 2005 at 13:04:29 -
Why dont you put the briefing in one of the arrays you already have? Put it on a different Z axis or something
n/a
|
Brian Haase (FSP)
Registered 22/01/2005
Points 691
|
31st May, 2005 at 13:13:20 -
Because if I boost the Z array, the array expands by a considerable amount. For instance, the text-trigger array is 40x32x1, which means 1280 string slots. Kicking the Z value up a notch takes it up to 2560 strings. Just to hold two more.
Sure, most people won't have any trouble with an increase like that. But it's just bad design. Generally, it wastes memory.
I'm saving the files to disk now as level.desc and level.tips - Anything that matches level.* gets wrapped into the file module as it saves anyway, so it'll work without a ton of new events. It means more files in the package and in the temp directory while playing, but it's starting to look unavoidable.
Current Projects:
Bomb Squad (Total Progress - 3%)
:: Current Task Progress: 40%
:: Current Task - Level Editor Shell
|
Klikmaster Master of all things Klik
Registered 08/07/2002
Points 2599
|
31st May, 2005 at 18:56:45 -
Ok, back to the idea of multiple lines in an ini, I know its possible (with string parser) to take a characer from an ini and change it into a new line, but the problem is, I dont know how to make mmf recognise a new line and put a character instad
n/a
|
Brian Haase (FSP)
Registered 22/01/2005
Points 691
|
31st May, 2005 at 19:25:32 -
Hmm. Any of the C++ classics work, like using \n or \r as your character?
I've never used the string parser, I haven't the faintest clue how to.
Current Projects:
Bomb Squad (Total Progress - 3%)
:: Current Task Progress: 40%
:: Current Task - Level Editor Shell
|
Tigerworks Klik Legend
Registered 15/01/2002
Points 3882
|
31st May, 2005 at 21:09:38 -
The problem is INI files stores data like this:
item1=value1
item2=value2
item3=value3 etc.
If you put a two line string, e.g.:
"Line 1
Line 2"
in to an item "text", then you will get:
text=Line 1
Line 2
Which is exactly what you said to do, but a line break marks the end of an item.
Two solutions, either use a txt file, or use string parser to replace Newline$ with "\n" or something. Then when loading from the INI, replace "\n" with Newline$ again. ("\n" does not mean anything special in MMF; its just a sensible way to replace newlines)
Also I think INIs can only have 1kb per line, so you'd be limited to 1kb of text.
You need the latest build of MMF for Newline$ to work, alternatively just put a line break in a string object.
- Tigerworks
|
|
|