3.3.2 • Published 6 years ago

screeps-interface v3.3.2

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
6 years ago

Usage

const api = new (require('screeps-interface'))(config)

//promises for all endpoints
api.me()
	.then(info=> console.log(info))
	.catch(err=> console.log(err))

//get, set
api.code('branch')
	.then(data=> console.log(data.branch, data.modules))
api.code('branch', {'main.js': 'stringified code'})
	.then(res=> console.log('uploaded code successfully')

//set console
api.console('shard0', 'console.log("test")')
	.then(res=> console.log(res))

//get all, get specific, set all
api.memory('shard0')
	.then(data=> console.log(data.data))
api.memory('shard0', 'creeps')
	.then(data=> console.log(data.data))
api.memory('shard0', undefined, {hi: 'everything is gone now'})
	.then(res=> console.log(res))

api.segment('shard0')
	.then(data=> console.log(data.data))
api.segment('shard0', 0, 'abc')
	.then(res=> console.log(res))
		
//socket listening
api.sub('console', msgs=>{
	console.log(msgs)
}).catch(e=>{throw e})
api.sub('cpu', cpu=>{
	console.log(cpu)
}).catch(e=>{throw e})
api.unsub({type: 'console'}).catch(e=>{throw e})
api.disconnect() // cleans up, also promise

See wiki for details.

Configuration

{
	"username": "will be undefined if not filled. Used for private servers only",
	"password": "will be undefined if not filled. Used for private servers only",
	"token": "authentication token. Public server only",
	"private": false,
	"protocol": "https or http (public or private respectively). You can override by filling it",
	"url": "screeps.com or 127.0.0.1 (public or private respectively). You can override by filling it",
	"port": "443 or 21025 (public or private respectively). You can override by filling it"
}

Private denotes private server. Private servers need an auth mod, like auth. If false will connect to normal/public screeps server using the token, which can be obtained on the official screeps website here.

3.3.2

6 years ago

3.3.1

7 years ago

3.3.0

7 years ago

3.2.0

7 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.15

8 years ago

3.0.14

8 years ago

3.0.13

8 years ago

3.0.11

8 years ago

3.0.10

8 years ago

3.0.9

8 years ago

3.0.8

8 years ago

3.0.7

8 years ago

3.0.6

8 years ago

3.0.5

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.2.1

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago