HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Commas in profile files

07-10-2008, 01:13 PM#1
d07.RiV
Does a comma in a profile string (.txt files in units\) mean that the field is to be treated as an array of values (if it is not inside quotes)?

If yes, what happens if I have a comma in unit name or icon path (they are not quoted by default)? Should I put such fields in quotes (or, does widgetizer do that)?

If no, how do I tell if a field is to be treated as an array or not (e.g. for merging unit data in .w3* files)?
07-11-2008, 09:31 AM#2
PitzerMike
Quote:
Originally Posted by d07.RiV
Does a comma in a profile string (.txt files in units\) mean that the field is to be treated as an array of values (if it is not inside quotes)?

If yes, what happens if I have a comma in unit name or icon path (they are not quoted by default)? Should I put such fields in quotes (or, does widgetizer do that)?

If no, how do I tell if a field is to be treated as an array or not (e.g. for merging unit data in .w3* files)?

You can tell from the ...MetaData.slk files if a certain property contains leveled data or not. If repeat is > 0 then a "," separates the levels (for example tooltip of abilities) and if a field is doubly defined with differing index values then a "," separates different properties. For example "Buttonpos" is defined twice in AbilityMetaData.slk. One time with index 0 and one time with index 1 which is the X and Y position.
Now if a tooltip contains a comma then the whole tip is quoted.

All this doesn't matter in the object files (w3*) though, where you don't have to worry about commas since each level is put into its own definition anyway. The expressiveness of the w3* is a bit better since you can also have strings with both commas and quotes which wouldn't be possible in the txt. That's why Widgetizer converts quotes to single quotes when putting them in the txt. Then Widgetizer puts quotes around strings that contain a commas.
07-11-2008, 12:11 PM#3
d07.RiV
BTW widgetizer converts double quotes to double single quotes (" -> '')? I didn't try it much but I saw base WC3 files use '' for quotes and I suppose it looks just like " (because single quotes are really narrow in WC3 font).

Anyway I think I got it already. I figured "index" field is negative if the w3* entry defines the whole field at once (and it is displayed as one in the object editor), if it is non-negative then the field is treated as comma-separated list and metadata rows refer to separate items from that list.
So I'm storing every field as it is in the slk's/txt's and then if object file entry has a non-negative index then instead of replacing the field I find string between the commas #(index+level) and replace it. If index is negative and level is non-zero then I append the level to the field name. And if the field name was "Data" then append A/B/C/... depending on column number in object file (if there is one).
One point: if an object has, say, 20 levels, should the field #1 be named DataA1 or DataA01?

Also is there any kind of guide on how to efficiently display data in WE format?
Would it work properly like this:
If the object has levels (doodad/ability/buff), then find the level field (I suppose it is hardcoded) and remember the value.
Then read through the metadata file and see what fields are used for this object (UsesSpecial or whatever it is is set), sort the fields as specified in the "sort" column and clone the fields that have "repeats" set to fit the number of levels. Then just go through all the items and add a new line in the table, with first value set to corresponding WESTRING from metadata and second value set to either the whole field or a required comma-separated string as specified by "index".
07-25-2008, 08:45 PM#4
PitzerMike
Oh sorry, I was on a holiday.
Anyway your assumptions seem mostly right so it should be ok.