Much Needed updates on the script

in
Subscribe to Much Needed updates on the script 2 posts, 2 voices



CaptBadd User
FirefoxWindows

1) Stops Hunting when Bait is Zero 2) Displays Staus in the Document title 3) In case of WSOD, Tries to refresh the page 4) Displays Bait count in the title bar
// ==UserScript==
// @name           Facebook - Ghost Trappers Smart Autohunt
// @namespace      Wr3cktangle, Edited by CaptBadd
// @description    A smart autohunt script for the Ghost Trppers Facebook App
// @include        http://apps.facebook.com/ghost-trappers/*
// @versions       1.4 Some features to stabilize the script 
// @versions       1.3 Updated code to find and parse out code value. GT switched to a d=XXX value. Hopefully script is now more resilient.
// @versions       1.2 Updated code to find and parse out c value (it's not always 3 numbers, d'oh) 
// @versions       1.1 Added handling for stopping refreshes when a captcha is detected. Changed error writing, misc comments.
// @versions       1.0 Initial Release
// @issues         Does Not hunt intially when already the lets hunt button is active
// ==/UserScript==


if(document.body.innerHTML.search(/captcha_image.php/) != -1)
{
  document.body.innerHTML = document.body.innerHTML + "

Ghost Trappers Smart Autohunt detected a captcha. Stopping refresh.


"; document.title ="Captcha Detected - " + document.title;; } else { //find where the timer call is made and where the c=XXX value is specified timerlocation = document.body.innerHTML.search(/topstarttimer\([0-9]{1,2},[0-9]{1,2}\)/); linklocation = document.body.innerHTML.search(/hunt.php\?[a-zA-z]+=[0-9]+/); whiskylocation = document.body.innerHTML.match(/app[0-9]{1,}_profile_whisky_quantity/); // get the quantity if(whiskylocation != null) { whiskyCount = document.getElementById(whiskylocation).innerHTML; document.title = "Bait:" + whiskyCount + " - " + document.title; } //In case of error make the count as available else { whiskyCount = 1; } if(timerlocation != -1 && linklocation != -1 && whiskyCount > 0) { //Parse out timer values in minutes and seconds //magic number: +8 includes all numbers and right parentheses guaranteed (i hope) call = document.body.innerHTML.substring(timerlocation + "topstarttimer(".length, timerlocation + "topstarttimer(".length + 8); minutes = parseInt(call.substring(0, call.indexOf(','))); seconds = parseInt(call.substring(call.indexOf(',') + 1, call.indexOf(')'))); //add 3-33 seconds onto refresh timer randomly (i hope) timeoutvalue = (minutes * 60 + seconds + Math.round((Math.random() * 30)) + 3) * 1000; //Parse out c=XXX value link = document.body.innerHTML.substring(linklocation + "hunt.php?".length, linklocation + "hunt.php?".length + 15); link = link.substring(0,link.indexOf("\"") - 1); //alert(timeoutvalue + "; " + link); setTimeout(function() {document.location = 'http://apps.facebook.com/ghost-trappers/hunt.php?' + link;} , timeoutvalue); } else if (whiskyCount <= 0) { //The Title Bar will show the Out of Bait, when no more bait is left document.title = "Out of Bait" + " - " + document.title; //Change Bait(Coming Soon) } else { //In case of WSOD, display Error on title bar and try to bring up GT home page document.body.innerHTML = document.body.innerHTML + "<br /><br />Ghost Trappers Smart Autohunt could not parse either the time or the link. Stopping refreshes. <br /><br /><br />"; document.title ="Error (Refreshing..)" + " - " + document.title; setTimeout(function() {document.location = "http://apps.facebook.com/ghost-trappers/index.php";},10000); } }
 
alvin tan User
FirefoxWindows

sorry your script didn't seem to work o.o

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel