Avarion Posted November 9, 2005 Report Share Posted November 9, 2005 Hello, I have a huge problem. I've scanned a book with spells for the game AD&D. Now I want put the data into a database, but the data are not in the right format. The data now has the following format: Dancing Lights (Alteration) Range: 40 yds. + 10 yds./level Components: V, S, M Duration: 2 rds./level Casting Time: 1 Area of Effect: Special Saving Throw: None When a dancing lights spell is cast, the wizard creates, at his option, from one to four lights that resemble either torches or lanterns (and cast that amount of light), glowing spheres of light (such as evidenced by will-o-wisps), or one faintly glowing, vaguely manlike shape, somewhat similar to that of a creature from the Elemental Plane of Fire. The dancing lights move as the spellcaster desires, forward or back, straight or turning corners, without concentration upon such movement by the wizard. The spell cannot be used to cause blindness (see the 1st-level light spell), and it winks out if the range or duration is exceeded. The material component of this spell is either a bit of phosphorus or wychwood, or a glowworm. Detect Magic And I need this format: "Dancing Lights";"(Alteration)";"40 yds. + 10 yds./level";"V, S, M" . . . Every field has to be in "" and the fieldnames have to be cut out. I am willing to preprocess the textfile and insert a empty line between the spells but it would be great if the macro can handle the other work. Has anyone an idea? Quote Link to comment Share on other sites More sharing options...
m204prgmr Posted November 9, 2005 Report Share Posted November 9, 2005 This looks pretty exciting but it's hard to tell what to do with the story. Can you remove the story and give a better example of what the data is for each line? With this being present; Dancing Lights (Alteration) Range: 40 yds. + 10 yds./level Components: V, S, M and this being your requested output; "Dancing Lights";"(Alteration)";"40 yds. + 10 yds./level";"V, S, M" I'm having a hard time seeing what the next row would be..maybe I'm old.. Would this be next; "Dancing Lights";"(Alteration)";"2 rds./levell";"1" "Dancing Lights";"(Alteration)";"special";"none" Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 9, 2005 Author Report Share Posted November 9, 2005 Ok, Sorry for this. Here are two spells for example: Dancing Lights (Alteration) Range: 40 yds. + 10 yds./level Components: V, S, M Duration: 2 rds./level Casting Time: 1 Area of Effect: Special Saving Throw: None When a dancing lights spell is cast, the wizard creates, at his option, from one to four lights that resemble either torches or lanterns (and cast that amount of light), glowing spheres of light (such as evidenced by will-o-wisps), or one faintly glowing, vaguely manlike shape, somewhat similar to that of a creature from the Elemental Plane of Fire. The dancing lights move as the spellcaster desires, forward or back, straight or turning corners, without concentration upon such movement by the wizard. The spell cannot be used to cause blindness (see the 1st-level light spell), and it winks out if the range or duration is exceeded. The material component of this spell is either a bit of phosphorus or wychwood, or a glowworm. Enlarge (Alteration) Reversible Range: 5 yds./level Components: V, S, M Duration: 5 rds./level Casting Time: 1 Area of Effect: 1 creature or object Saving Throw: Neg. This spell causes instant growth of a creature or object, increasing both size and weight. It can be cast only upon a single creature (or a symbiotic or community entity) or upon a single object that does not exceed 10 cubic feet in volume per caster level. The object or creature must be seen to be affected. It grows by up to 10% per level of experience of the wizard, increasing this amount in height, width, and weight. All equipment worn or carried by a creature is enlarged by the spell. Unwilling victims are entitled to a saving throw vs. spell. A successful saving throw means the spell fails. If insufficient room is available for the desired growth, the creature or object attains the maximum possible size, bursting weak enclosures in the process, but it is constrained without harm by stronger materials-—the spell cannot be used to crush a creature by growth. Magical properties are not increased by this spell--a huge sword +1 is still only +1, a staff-sized wand is still only capable of its normal functions, a giant-sized potion merely requires a greater fluid intake to make its magical effects operate, etc. Weight, mass, and strength are affected, though. Thus, a table blocking a door would be heavier and more effective, a hurled stone would have more mass (and cause more damage), chains would be more massive, doors thicker, a thin line turned to a sizeable, longer rope, and so on. A creature's hit points, Armor Class, and attack rolls do not change, but damage rolls increase proportionately with size. For example, a fighter at 160% normal size hits with his long sword and rolls a 6 for damage. The adjusted damage roll is 10 (that is, 6 x 1.6 = 9.6, rounded up). Bonuses due to Strength, class, and magic are not altered. The reverse spell, reduce, negates the enlarge spell or makes creatures or objects smaller. The creature or object loses 10% of its original size for every level of the caster, to a minimum of 10% of the original size. Thereafter, the size shrinks by 1 -foot increments to less than 1 foot, by 1-inch increments to 1 inch, and by 1/10-inch increments to a minimum of 1/10 of an inch—-the recipient cannot dwindle away to nothingness. For example, a 16-foot-tall giant reduced by a 15th-level wizard (15 steps) would be reduced to 1.6 feet (in nine steps), then to 6/10 of a foot or 7.2 inches (in one step), and finally to 2.2 inches (in the last five steps). A shrinking object may damage weaker materials affixed to it, but an object will shrink only as long as the object itself is not damaged. Unwilling creatures are allowed a saving throw vs. spell. The material component of this spell is a pinch of powdered iron. And this is how they should be: "Dancing Lights";"(Alteration)";"N";"40 yds. + 10 yds./level";""V, S, M";"2 rds./level";"1";"Special";"None";"When a dancing lights spell is cast, the wizard creates, at his option, from one to four lights that resemble either torches or lanterns (and cast that amount of light), glowing spheres of light (such as evidenced by will-o-wisps), or one faintly glowing, vaguely manlike shape, somewhat similar to that of a creature from the Elemental Plane of Fire. The dancing lights move as the spellcaster desires, forward or back, straight or turning corners, without concentration upon such movement by the wizard. The spell cannot be used to cause blindness (see the 1st-level light spell), and it winks out if the range or duration is exceeded. The material component of this spell is either a bit of phosphorus or wychwood, or a glowworm." "Enlarge";"(Alteration)";"Y";"5 yds./level";"V, S, M";"5 rds./level";""1";"1 creature or object";"Neg.";"This spell causes instant growth of a creature or object, increasing both size and weight. It can be cast only upon a single creature (or a symbiotic or community entity) or upon a single object that does not exceed 10 cubic feet in volume per caster level. The object or creature must be seen to be affected. It grows by up to 10% per level of experience of the wizard, increasing this amount in height, width, and weight. All equipment worn or carried by a creature is enlarged by the spell. Unwilling victims are entitled to a saving throw vs. spell. A successful saving throw means the spell fails. If insufficient room is available for the desired growth, the creature or object attains the maximum possible size, bursting weak enclosures in the process, but it is constrained without harm by stronger materials-—the spell cannot be used to crush a creature by growth. Magical properties are not increased by this spell--a huge sword +1 is still only +1, a staff-sized wand is still only capable of its normal functions, a giant-sized potion merely requires a greater fluid intake to make its magical effects operate, etc. Weight, mass, and strength are affected, though. Thus, a table blocking a door would be heavier and more effective, a hurled stone would have more mass (and cause more damage), chains would be more massive, doors thicker, a thin line turned to a sizeable, longer rope, and so on. A creature's hit points, Armor Class, and attack rolls do not change, but damage rolls increase proportionately with size. For example, a fighter at 160% normal size hits with his long sword and rolls a 6 for damage. The adjusted damage roll is 10 (that is, 6 x 1.6 = 9.6, rounded up). Bonuses due to Strength, class, and magic are not altered. The reverse spell, reduce, negates the enlarge spell or makes creatures or objects smaller. The creature or object loses 10% of its original size for every level of the caster, to a minimum of 10% of the original size. Thereafter, the size shrinks by 1 -foot increments to less than 1 foot, by 1-inch increments to 1 inch, and by 1/10-inch increments to a minimum of 1/10 of an inch—-the recipient cannot dwindle away to nothingness. For example, a 16-foot-tall giant reduced by a 15th-level wizard (15 steps) would be reduced to 1.6 feet (in nine steps), then to 6/10 of a foot or 7.2 inches (in one step), and finally to 2.2 inches (in the last five steps). A shrinking object may damage weaker materials affixed to it, but an object will shrink only as long as the object itself is not damaged. Unwilling creatures are allowed a saving throw vs. spell. The material component of this spell is a pinch of powdered iron." The third field is an boolean for the point "reversible". If there is no reversible as in enlarge then the field is N for NO else Y for YES. I have three more fields but I think I can insert em myself as soon I understand the macro itself. I hope it will help you to understand the problem I have. Quote Link to comment Share on other sites More sharing options...
m204prgmr Posted November 9, 2005 Report Share Posted November 9, 2005 Avarion, Thanks for the info but I was just looking for the raw data and not the spell stories, unless the data is in the story and you have to parse it out? Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 9, 2005 Author Report Share Posted November 9, 2005 Hmm. I am unsure I understand you. The spell story in the first code-part is the raw information in the textfile. The second code-part is the information I need. Macro Express should now reformate the Data, cut the descriptions like "Duration", "Area of Effect" and so on and put all in quotationmarks and put all in one line. Quote Link to comment Share on other sites More sharing options...
randallc Posted November 9, 2005 Report Share Posted November 9, 2005 hi, This replicates the example, but I'm still not sure either if is is exactly what you want ; all now ascii-quotes including the text as a single field. Try it. Best, Randall // Set tab / CRLF name [i am presuming the problems are the tabs?.... if they are spaces, I'm wrong]Variable Set %T2% to ASCII Char of 10 Variable Set %T3% to ASCII Char of 13 Variable Modify String: Append %T2% to %T3% Variable Modify String: Save %T3% to Environment Variable Variable Set %T2% to ASCII Char of 9 Variable Modify String: Save %T2% to Environment Variable Delete File or Files: "examplebook2.txt" // Whatever the file name, process line by line Variable Set String %T3% """ Text File Begin Process: "examplebook.txt" Variable Set Integer %N1% from Length of Variable %T1% Variable Modify String: Copy Part of %T1% to %T2% // If last character not a period, then replace tabs with ";" etc If Variable %T2% <> "." OR If Variable %T1% contains "%TAB%" If Variable %T3% = "%CRLF%" // Is this what you want before next spell starts; or ";" ? Variable Set String %T3% ""%CRLF%"" Else Variable Set String %T3% """ End If Replace "%T1%" with "%T3%%T1%";" in %T1% Replace "%TAB%" with "";"" in %T1% Variable Modify String: Append %T1% to Text File Variable Set String %T3% """ Else // If last character is a period, Replace "%T1%" with "%T3%%T1%" in %T1% Variable Modify String: Append %T1% to Text File // CRLF, no quotes for next line at start if it remains a sentence next line Variable Set String %T3% "%CRLF%" End If Text File End Process // Add a quote at the total end Variable Set String %T1% """ Variable Modify String: Append %T1% to Text File Program Launch: "examplebook2.txt" try1.mxe Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 9, 2005 Author Report Share Posted November 9, 2005 oof. Hard stuff. I'll try to understand this on weekend. Thanks for your work. I'll tell you if I am able to understand it Quote Link to comment Share on other sites More sharing options...
randallc Posted November 10, 2005 Report Share Posted November 10, 2005 by the way, in relation to my presumption for it to work at present in those first few lines(that it was a tab mark), if there was more than one, you would need to replace strings of tabs until there was just a single tabl for this macro towork to come before starting it (or on each line). Alternatively, of course if they are spaces, you would need to replace a string of spaces with at least one tab before that! I hope that all works. Best, Randall. by the way, if you wish to actually "attach" part of a text file at least as an attachment, we can check whether those marks are tabs or whatever; you may be able to see in Word, for instance anyway. Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 10, 2005 Author Report Share Posted November 10, 2005 Ok, here are two Files. The file called "Hauptbuch.txt" is the original data. The file "HB 2.txt" is handmade as I need it for the database. Hmm. It seems I am not able to add RAR-Files, so it is a bigger ZIP-file. Sorry. Edit: there are some changes in the HB 2 compared with my description, like I put the spellcomponents, normally a part of the spelldescription, in a seperate field and I added a field with the value 1 in it as a description from what book I took the data. Dont get confused. AD_D.zip Quote Link to comment Share on other sites More sharing options...
m204prgmr Posted November 10, 2005 Report Share Posted November 10, 2005 Hauptbuch.txt looks pretty interesting. The words that are surrounded by ( ) ...some have another word after and some don't. It looks like if you remove all of the spell text information that explains the spell, you're left with the data that you need to manipulate. And it seems that a search for the left paren indicates a new line? Quote Link to comment Share on other sites More sharing options...
randallc Posted November 10, 2005 Report Share Posted November 10, 2005 hey, Had you tried running my macro? It fixed all but your new fields. (if first changed long numbers of spaces to tabs) Here it is again; seems to work on the new fields as well. best, Randall try2.mxe Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 10, 2005 Author Report Share Posted November 10, 2005 Oh, it works really fine. Now it should cut off the field names like "Range:", "Components:" and so on. Can you store the macro in a *.mex file so i can open the sourcecode? I dont know how to open the mxe as source. Quote Link to comment Share on other sites More sharing options...
kevin Posted November 10, 2005 Report Share Posted November 10, 2005 I dont know how to open the mxe as source.In the Macro Express Explorer click File, Import, Import a Playable Macro. Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 11, 2005 Author Report Share Posted November 11, 2005 Thanks kevin. Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 11, 2005 Author Report Share Posted November 11, 2005 Hauptbuch.txt looks pretty interesting.The words that are surrounded by ( ) ...some have another word after and some don't. It looks like if you remove all of the spell text information that explains the spell, you're left with the data that you need to manipulate. And it seems that a search for the left paren indicates a new line? The problem is that I need the spellinformation in the last field. The database field are: Spellname, Book (in this Book are all HB for "Hauptbuch"), Spelllevel, Reversible true/false, Wildmagic true/false (is not in the Spelldescription only in the spellist. Have to make it with my own hands), School (Necromancy, Alteration, Evocation and so on), Range, Components, Materialcomponents (only if there is a M in Components. Described in the Spelldescription. I'll make it myself), Spellduration, Castingtime, Area of Effect, Savingthrow, Spelldescription As a matter of clearness i moved the materialcomponents from Spelldescription in a seperate field. Perhaps I should mark the components before running the macro. Would be easier to seperate the fields. Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 13, 2005 Author Report Share Posted November 13, 2005 I've read it and I am sure I understand not more than 2/3 of it. The removing of "Range: ", "Duration: " and so on is easy, i can handle it by myself. The one problem I can not solve is a missing ; at end of every spelldescription. I've found you comment about this point in the source but I don't know exactly how to add the semicolon. Quote Link to comment Share on other sites More sharing options...
randallc Posted November 13, 2005 Report Share Posted November 13, 2005 Hi, The line which detects end of spell and inserts a CRLF, ready for next line is; // Is this what you want before next spell starts; or ";" ? Variable Set String %T3% ""%CRLF%"" Change this to asemicolon instead?; -it means you have no endofline there; but I'm not sure how you are processing this? - presumably NOT (as I might) by using "ASCII file process"?) // Is this what you want before next spell starts; or ";" ? Variable Set String %T3% "";"" Hope this help, Randall Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 13, 2005 Author Report Share Posted November 13, 2005 Ah, ok. I need both. Thanks. Quote Link to comment Share on other sites More sharing options...
Avarion Posted November 13, 2005 Author Report Share Posted November 13, 2005 It worked, it worked. Thank you all. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.