Automatically grab flavor text snippets in Nisus
In Room description cards for players, I described handing out the flavor text on strips of paper after reading them when the player characters enter a “room”. In preparation for the possibility that they’ll be entering another room-oriented adventure soon, I made a script that will automatically pull all of the flavor text.
Pulling just the flavor text is easy in Nisus, since you can just put the cursor into some flavor text and then “Select All With Style” to get all text of that style in the document. But I also wanted whatever heading text happens to be above it, so that I get the room name as well (though I probably won’t hand that part to the players—I’ll let them name it themselves).
[toggle code]
- #Get all flavor text paragraphs and their headline
- $thisDocument = Document.active
- $flavorStyle = 'Player Description'
- $headingNameStart = 'Heading'
- $headingRange = Range.new 0, $headingNameStart.length
- $flavors = Array.new()
- $previousHeading = ''
- $currentHeading = ''
- #loop through all paragraphs
- Select Paragraph 1
- Select Start
-
While Select Next Paragraph
- $currentSelection = $thisDocument.textSelection
- $style = $currentSelection.typingAttributes
- $styleName = $style.paragraphStyleName
-
If $styleName.length > $headingNameStart.length
- $headingPart = $styleName.substringInRange $headingRange
-
Else
- $headingPart = ''
- End
- #store the current paragraph if it is flavor text
-
If $styleName == $flavorStyle
- #but first, store the current heading if we haven't already
-
If $currentHeading != $previousHeading
- $flavors.push $currentHeading
- $previousHeading = $currentHeading
- End
- $flavors.push $currentSelection.subtext
-
Elsif $headingPart == $headingNameStart
- #if this is a heading, save it for later
- $currentHeading = $currentSelection.subtext
- End
- End
- #open a new document with the flavor text
- $flavor = $flavors.join ''
- Document.newWithText $flavor
This should be saved in the Nisus “Macros” folder as something like “Cull Flavor Text”; once it’s there, it will be available under the Macros menu.
The script is pretty simple: it goes to the first paragraph and then selects every paragraph one by one. If the paragraph is flavor text, it stores it in the $flavors list; if the paragraph is a heading, it saves it for later, in case there is some flavor text underneath it. In my case, I use the style “Player Description” to style flavor text. You’ll need to adjust $flavorStyle in the code to be whatever your flavor style is.
Once it collects all of the player descriptions and their headings, it opens a new document with the stored flavor text, which I can style as normal in Nisus.
I’ve attached an example, using the flavor text I created for our group’s journey through Karl Merris’s Fell Pass.
- Broken Road Flavor Text (PDF File, 140.7 KB)
- Flavor text for my version of Karl Merris’s Fell Pass.
- Nisus
- I use Nisus Writer Pro for almost all of my new documents now. It’s a lot easier to use than the other word processors I’ve tried.
- Room description cards for players
- With open text adventures, room cards with each room’s flavor text are as easy as copy, paste, print, and cut.
More gaming tools
- First level calculations in Pocket Gods
- If you need to quickly calculate reactions and other numbers for a first level character, Pocket Gods can now do that for you.
- Roll20 and Gods & Monsters
- Roll20 appears to easily accept the Inkscape maps I’ve been creating for the various Gods & Monsters adventures
- hexGIMP for old-school wilderness maps
- The isoMage has a script and brushes for GIMP that make it easy to create old-school TSR-style outdoor maps.
- Constructing encounter tables using Nisus
- Here’s a Nisus Writer macro that makes it a little easier to create encounter tables.
- How to use hex maps
- Rob Conley describes the benefits and tricks of using hex maps.
- 13 more pages with the topic gaming tools, and other related pages
More Nisus
- Importing an index into Nisus
- Nisus makes it very easy to import an externally-generated index into a document.
- Text to image filter for Smashwords conversions
- Smashwords has very strange requirements for ebooks. This script is what I use to convert books to .doc format for Smashwords, including converting tables to images.
- Nisus HTML script now handles floating content
- My Nisus simple HTML publish script now handles floating images and floating text boxes.
- Lulu, Nisus, and Gods & Monsters
- Lulu is sometimes really annoying. But they usually get the job done. Nisus, on the other hand, is rarely annoying to use and always gets the job done.
- Nisus Writer Pro 2.0
- The new Nisus is pure awesome: very easy to use, and it does everything I need.
- Four more pages with the topic Nisus, and other related pages