aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 3612ef71d15f151dcdb1136e623eefdc395b255b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# ywot-clean

A reconstructed version of `ywot-bot` built off of clean programming principles and a minimal, but fast API.

## Getting Started

To download and run this library, install node.js and npm, if you haven't already, and run:
```bash
git clone https://github.com/feynmansfedora/ywot-clean.git
cd ywot-clean
npm i
node examples/helloworld.js # To try out the hello world (read the code for more detail)
```

## Features

Currently, `socket.js` provides `Socket` which has a few signals and functions (documented in the code, of course) which allow abstracted interfacing with YWOT. However, certain facilities available in the old version like queuing or fetch division were scrapped in favor of more direct limits due to the unmaintainability of the old style.

`space.js` provides some dense spatial data management with `Space`, which is really good for specific dialogs and tests, but constructs like `tools/search.js` are more useful for storing world updates.

`examples/helloworld.js` can get you started. Everything in the core API (`socket.js`, `space.js`) should be pretty stable, but please don't hesitate to report a bug.

## Bugs

Doesn't work with Unicode, somewhat. I think when "astral planes" are involved, it starts to get really buggy, so don't expect it to work when non-BMP characters are involved, even just as part of the world. This is a node issue, not an issue with this specific library, but it can be annoying to deal with. There's also a chance that this is a "just on my machine issue," so take my warning with a grain of salt.

## Directory Structure

Top-level scripts are part of the core API: `socket.js` and `space.js` are pretty portable and abstract a lot of the ugly parts of yourworldoftext (like 8x16 tiles).

Then, `examples/` provides use cases for it. `helloworld.js` is a basic "Hello World" printer, `spam.js` spams one message without attempting to conserve bandwidth, and `jarvis.js` provides the most advanced example (responds to the word `jarvis` by overwriting it with `yes, my liege`, but is capable of much more complex behavior).

`tools` and `utils` are similar to eachother in that they aren't very useful on their own, but are mostly distinct tools from the core API or user-facing scripts. The main difference is complexity: `tools` is reserved for complex (often persistent) utilities like `search` and `utils` for simple one-off functions like vector arithmetic, a min/max calculator for an array of coordinates, or helper tools for `space.comb`. They have been primarily motivated by attempts to discretize `examples`.