Greasemonkey

This is intended to be a guide to Grease Monkey. This guide will cover installation of Grease Monkey, basic use and how it can be applied to BvS, and a couple of tips for making your own BvS Grease Monkey scripts. This is not a primer on Javascript or programming in general.

Grease Monkey FAQ

What is Grease Monkey?

Grease Monkey is a Mozilla Firefox add-on that allows you to customize webpages with small scripts written in Javascript. They can be as simple as changing the background color or image, to totally rewriting the page in a format you prefer.

Can I still use Grease Monkey if I don't use Firefox?

Yes you can. There are either plug-ins for the other browsers or they support User Scripts natively. There are some limitations though. The Greasemonkey functions can't be used in every browser. Though most of them can be emulated, the GM_xmlhttpRequest is problematic (it involves asking information from another server). The GM_set and GM_get functions should be replaced by localStorage which is a html5 standard that most browsers have already implemented. Note that Firefox, and possibly other browsers, have to have the option to use local storage turned on as it is turned off by default.

What can't Grease Monkey do?

If it can't be done in Javascript (for example, automatically printing a webpage) then it can't be done with Grease Monkey.

Where do I find Grease Monkey scripts to install?

Many, but not all, of the scripts written for BvS can be found at Userscripts.org. A more complete list can be found in the first post of the Grease Monkey Thread in the official Billy vs. SNAKEMAN Forum.

Does this have anything to do with the greassmonkeys team?

No.

Installation

Installing Grease Monkey in Firefox:

First go to Tools -> Add-ons. Then in the new Dialog box that just opened, click on the Get Add-ons tab. Next, do a search for "Grease Monkey". After search is done, click on the Add to Firefox button. Finally, after Grease Monkey is installed, restart your browser.

Installing a Grease Monkey script from a link:

Follow the link and click on the install script button in the dialog box that opens up. This is the simplest way to install a script.

Installing a Grease Monkey script from source code:

Go to Tools -> Greasemonkey -> New User Script. In the New user Script dialog box give the script a name and replace whatever is in the 'Includes (One per line) box with:

http://*animecubed.com/billy/bvs/PAGENAME

replacing PAGENAME with the file name of the page you want the script to affect (or a * if it is meant to affect all of BvS) and then hit OK. Your text editor of choice should open up with a few lines of code in it. Beneath the lines of code, paste the source code and save the script. Finally reload the page the script is suppose to affect by hitting the appropriate link in the BvS minimenu.

Things to keep in mind when writing your own Grease Monkey script:

  • There are two domains that can be used to play BvS, http://www.animecubed.com and http://animecubed.com. Keep in mind that someone using your script could be using either URL, so when defining which pages your script will affect, it is best to use http://*animecubed.com instead of one or even both of the previous URL domains.
    • Also keep in mind that the domain the end user is playing from affects the absolute URL of any files the page references (for example, image files). Be sure to keep that in mind when you code.
  • McMasters has requested that Grease Monkey script writers not do certain things with their scripts:
    • Do not autoload large numbers of pages (no writing a script to autoload the player look-ups of all your villagers, for example).
    • Do not reference other Anime Cubed pages with Greasemonkey script. This requires a bit of explanation:
      • Bad: Calling a second page for a variable or the like
      • Good: Storing a value from one page in memory as you're 'passing through' for use on a second page.
    • Do not mess with the CAPCHA.
    • A complete list of rules for BvS scripts can be found in the Greasemonkey Scripting Rules
  • If you do not have a webpage, and aren't interested in starting one, you can create an account on Userscripts.org and host your scripts there. Alternatively, you can simply post your source code on the official BvS forum.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License