Oracle is a tool for picking random items from a table.

  • By Script Wizards
  • Last update: Mar 27, 2023
  • Comments: 5

Oracle

 █▀▀▀█ █▀▀█ █▀▀█ █▀▀ █   █▀▀
 █   █ █▄▄▀ █▄▄█ █   █   █▀▀
 █▄▄▄█ ▀ ▀▀ ▀  ▀ ▀▀▀ ▀▀▀ ▀▀▀

Oracle is a tool for picking random items from a table.

demo

Installation

go install github.com/script-wizards/oracle

Usage

You can run oracle with no arguments and it will load up a Yes/No oracle.

You can create custom tables defined in YAML files. See examples. Pass the file path as an argument.

oracle random-events.yaml

Dice Notation

Put dice notation in curly braces, like There are {1d4} kobolds. The following formats are supported:

  • Standard
    • xdy[[k|d][h|l]z][+/-c]
    • Rolls and sums x y-sided dice, keeping or dropping the lowest or highest z dice and then adding or subtracting c.
    • Example: 4d6kh3+4
  • Fudge
    • xdf[+/-c]
    • Rolls and sums x fudge dice (-1 and 1), and then adding or subtracting c.
    • Example: 4df+4
  • Versus
    • xdy[e|r]vt
    • Rolls x y-sided dice, counting the number that roll t or higher.
  • Comparison
    • {xdy[<|>]t}
    • Rolls x y-sided dice, then compares the result to t. Useful for X-in-Y.
    • Example: 1d6<3 for 2-in-6

Download

oracle.zip

Comments(5)

  • 1

    Add option to return multiple outputs

    One use-case for room generation is to output 3 things for the user to draw their own connection. For example:

    Output:
    
    1. Spiders
    2. Fountain
    3. Tapestry
    

    Where each of these outputs are drawing from different tables (monster, feature, decoration).

  • 2

    Replace regex with linear search

    Regex is slower compared to built-in methods like Index. https://stackoverflow.com/questions/39908955/golang-regex-get-value-inside-parentheses

    We could do it in one pass, and enforce rules such as no nested curly brackets.

  • 3

    Word wrap status bar

    Small windows cannot display the full status bar. This is most troublesome when working with the stats.yaml example, or long entries.

    We may have to rewrite bubbles list. Or investigate the following bubbles:

    • https://github.com/76creates/stickers
    • https://github.com/treilik/bubbleboxer
    • https://github.com/treilik/bubblelister
    • https://github.com/elseano/dollop
  • 4

    Add way to open files from the program

    New users may not know how to pass filename argument to program. Consider adding an open file dialogue or support drag and drop.

    Currently, you can drag a file directly onto the executable on Windows. Need to test on other systems.

  • 5

    Reference other tables from an item

    We want the ability to chain tables. Should force lowercase.

    tables:
      Event:
        - "You find a pack. Inside, you find [items]."
      Items:
        - "{1d8}gp"
        - "a candle"