User Tools

Site Tools


greasemonkey:ii-100m

ii-100m

ii-100m.user.js
// ==UserScript==
// @name        ii-100m
// @description Plays 100 Mysteries based on your commands
// @author      Full Metal Lion
// @namespace   enquirer.improbableisland.com/dokuwiki/doku.php?id=greasemonkey:ii-100m
// @match       http://*.improbableisland.com/runmodule.php?module=hundredmysteries*
// @match       http://*.improbableisland.com/badnav.php*
// @icon        http://improbableisland.com/favicon.ico
// @version     1
// @grant       none
// ==/UserScript==
 
console.log('ii-100m reporting for duty!');
 
//define methods for interaction with the device
function press(action) {
  var link = document.querySelector('a[href^="runmodule.php?module=hundredmysteries&op=' + action + '"]');
  if(link){
    window.location.href = link.href;
    console.log("Following link:" + link);
  }
}
 
//determine state of the device
function count(picture) {
  pics = document.querySelectorAll('img[src^="images/hundredmysteries/' + picture + '"]');
  var n = 0;
  for (var i = 0; i < pics.length; i++) {
    if (pics[i].width != '0px') {n++;}
  }
  return n;
}
var o = {};
o['?'] = count('questionmarks');
o['X'] = count('lose');
o['W'] = count('wash');
o['2'] = count('double');
o['3'] = count('triple');
o['4'] = count('quadruple');
o['J'] = count('jackpot');
console.log(o);
 
////try to stop this crazy train at a certain number of pageloads:
////uncomment this block and the curly brace at the bottom in order to
////impose a pageload limit
//endr = /(\d*)\-\d+$/;
//times = endr.exec(window.location.href)[1]; //read from the url the number of times 100 Mysteries has been poked
//console.log(Taken this many actions so far:" + times);
//if (times < 1000){
  press('start'); //if possible, start a new game
  //YOUR CODE TO RUN EACH PAGELOADS HERE:
  //pass "start", "reveal", "upgrade", or "reject" to press() to follow a link.
  //pass the symbol you want to o[] to observe how many of them there are
  //the first observation will be 99 too many on all counts, for some reason
 
//}
greasemonkey/ii-100m.txt · Last modified: 2023/11/21 18:04 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki