Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/screepers/screeps-multimeter
The most useful tool on your screeps workbench.
https://github.com/screepers/screeps-multimeter
screeps
Last synced: 4 months ago
JSON representation
The most useful tool on your screeps workbench.
- Host: GitHub
- URL: https://github.com/screepers/screeps-multimeter
- Owner: screepers
- License: mit
- Created: 2016-12-22T16:04:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-08-06T16:19:21.000Z (over 1 year ago)
- Last Synced: 2024-10-01T02:47:51.833Z (4 months ago)
- Topics: screeps
- Language: JavaScript
- Size: 1.06 MB
- Stars: 89
- Watchers: 8
- Forks: 28
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- stars - screepers/screeps-multimeter
README
[![NPM version](https://nodei.co/npm/screeps-multimeter.png?downloads=true)](https://nodei.co/npm/screeps-multimeter/)
# screeps-multimeter
Multimeter is a hackable console for the game [Screeps](https://screeps.com/). It lets you access your Screeps console without loading up the full website (and as a result lets you play Screeps for much longer on a single battery charge), and is hackable with plugins.![screenshot of main interface](doc/screenshot.png)
Features:
- Terminal (command line) program, no browser or GUI required.
- Send console commands from the program.
- Rich console output formatting.
- Add plugins to get new functionality.## Installation
```
npm install -g screeps-multimeter
multimeter
```## Configuration
Multimeter now uses the [screeps unified credentials file](https://github.com/screepers/screepers-standards/blob/master/SS3-Unified_Credentials_File.md), as used by [screeps-api](https://github.com/screepers/node-screeps-api).
Example `.screeps.yaml` config file:
```
servers:
main:
host: screeps.com
secure: true
token: '00000000-0a0a-0a00-000a-a0000a0000a0'
ptr:
host: screeps.com
secure: true
path: '/ptr'
token: '00000000-0a0a-0a00-000a-a0000a0000a0'
season:
host: screeps.com
secure: true
path: '/season'
token: '00000000-0a0a-0a00-000a-a0000a0000a0'
private:
host: 127.0.0.1
port: 21025
secure: false
username: bob
password: password123
configs:
multimeter:
plugins: []
aliases: {}
logFilename: 'multimeter.log'
```### Environment Variable
You can also set `SCREEPS_TOKEN` as an environment variable instead of adding the token in the yaml file. If set, the token from the yaml file will take precedence over the environment variable.
This can be useful if you want to commit your `.screeps.yaml` to a repo, but don't want your TOKEN exposed.
### Connecting to the official server
You will need to create a [Screeps API token](http://docs.screeps.com/auth-tokens.html) and update the config as appropriate.
### Connecting to a private server
To enable access to your own private server you will need to set up [screepsmod-auth](https://github.com/ScreepsMods/screepsmod-auth) and create a password. The username may be your username or email address, depending on the mod settings.
## Usage
The main interface has a command line on the bottom. Type `/help` to see a list of the available commands. Type `/quit` to exit the program.
## Colors and Formatting
Console coloring and formatting is made possible by [blessed's tags](https://github.com/chjj/blessed#content--tags). Some of the tags you can use are:
- `{color-fg}` - Change the foreground color.
- `{color-bg}` - Change the background color.
- `{bold}, {underline}, {blink}, {inverse}, {invisible}` - Apply the character style.
- `{/style}` - Stop using the given style, e.g. `{/bold}`.
- `{/}` - Reset to normal characters.
- `{|}` - Align the rest of the line to the right.Colors can be specified as a name, e.g. red, blue, yellow, cyan (see [colorNames from blessed](https://github.com/chjj/blessed/blob/eab243fc7ad27f1d2932db6134f7382825ee3488/lib/colors.js#L312) for a complete list), or as a hex code, e.g. `#ffff00`.
## Plugins
To add additional plugins, add them to a `plugins` array in your config file:
```
configs:
multimeter:
plugins: ["./plugins/myCustomPlugin"]
```Multimeter ships with the following plugins enabled by default:
### Plugin: Alias
The alias plugin can be used to easily store and access commonly used console commands. Create a new alias by using `/alias NAME COMMAND`. Now, `/NAME` will automatically expand to `COMMAND`. For example, this alias will let you list all damaged creeps by typing `/damagedCreeps`:
```
/alias damagedCreeps _.filter(Game.creeps, (c) => c.hits < c.hitsMax)
/damagedCreeps
```Aliases can also take parameters. There will be available in variables like `$1`, `$2`, etc. The entire passed string is available as `$args`. For example:
```
/alias hitsLeft "Creep " + $1 + " has " + Game.creeps[$1].hits + " hits left"
/hitsLeft Ryan
```### Plugin: Watch
The watch plugin will log an expression to your console on every tick. To install it, copy [watch-client.js](lib/watch-client.js) to your script and add some code to your `loop` function:
```
var watcher = require('watch-client');
exports.loop = function() {
// Rest of your code...watcher();
};
```There are two ways to watch expressions. You can log it to the console normally by using `/watch console EXPR`. You can also log to a status bar at the bottom of the screen using `/watch status EXPR`. For example, `/watch status _.keys(Game.creeps).length` will keep a count of the number of live creeps at the bottom of the terminal.
The watch plugin will be automatically enabled for all shards with assigned CPU > 0.
### Plugin: HTML
The HTML plugin allows you to style the log output using the 'style' attribute of HTML tags. It converts the values for the style attributes to the relevant blessed tags. It should work with any html tags, though has only been tested with `