Code: Select all
//imacros-js:showsteps no
var sleep = 5; //seconds to sleep beetween each egg set
var phrases = ["This egg smells faintly like brine",
"This egg gleams with a reddish shine",
"This egg is very reflective",
"This egg shimmers like gold",
"This egg has icicles forming on it",
"This egg is almost too hot to touch",
"This egg gives off a beautiful glow",
"Whenever you go near this egg your hair stands on end",
"This egg looks like it doesn't belong",
"Oh my. There is a Leetle Tree among the eggs",
]; //you can edit phrases
var location = "http://dragcave.net/locations/3";
var eggsfound=0;
do {
var macro;
macro = "CODE:";
macro += "URL GOTO="+ location+ "\n";
var iret = iimPlay(macro);
if (iret==-101)Abort();
for (var i=1;i<=3;i++)
{
//click on egg
var macro;
macro = "CODE:";
macro += "SET !TIMEOUT_TAG 2" + "\n";
macro += "TAG XPATH = \"(//div[text()[contains(.,\\\""+phrases.join("\\\") or contains(.,\\\"")+"\\\")]]/a)["+i+"]\"" + "\n";
var iret = iimPlay(macro);
if (iret==-101)Abort();
//click Back if egg was found and clicked
if (iret>0)
{
var macro;
macro = "CODE:";
macro += "BACK" + "\n";
iimPlay(macro);
eggsfound++;
iimDisplay(eggsfound)
}
else {
break;
}
}
iimDisplay(eggsfound)
var macro;
macro = "CODE:";
macro += "WAIT SECONDS=" + sleep + "\n";
var iret = iimPlay(macro);
if (iret==-101)Abort();
iimDisplay(eggsfound)
}
while (true);
function Abort()
{
throw "Aborted by user"
}