Safe Haskell | None |
---|---|
Language | Haskell2010 |
This tool allows one to generate random names out of custom made syllable sets.
- newtype TCODNameGen = TCODNameGen {
- unTCODNameGen :: Ptr ()
- namegenParse :: FilePath -> TCODRandom -> IO ()
- namegenDestroy :: IO ()
- namegenGenerate :: String -> IO (Maybe String)
- namegenGenerateCustom :: String -> String -> IO (Maybe String)
- namegenGetSets :: IO (TCODList String)
Documentation
namegenParse :: FilePath -> TCODRandom -> IO () Source #
Parse a file with syllable sets
In order to be able to generate names, the name generator needs to be fed proper data. It will then be ready to generate random names defined in the file(s) it is fed. Syllable set parsing is achieved via the following.
Note 1: Each file will be parsed once only. If, for some reason, you would like to parse the same file twice, you will need to destroy the generator first, which will empty the list of parsed files along with erasing all the data retrieved from those files.
Note 2: The generator can be fed data multiple times if you have it in separate files. Just make sure the structure names in them aren't duplicated, otherwise they will be silently ignored.
namegenDestroy :: IO () Source #
Destroy name generator
:: String | Name. The structure name you wish to refer to, for instance, "celtic female". |
-> IO (Maybe String) |
Generating a default name
The following will output a random name generated using one of the generation rules specified in the syllable set: The name you specify needs to be in one of the files the generator has previously parsed (see Creating a generator). If such a name doesn't exist, a warning will be displayed and NULL will be returned.
namegenGenerateCustom Source #
:: String | Name. The structure name you wish to refer to, for instance, "celtic female". |
-> String | Rule. |
-> IO (Maybe String) |
Generating a custom name
It is also possible to generate a name using custom generation rules. This overrides the random choice of a generation rule from the syllable set. Please refer to tcod docs chapter 16.5 to learn about the name generation rules syntax.