Modular chrome extension for the game https://screeps.com/
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
icons Initial release Dec 16, 2016
modules
options
LICENSE
README.md
background.js
content.js
manifest.json
module.js
settings.json

README.md

Screeps-SC

Modular chrome extension for the game screeps.com.

Installation

In your Chrome browser go to Settings -> Extensions -> Load unpacked extension... and select the Screeps-SC folder.

Create your own module

  1. Create a new javascript file under the /modules folder.
  2. Add these functions to your javascript file: module.exports.init = function(){...} and module.exports.update = function(){...}
  3. Add your module to the modules array in the settings.json file.
    • path The path to your javascript file.
    • runAt Parameter when your module will run. It has two child parameters onUpdate and onCompleted
      • onUpdate The module will run when a screeps site has loaded a page that starts with the given value in this setting. For more information see google API for onUpdated.
      • onCompleted The module will run when any screeps webrequest is completed that starts with the given value in this setting. For more information see google API for onCompleted.
    • options Not a required field. It is used to manage manual user configuration for the module
      • image The path to an image to be displayed for the module in the settings page
      • config Array with configuration elements for the settings page
  4. Reload the plugin at Settings -> Extensions -> Screeps SC -> Reload

Samples

The project includes some modules I've created. Click on an image below to see the source code.

Alliance map Detailed market history Overview for resources See GCL bar for any player Detailed leaderboard Console macros Enemy creep names Battle radar

Also take a look at the settings.json to see the module configuration.

How it works

  1. On browser startup the extension will start listening on requests made to and from *://screeps.com/*.
  2. When a url for a request starts with a given value in onUpdate or onCompleted the background thread will execute the module path connected to the onUpdate or onCompleted.
  3. The content.js script will inject the module.js script together with the executed module. The executed module can access any function in the module.js script. Each module has their own module.js and it contains two module specific parameters module.name and module.confg (if you have set up a config in the settings.json).
  4. If it's the first time the module is injected to the page session the module.exports.init function will be called in the module. All other onUpdate or onCompleted triggers will call the module.exports.update function.

FAQ