Biblyon the Great

This zine is dedicated to articles about the fantasy role-playing game Gods & Monsters, and other random musings.

Gods & Monsters Fantasy Role-Playing

Beyond here lie dragons

Automatically grab flavor text snippets in Nisus

Jerry Stratton, September 16, 2010

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.

  1. <- Morally unaligned
  2. Mental mismatch ->