Giter Club home page Giter Club logo

screeps-sc's Introduction

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.

screeps-sc's People

Contributors

stybbe avatar screeps-moria avatar tedivm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.