Skip to content

Commit

Permalink
add discord commands and some examples of prompt syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jun 4, 2024
1 parent 1c36bc8 commit dd9e63b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ please check out to [the documentation folder](./docs).
Detailed guides are available for:

- [admins](./docs/guides/admin.md)
- [players](./docs/guides/player.md)

## Contributing

Expand Down
1 change: 0 additions & 1 deletion docs/guides/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ python3 -m taleweave.main \
--optional-actions \
--actions taleweave.systems.sim:init_actions \
--systems taleweave.systems.sim:init_logic
# TODO: add others
```

This will generate a relatively small world with 3 rooms or areas, run for 30 steps, then save the game and shut down.
Expand Down
42 changes: 41 additions & 1 deletion docs/guides/player.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,62 @@

- [Player's Guide to TaleWeave AI](#players-guide-to-taleweave-ai)
- [Contents](#contents)
- [Discord Command Syntax](#discord-command-syntax)
- [Prompt Syntax](#prompt-syntax)
- [Prompt Function Syntax](#prompt-function-syntax)

## Discord Command Syntax

*Note 1:* Because TaleWeave AI offers a dynamic set of actions depending on the game world, it does not currently use
Discord's command feature. If you know a way to make this work with constantly-changing actions, please let me know.

*Note 2:* When interacting with the Discord bot, you need to ping it with each message. Your server admin can allow the
bot to see all messages, with and without pings, but you must ping the bot by default.

The Discord bot offers the following commands:

- `!taleweave` or the bot name, if your admin changed it
- prints the name of the active world
- `!help`
- prints the available commands and their parameters
- `!join <character>`
- join the game as the specified character
- `!leave`
- leave the game, if you are playing
- `!characters`
- list the available characters in the game
- `!players`
- list the players currently in the game

Other messages will be treated as in-character input and used as your character's action or reply, depending on the
current prompt.

## Prompt Syntax

The web client displays a menu with all of the available actions on your turn, but you can also input your own actions.

### Prompt Function Syntax

In order to call functions or use actions from your prompt replies, you (or more likely your GUI) can send valid JSON,
or you can use this prompt function syntax.
or you can use this prompt function syntax. Discord and the web client both support this syntax.

To use the prompt function syntax, start your prompt with `~` and use the syntax `~action:parameter=value,next=value`
where `action` is the name of the action (the function being called) and the remainder are parameters to be passed into
the function.

For example:

```none
~action_move:direction=north
~action_tell:character=Alice,message=Hello
~action_use:item=potion
```

There are some limits on this syntax:

- the function name cannot contain `:`
- this is true in Python as well and should not be a problem
- the parameter names cannot contain `=`
- this is also true in Python and should not be a problem
- the values cannot contain `,`
- this is a problem and support for quotes is needed

0 comments on commit dd9e63b

Please sign in to comment.