javapadawan
First Post
That would be awesome... the more spells the better. I actually wrote a custom class to parse the information from a plain text file for when I import a lot of spells at once. The class I wrote is pretty easily modified, so I can really parse from any format you're comfortable putting the spells in.
The only thing that needs to remain constant is that each piece of spell information should be in the same format as all the other pieces. For example, some spells, like Protection From Chaos, etc., will only have Name, School, and Level, and maybe one or two other fields, and then it will say "As Protection From Good". I haven't coded the parser to be smart enough to pick up the rest of the fields from the other named spell, so all the missing fields would need to be copied. Not a big deal, but something to keep in mind. Also, because the long descriptions can span many lines, there must be a way to tell that the description is complete and the next spell block has begun. You can do this simply by starting each new spell with "Name:" like I did. Here's an example of the format I used:
Name: Acid Fog
Conjuration (Creation) [Acid]
Sor/Wiz 6, Water 7
V, S, M/DF
1 action
Medium (100 ft. + 10 ft./level)
Effect: Fog spreads 30 ft., 20 ft. high
1 round/level
None
Yes
Fog deals acid damage.
This spell's vapors are highly acidic... etc.
What the parser actually does is begin by reading in the first eleven lines. It knows that the first line is the name of the spell, the second line has the school information, the third is the components, and so on up to the eleventh line which is the short description. It knows to check for subschools in parentheses and descriptors in brackets on the school line, and it knows to separate the effect type (Area, Target, or Effect) before the colon from the actual effect (Fog, Ray, Cone, etc.) after the colon (I store these as separate fields so that you could more easily search for all Ray spells, or all Area effect spells, etc.).
After reading in the first eleven lines, the parser starts reading in each consecutive line and adding it to the spell's long description. For each line it checks to make sure that this line is part of the spell description and not the beginning of the next spell. That's where the "Name:" piece comes in handy. If that piece is there, the parser knows that it has finished reading in all the information for one spell. It then inserts that information into the database, and starts the whole process over with the next spell.
That's about it. Like I said though, the format is flexible. I can always modify the parser if you're more comfortable with a different format. Also, I plan on inputting Magic of Faerun next, so you can skip that one if you like. If you have any more questions, feel free to reply, email, or you can sometimes catch me on Yahoo or AOL instant messenger (my handle on both is javapadawan) or on ICQ (160687583).
Chris
The only thing that needs to remain constant is that each piece of spell information should be in the same format as all the other pieces. For example, some spells, like Protection From Chaos, etc., will only have Name, School, and Level, and maybe one or two other fields, and then it will say "As Protection From Good". I haven't coded the parser to be smart enough to pick up the rest of the fields from the other named spell, so all the missing fields would need to be copied. Not a big deal, but something to keep in mind. Also, because the long descriptions can span many lines, there must be a way to tell that the description is complete and the next spell block has begun. You can do this simply by starting each new spell with "Name:" like I did. Here's an example of the format I used:
Name: Acid Fog
Conjuration (Creation) [Acid]
Sor/Wiz 6, Water 7
V, S, M/DF
1 action
Medium (100 ft. + 10 ft./level)
Effect: Fog spreads 30 ft., 20 ft. high
1 round/level
None
Yes
Fog deals acid damage.
This spell's vapors are highly acidic... etc.
What the parser actually does is begin by reading in the first eleven lines. It knows that the first line is the name of the spell, the second line has the school information, the third is the components, and so on up to the eleventh line which is the short description. It knows to check for subschools in parentheses and descriptors in brackets on the school line, and it knows to separate the effect type (Area, Target, or Effect) before the colon from the actual effect (Fog, Ray, Cone, etc.) after the colon (I store these as separate fields so that you could more easily search for all Ray spells, or all Area effect spells, etc.).
After reading in the first eleven lines, the parser starts reading in each consecutive line and adding it to the spell's long description. For each line it checks to make sure that this line is part of the spell description and not the beginning of the next spell. That's where the "Name:" piece comes in handy. If that piece is there, the parser knows that it has finished reading in all the information for one spell. It then inserts that information into the database, and starts the whole process over with the next spell.
That's about it. Like I said though, the format is flexible. I can always modify the parser if you're more comfortable with a different format. Also, I plan on inputting Magic of Faerun next, so you can skip that one if you like. If you have any more questions, feel free to reply, email, or you can sometimes catch me on Yahoo or AOL instant messenger (my handle on both is javapadawan) or on ICQ (160687583).

Chris