my $lastx = -1; my $lasty = -1; while(1) { for(1..50) { click($buttonx, $buttony); } my $img = screenshot(); # Check idea lister my $ideasfound = findClickableStuff($img, $idealisterx, 'Idea lister', 1); if($ideasfound) { # Don't spend watts on thing maker when we still have ideas print "Still have ideas left!\n"; next; } # Check thing maker findClickableStuff($img, $thingmakerx, 'Thing maker', 1); }