# screeps-stats

> Script to enhance stats collection for screeps-stats

Latest version **0.1.7** (published 2016-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install screeps-stats
pnpm add screeps-stats
yarn add screeps-stats
bun add screeps-stats
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2016-08-07 |
| First published | 2016-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Screepers |
| Maintainers | aphistic |
| Keywords | screeps, stats |

## Links

- npm: https://www.npmjs.com/package/screeps-stats
- npm.io page: https://npm.io/package/screeps-stats

## Recent versions

- 0.1.7 (latest) — 2016-08-07
- 0.1.6 — 2016-08-04
- 0.1.5 — 2016-08-04
- 0.1.4 — 2016-08-04
- 0.1.3 — 2016-08-04
- 0.1.2 — 2016-08-04
- 0.1.1 — 2016-08-04
- 0.1.0 — 2016-08-04

## README

# Screeps Stats Library

This is a Javascript library created to enhance the [Screeps](http://www.screeps.com) stats acquired with
the [screeps-stats](https://github.com/screepers/screeps-stats) project.

By default `screeps-stats` will ingest the console and performance data (cpu and memory size).

With the addition of this client side (in game, TypeScript or Javascript) module additional statistics, including
custom stats, can be added.

When the stats collection service picks stats up from the server it will erase them, so as long as the service
is running only a few ticks worth of data will be stored. If the stats service fails, stats will be collected
for up to 20 ticks, at which point the oldest data will be removed.

## Authors

* Original Javascript version by Robert Hafner <tedivm@tedivm.com>
* TypeScript port by Erik Davidson <erik@erikd.org>

## Installation

The easiest way to use this software is via npm:
```
npm install --save screeps-stats
```

## Usage

A note about the examples below: It's important for the `ScreepsStats` class to get assigned to `global.State`, as the stats collection
server will use this class to delete ticks that it has finished processing.

TypeScript example:
```typescript
import {ScreepsStats} from "screeps-stats";
global.Stats = new ScreepsStats();

module.exports.loop = function() {
    
    // Do code stuff!

    // Run Stats Last.
    Stats.runBuiltinStats();
}
```

Javascript example:
```javascript
var stats = require('screeps-stats')
global.Stats = new stats.ScreepsStats()

module.exports.loop = function () {

  // Do code stuff!

  // Run Stats Last.
  Stats.runBuiltinStats()
}
```

---
_Source: https://npm.io/package/screeps-stats · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
