I am using Tinderbox to organize my data around a tabletop RPG I am running for remote friends. One of the games uses a virtual tabletop that requires a specific text format for character sheets. I have an enormous body of character sheets that are more or less consistently formatted.
Is there a way using Tinderbox to parse all or part of these sheets automatically so that they are converted to the needed format? For example a way to make it so when I paste"Acrobatics (+12)" to a note and perform some operation, it changes the text to āAcrobatics +12ā. I can for sure manually apply some string manipulation to the text and do it myself, but if I could automate it, then I could ultimately figure out how to convert my existing data into the XML format used by the game. that would allow me to do mass imports of characters rather than copying and pasting section by section. But you gotta start somewhere.
Thereās quite a lot of support in Tinderbox for taking semi-structured text like
Acrobatics: 12
Aeronautic Engineering: 6
and extracting things to attributes like $Acrobatics. Once done, itās then easy to write agents for things like āAll characters who have good acrobatics and know how to repair an ornithopter." And itās easy to write export templates for the XML.
For simple formats, youāll want to check out [String].following(), which is limited but very easy to use. For more complex situations, consider regular expressions and [String].contains().
what might be useful is to see a sample of the source data youāre passing to Tinderbox and to understand how you are getting it into Tinderbox. Rather than paste big bits of text and then play regex games to find things, consider tab-delim/CSV input allowing you to map data directly to Tinderbox attributes.
For instance, if you made a table in the source app and had a column āAcrobaticsā, then you could make a Number-type user attribute Acrobatics and each row would store the Acrobatics column value as that notesā $Acrobatics. In the example you give, the value would be 12 but it could be -0.05 or such.
To see a noteās $Acrobatics, youād add the āAcrobaticsā attribute as a Displayed Attribute for the notes.
If the above appeals, donāt worry about doing it all right the first try. start with one or two columns and data of a few different types (numbers, text, lists boolean (true/false), etc.) and build out from that.
With a little experimentation you can circumvent the painful process of having everything in a noteās text ($Text) and having to excavate it with regex. There are lots of neat action code operators like the ones already suggested in 2Eastgateās answer (only some using regex).
Good luck and do come back with questions. Fine to start here, but if youāve a number of discrete questions it can be helpful (especially for later readers) if we explore them in separate trhreads with explanatory titles.
I havenāt had much time to play with this, for complicated plot reasons.
Probably will at some point though.
Now I am on to simpler tasks like trying to figure out how to use agents to add captions to images.
Captions where? alt text for HTML, captions under an image in an export template, somewhere else?
Iāf youāve a link to the XML format and small demo TBX file showing your starting info, with a note saying what in the TBX goes where in the XML and sure fellow users can help you out.
the General attribute category has an attribute called Caption, which was that I was talking about. I am playing around with how to present data to myself so I can easily find and identify a character, location, event, etc. I had been considering dragging an image for an NPC into the map and then using its caption to identify it. Then I realized it might be better to drag the image into the note text. Not sure if it is or isnāt, but the goal is to create an agent that will copy the name of the note to the Caption of the note.
But this is off topic I will create a new topic a little later.
My apologies, I misunderstood as your opening post implied an XML format was involved. No matter, we can help you with how to export an attribute (including $Text) into an XML value. However, it sounds like the first thing you need is the gameās file format otherwise youāre not much further forward. For instance, something like lists may need formatting using a particular delimiter, so it helps to know that; or are numbers stored as integers or with decimal places, etc. Perhaps the game has a forum where someone can point you to the gameās XML data storage format.