ProcSentence is a simple but powerful library for procedurally generating grammatical English (for now) text from a list of text fragments, Noun objects, special tokens and random choice lists. It's designed to be easy to use for dynamic or procedural content, as in roguelikes (used in five so far.) Being small, it can be quickly ported to new languages.
sentence(["the", entity1, "^offers", "the", entity2, entity1, "'s", item, ".",
"the", entity2, "^accepts", "the", item])
-> "Joules offers you his cash. You accept it."
-> "Joules offers the shopkeeper his car keys. The shopkeeper accepts them."
-> "You offer the vending machine your banknote. The machine accepts the note."
It has so far been ported to (these versions are not in sync with each other):
- GDScript (for Godot)
- The most full-featured version
- Used in Slumber (2019 7DRL), Portlligat (unreleased 2020 7DRL), BattleTier Ascend! (2021 7DRL)
- Python 2
- Long out-of-date
- Used in Geiger AD '42 (2011 7DRL)
- C#
- WIP, untested
- Preprocessed HamsterSpeak (for the OHRRPGCE)
- Long out-of-date
- Used in Carcere Vicis
- Can't be used as-is; some accomplishing scripts aren't included, and currently requires use of the HamsterSpeak pre-processor. In future will be ported to standard HamsterSpeak once HS gains necessary features.