I don't know a thing about programming, but it doesn't sound like that difficult of a concept... Refreshes the page at random x to x intervals. Stops when some quantity on the page changes (such as the text saying the guard is sleeping / you have been allowed access) If you want exactly what it says, sunnyneo has it: http://sunnyneo.com/magmapets.php Maybe this is suited to a gm script?
This would be an awesome script/program if someone can get it to work! I'd definitely be downloading it seeing how I STILL haven't been able to get him to go to sleep >