Bulk Data Entry

(Feature not available in Player Genie)

What is Bulk Data Entry?

You might have large number of skills, feats, spells, etc. typed in a text or Word file in a repetitive format, which you would like to input into DM Genie for in-game use. While it is possible to copy/paste names and descriptions one by one, for many items it is very time consuming. This feature automates this data entry.

How Does it Work?

The input text has to be list of rich-text formatted descriptions, with separators between them (see below). DM Genie will find the text between separators and send it to a script you write for processing. Since the script can be pretty much infinitely customized, this allows for any text format you may have.

Warning: this feature could mess up an existing campaign if not used carefully. It is highly recommended that you make a backup of your entire campaign (ZIP the entire folder) before using Bulk Entry. Alternatively, you can make a new empty campaign just for testing this, and then export the files from it.

Separator

DM Genie needs someway to know where one item's description starts and the other ends. A certain string that will not be present anywhere else serves this purpose – for example, "###". There should be no separator at the beginning of the text, but there should be one at the end. For instance:

My Item Name
Some descriptive text....
###
My Second Item Name
Some descriptive text....
###
My Third And Final Item Name
Some descriptive text....
###

The separator does not need to be alone on a line. It will be removed before processing more text. For example, to read a comma-separated value file, you could append a ### as the last column. Your separator would be ",###". Then you can use the split function to split the text string according to a separator, in this case, the comma. For instance

dim sArray()

sArray = split(text, ",")

Name = sArray(0)

Price = func.CVSng(sArray(1))

Hint: Microsoft Word has a powerful search and replace function that can search for specific formatting. For instance, if all the names of skills in your text file are bold and red, you can search for this formatting and quickly insert the separator.

Note: Text gets removed from the box as it is processed – so make sure you have a copy somewhere.

Replace Behavior

By default the program will prompt you if the new item you are adding already exists. You can set it to automatically replace, or automatically skip existing items. Automatically replacing the items will make it faster to debug your script.

Scripting

The most difficult part of data entry will be designing a working script – but once you are successful it will make the rest of your data entry much faster. You need your script to extract the necessary data from a plain or rich text string. For example, take the following skill description:

HIDE

(DEX; ARMOR CHECK PENALTY)

Check: Your Hide check is opposed by the Spot...

First you will want to extract the name. Use for instance the func.GetLineNum function to return only the first line in the text. You can use func.Capital to capitalize only the first letter of each word.

Next you want to extract the skill's relevant ability. For this you need to extrat the second line, and keep only the first word, after the parenthesis.

Then there might be extra info after the ability – as in "Trained only" or "armor check penalty". You can use instr to search for these strings (watch out for case – you can use ucase to make all strings uppercase for comparison)

The description should be easy – textRTF is set for you, just assign it to the right member (like NewSkill.Desc).

For easy of use with the Custom Data Editor , you can set the item's source string to the name of the book from which your new element is taken (NewSkill.Source, NewSpell.Source, etc). That way it would be easy to delete all items of source X if there was a mistake.

You can use outputting to the combat log, or message boxes to help you in debugging.

The following variables are accessible (depending on the type of object selected):

         text: The plain text extracted between the separators. Any blank lines at the beginning or end have been trimmed.

         textRTF: The RTF text between the separators. Any blank lines at the beginning will have been trimmed.

         ForceCancel: Set to true (ForceCancel = true) to stop processing immediately. The latest item is NOT added. This might be useful in debugging your script.

         ForceSkip: Set to true (ForceSkip = true) to skip this particular item. This might be used to filter your data input, to add only feats corresponding to a certain criteria for example. Processing continues afterwards

         NewSkill or NewSpell: The object that will soon be added to the campaign's data.

         num: For feats: the feat number to use to modify the feat's parameters. You will use func.SetFeatParam to edit this feat. It will then be added (possibly at a different feat number) to the normal list of feats.

         num: For items: the item number to use to modify the item's parameters. You will edit the item using cr.SetItemStat. cr is just a dummy creature that temporarily holds the item. After creation the object is copied to the standard items list.

(Global Code) Section

This is a special section where you can enter any subroutines you will use in any of the other sections. You must define the functions with calls such as:

Sub MySubName(Argument1, Argument2)

...

End Sub

Function MyFunctionName(Args)

...

End Function

What about Races?

There is a separate feature for Automatic Race Creation – it is accessible in the race editor.

What about Classes? Templates?

Sorry, the descriptions of classes don't usually follow any regular format and so would be near impossible to script. It will probably be faster to enter the data manually than to try to script a reader.

For templates, the meat of the problem is in scripting it – there are basically only 4 fields: name, description, requisite code, and main code. DM Genie cannot write template scripts for you, sorry, even if you are running a HAL 9000!

Can I see the example code again?

If you changed the code for a type of entry, but want to get the sample code again, just remove your code entirely, click on a different entry in Type Of Data, and click back. The default code will be restored.





Documentation for DM Genie and Player Genie, page Bulk_Data. Copyright © Mad Scientist Studios, 2006.
Help Contents   |   DM Genie home page
Click here if you cannot see the table of contents on the left