Hey, I'm trying to make refresher (very basic one) Using JavaScript, So I Can Install it in greasemonkey. My plan is to use it as a "Restock Refresher" Refreshes with between sec feature 7 - 12 sec. What I have is. Spoiler // ==UserScript== // @name Neopets : Refresher // @description Automatically refreshes a page // @include http://REPLACE.THIS.COM // ==/UserScript== // Minimum refresh time (in seconds) var refreshMin = 7; // Maximum refresh time (in seconds) var refreshMax = 12; setTimeout(function() { // Determine the number of seconds between min and max var randSpan = (refreshMax - refreshMin) + 1; // Random time between minimum and maximum var randTime = Math.floor(Math.random() * randSpan) + refreshMin; // Convert seconds to milliseconds var randTimeMS = randTime * 1000; window.setInterval('location.reload()', randTimeMS); return true; },0); dont work...
Javascript has a Math.random() function, which will return a random decimal number between 0 and 1. You can use this function to make a random number between two given ones: Code (Text): Math.prototype.rand = function (min, max) { return (max - min) * Math.random() + min; } Once you put this snippet in your code, just use Math.rand(6000, 12000) to generate a random number of milliseconds to wait between the two given values.
i'm planning to use it together... auto refresher every 7 - 12 sec then i use auto haggler to buy. =) yes? the reason, i would want to use auto refresher, is because... me myself, can't stop refreshing!!! lol...i refreshes every 2sec or 3 sec, thinking that i might have miss something... so, if i make it auto...that should stop me from refreshing too quick... also... i want to use it in magic shop...
lol i use auto haggler, and an auto refresher script that ricky helped me write heres what mine looks like: var SECOND = 1000 ; var MINUTE = 60 * SECOND ; var MIN = 2 var MAX = 6 var PERIOD = (MAX - MIN) * Math.random() + MIN * SECOND ; // random time between x - y seconds. Change MIN and MAX if you want it to refresh faster or slower. // refresh window.setTimeout( function() {window.location.reload() ;}, PERIOD); i'm working on adding a funtion where if it has more then 5 items, refresh between this, and less then 5 refresh alittle faster... but i can't seem to get it to work