Enquirer Home Page | Twitter | Back to Improbable Island
 

Tips for Scripting

Getting started

Once you have Greasemonkey (or equivalent) installed, and some vague idea of what it is you want to do, it's mostly just googling how to do anything you want to do, and a lot of trial and error. If you're really stuck, try asking Banter, and see if anyone there knows what you should do.

Misc

Alright, let's get this straight first of all: the correct way to spell and capitalize the word is "Greasemonkey".

If you're modifying a script, you can (and should) replace all instances of GM_log with console.log.

If you improve a script significantly, you might add your name to the list of authors, or a note that the script was modified by you.

By pseudo-arbitrary convention, all scripts should have a name of the form "ii-some-words". Scripts should be hosted on the wiki in the greasemonkey namespace, in a page with the same name as the script. You can see a full list of pages in the greasemonkey namespace here.

Metadata

It's customary to include a metadata block in your script. Some of the lines in the metadata block influence how the script runs, like @match, and some are just for people reading the script, like @author.

Please include an @version line in your script, and increment some part of it when you change the script.1).

If you don't have a good namespace for your script, why not use http://enquirer.improbableisland.com/dokuwiki/doku.php?id=greasemonkey?

If you don't have a good icon for your script, why not use @icon https://improbableisland.com/favicon.ico?2).

Firefox will complain for a second if you don't include an ''@grant'' line. You probably want @grant none.

Chrome will make it sound scarier if you use @include instead of match. For this reason3), it is recommend to use @match *:*.improbableisland.com/* and @exclude *:enquirer.improbableisland.com/* if you want a script that just runs during the game.

Example Empty Script

Look at the source of this page in order to see how to set up a code block. You have to have a character after the first >, or else it won't give a download link!

ii-your-script
// ==UserScript==
// @name           ii-your-script
// @namespace      http://enquirer.improbableisland.com/dokuwiki/doku.php?id=greasemonkey
// @author         You!
// @description    This is my script!
// @version        1
// @match          *://*.improbableisland.com/*
// @exclude        *://enquirer.improbableisland.com/*
// @icon           https://improbableisland.com/favicon.ico
// @grant          none
// ==/UserScript==
1) Personally, I'm just using the format 1.X
3) mostly
 
Logged in as: Guest (Guest)
greasemonkey/scripting.txt · Last modified: 2017/06/07 00:37 by Full Metal Lion