This is intended to be a guide to GreaseMonkey. This guide will cover installation of GreaseMonkey, basic use and how it can be applied to BvS, and a couple of tips for making your own BvS GreaseMonkey scripts. This is not a primer on Javascript or programming in general.
Table of Contents
|
GreaseMonkey FAQ
What is GreaseMonkey?
GreaseMonkey 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 GreaseMonkey 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 GreaseMonkey do?
If it can't be done in Javascript (for example, automatically printing a webpage) then it can't be done with GreaseMonkey.
Where do I find GreaseMonkey 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 GreaseMonkey Thread in the official Billy vs. SNAKEMAN Forum.
Does this have anything to do with the GreassMonkeys team?
No.
Installation
Installing GreaseMonkey 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 "GreaseMonkey". After search is done, click on the Add to Firefox button. Finally, after GreaseMonkey is installed, restart your browser.
Installing a GreaseMonkey 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 GreaseMonkey 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:
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 GreaseMonkey 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 GreaseMonkey 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.