# drink.sprak
Allows any drink programmed with it when drunk to:

* Set the location of things.
* Get the location of things.
* Get the names of things in a room.
* Set the numeric data of things, e.g., their cash balance, sleepiness, walking speed, etc.
* Copy or save any outputs.

## Usage
* May fail if the `supply` function supplies a function from the same modifier, since `Name()` is not used to check this.

The following global variables at the top of the program are intended to be set by the user:
### `MOVE_THESE`
Accepts an `string` representing a serialised `array` in the format:
```
{DESTINATION_THING:{"things":{0:THING_A,1:THING_B,...}},DESTINATION_ROOM:{"index":NATURAL_NUMBER,"things":{0:THING_C,1:THING_D,...}},...}
```
Representing:
* `DESTINATION_THING` - A `string` representing the name of a thing that things `THING_A`, `THING_B`, ... will be moved to.
* `THING_A`, `THING_B`, ... - `string`s representing the names of things that things that will be moved to `DESTINATION_THING`.
* `DESTINATION_ROOM` - A `string` representing the name of a room that things `THING_C`, `THING_D`, ... will be moved to.
* `NATURAL_NUMBER` - An integer `number` >= 0 representing the index of a thing in `DESTINATION_ROOM`.
* `THING_C`, `THING_D`, ... - `string`s representing the names of things that things that will be moved to the thing in `DESTINATION_ROOM` indexed by `NATURAL_NUMBER`.

The `"index"` attribute is optional and will default to `0` if unset.

#### Example
```sprak
string MOVE_DATA = '{"Sebastian_inventory":{"things":{0:"RustyModder",1:"Typer1Modifier",2:"Screwdriver_ScrewDriver"}}}'
```

### `WILL_TOGGLE_MODIFIER_COPY`
If set to `true`, drinking will toggle the `bool` value in memory accessed by the key `KEY_COPY_TARGET`, which determines if a modifier programmed with "modifier.sprak" will copy the name of its target.

### `WHATS_IN`
Accepts an `array` containing strings, each representing the name of a room. The names of the contents of these rooms are outputted after drinking.

### `WHERES`
Accepts an array containing strings, each representing the name of a thing whose current locations are outputted after drinking.

### `NUMERIC_DATA`
Accepts an `string` representing a serialised `array` in the format:
```
{THING:{DATA_POINT:NUMBER,...},...}
```
Representing:
* `THING` - A `string` representing the name of a thing whose numeric data will be set.
* `DATA_POINT` - A `string` representing a data point whose value will be set. Known valid values are "cash", "wellspring", "walkSpeed", "sleepiness", "corruption", "drunkenness", "smelliness", "charisma", "happiness", "supremacy".
* `NUMBER` - A `number` representing the  value that `DATA_POINT` will be set to.

After drinking, the value of `NUMERIC_DATA` will be saved to memory, to be accessed by servers programmed with "server.sprak" which will use the value to set the data every tick of their main loop.
#### Example
```sprak
string NUMERIC_DATA = '{"Sebastian":{"cash":999,"walkSpeed":10,"sleepiness":0,"wellspring":10,"corruption":0,"drunkenness":0,"smelliness":0},"Babcia":{"supremacy":9001}}'
```

### `COPYING`
If set to `true`, causes outputs to be copied to the clipboard after drinking.

### `SAVING`
If set to `true`, causes outputs to be saved after drinking.

### `KEY_COPY_TARGET`
A `string` representing the key used to access the memory value determining whether a modifier programmed with "modifier.sprak" will copy its target.

### `KEY_NUMERIC_DATA`
A `string` representing the key used to access the memory value determining the values that a modifier programmed with "server.sprak" will set.

### `KEY_SAY`
A `string` representing the key used to access the memory value that will store the outputs of the program.

## Functions
### Imports
* serde.sprak
	* `deserialise`
* equality.sprak
* array.sprak
	* `has`
* types.sprak
	* `Left`
	* `Right`
* supply.sprak
	* `supplier_of`
	* `supplier_of_unwrapped`
	* `supply`
	* `supply_unwrapped`

## TODO
* Handle invalid inputs for `get_things_in`.
* Return early if any results are left/errors.