Powerhoof! PowerText...


Code for generating randomized lines of text

 
Quite a few times I’ve found myself writing code to mash together a few strings randomly for games. Inspired by some sweet generated text stuff @eigenbom‘s been doing for his game Moon Man, I thought I’d write a tool to make this easy to do.

Features

  • Quick and simple way of generating a randomized lines of text for a variety of purposes.
  • Chuck some simple rules in a text file and use PowerText to generate random lines.
  • Lightweight, easy to use code. Just 2 function calls really.
  • Automatically handles some simple language things like capitalizing first letter of sentence, and converting “a” to “an” where necessary.
  • Simple handling of plurals– mark numbers in your text with [#], and then plurals of words like so: “cat[s], leech[es], goose[/geese]”.
  • Add weighting for certain options by adding [weight] at the start of a line (eg: “[50]common housefly”, “[0.1] rare dodo”).
  • Insert variables from code eg “You have [numLives] life[/lives] remaining.”

There’s fancier things out there that do the same thing and more, but if you want something really quick, lightweight and easy to use this might do the trick!

Get it

comment...