roll

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2018 License: MIT Imports: 11 Imported by: 0

README

Roll is a simple template rendering utility geared towards random text generation.

Usage

Roll provides extensive help on invocation:

> roll -h
Usage:
  roll FILE [flags]

Flags:
  -h, --help        help for roll
  -s, --seed SEED   random number generator SEED (default 1516223506)

Example Input

template = """
1D100: {{roll "1d100"}}
Coin: {{random .coin}}

AW move
  1D{{.aw.Total}}: {{random .aw}}
  2d6: {{roll "2d6" | pick .aw}}
"""

[tables]
coin = [
    "head",
    "tail",
    ]

aw = [
    "6:miss",
    "3:hit",
    "3:strong hit",
    ]

Example Result

> roll example.toml
1D100: 73
Coin: tail

AW move
  1D12: miss
  2d6: hit

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	Template templ            `toml:"template"`
	Tables   map[string]table `toml:"tables"`
}

Record describes one template and corresponding weighted tables.

func ReadFile

func ReadFile(name string) (Record, error)

ReadFile parses template and tables out of a TOML file.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL