Modular chrome extension for the game screeps.com.
In your Chrome browser go to Settings -> Extensions -> Load unpacked extension... and select the Screeps-SC folder.
- Create a new javascript file under the
/modulesfolder. - Add these functions to your javascript file:
module.exports.init = function(){...}andmodule.exports.update = function(){...} - Add your module to the
modulesarray in thesettings.jsonfile.pathThe path to your javascript file.runAtParameter when your module will run. It has two child parametersonUpdateandonCompletedonUpdateThe 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.onCompletedThe 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.
optionsNot a required field. It is used to manage manual user configuration for the moduleimageThe path to an image to be displayed for the module in the settings pageconfigArray with configuration elements for the settings page
- Reload the plugin at
Settings -> Extensions -> Screeps SC -> Reload
The project includes some modules I've created. Click on an image below to see the source code.
Also take a look at the settings.json to see the module configuration.
- On browser startup the extension will start listening on requests made to and from
*://screeps.com/*. - When a url for a request starts with a given value in
onUpdateoronCompletedthe background thread will execute the modulepathconnected to theonUpdateoronCompleted. - The
content.jsscript will inject themodule.jsscript together with the executed module. The executed module can access any function in themodule.jsscript. Each module has their ownmodule.jsand it contains two module specific parametersmodule.nameandmodule.confg(if you have set up a config in thesettings.json). - If it's the first time the module is injected to the page session the
module.exports.initfunction will be called in the module. All otheronUpdateoronCompletedtriggers will call themodule.exports.updatefunction.






