Greasy Fork is available in English.

Critter Auto Script

Basic Script to Automate Critter Mound

  1. // ==UserScript==
  2. // @name Critter Auto Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.9.6
  5. // @description Basic Script to Automate Critter Mound
  6. // @author You
  7. // @match https://crittermound.com/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. var first, mother, father;
  14.  
  15. var main = function() {
  16. if (game.femaleMound().length > 0) {
  17. first = game.femaleMound()[0];
  18. mother = game.mother();
  19. console.log("Queen:");
  20. console.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue + " = " + (first.traits[0].trueValue > mother.traits[0].trueValue).toString());
  21. console.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue + " = " + (first.traits[1].trueValue > mother.traits[1].trueValue).toString());
  22. console.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue + " = " + (first.traits[2].trueValue > mother.traits[2].trueValue).toString());
  23. console.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue + " = " + (first.traits[3].trueValue > mother.traits[3].trueValue).toString());
  24. console.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue + " = " + (first.traits[4].trueValue > mother.traits[4].trueValue).toString());
  25. if (first.traits[0].trueValue > mother.traits[0].trueValue && first.traits[1].trueValue > mother.traits[1].trueValue && first.traits[2].trueValue > mother.traits[2].trueValue && first.traits[3].trueValue > mother.traits[3].trueValue && first.traits[4].trueValue > mother.traits[4].trueValue) {
  26. game.Move("Mate", "Female", game, game)
  27. console.log("New Queen");
  28. } else {
  29. if (Math.random() >= 0.5) {
  30. if (game.maxArmyMoundSize() > game.armyMound().length) {
  31. game.Move("Army", "Female", game, game)
  32. console.log("New Female Army");
  33. } else {
  34. console.log("To many Army")
  35. }
  36. } else {
  37. game.Move("Worker", "Female", game, game)
  38. console.log("New Female Worker");
  39. }
  40. }
  41. }
  42.  
  43. if (game.maleMound().length > 0) {
  44. first = game.maleMound()[0];
  45. mother = game.father();
  46. console.log("King:");
  47. console.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue + " = " + (first.traits[0].trueValue > mother.traits[0].trueValue).toString());
  48. console.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue + " = " + (first.traits[1].trueValue > mother.traits[1].trueValue).toString());
  49. console.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue + " = " + (first.traits[2].trueValue > mother.traits[2].trueValue).toString());
  50. console.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue + " = " + (first.traits[3].trueValue > mother.traits[3].trueValue).toString());
  51. console.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue + " = " + (first.traits[4].trueValue > mother.traits[4].trueValue).toString());
  52. if (first.traits[0].trueValue > mother.traits[0].trueValue && first.traits[1].trueValue > mother.traits[1].trueValue && first.traits[2].trueValue > mother.traits[2].trueValue && first.traits[3].trueValue > mother.traits[3].trueValue && first.traits[4].trueValue > mother.traits[4].trueValue) {
  53. game.Move("Mate", "Male", game, game);
  54. console.log("New King");
  55. } else {
  56. if (Math.random() >= 0.5) {
  57. if (game.maxArmyMoundSize() > game.armyMound().length) {
  58. game.Move("Army", "Male", game, game)
  59. console.log("New Male Army");
  60. } else {
  61. console.log("To many Army")
  62. }
  63. } else {
  64. game.Move("Worker", "Male", game, game)
  65. console.log("New Male Worker");
  66. }
  67. }
  68. }
  69.  
  70. if (game.princeMound().length > 0) {
  71. first = game.princeMound()[0];
  72. mother = game.prince();
  73. console.log("Prince:");
  74. console.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue + " = " + (first.traits[0].trueValue > mother.traits[0].trueValue).toString());
  75. console.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue + " = " + (first.traits[1].trueValue > mother.traits[1].trueValue).toString());
  76. console.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue + " = " + (first.traits[2].trueValue > mother.traits[2].trueValue).toString());
  77. console.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue + " = " + (first.traits[3].trueValue > mother.traits[3].trueValue).toString());
  78. console.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue + " = " + (first.traits[4].trueValue > mother.traits[4].trueValue).toString());
  79. if (first.traits[0].trueValue > mother.traits[0].trueValue && first.traits[1].trueValue > mother.traits[1].trueValue && first.traits[2].trueValue > mother.traits[2].trueValue && first.traits[3].trueValue > mother.traits[3].trueValue && first.traits[4].trueValue > mother.traits[4].trueValue) {
  80. game.Move('MateYoung','Prince', game, game);
  81. console.log("New Prince");
  82. }
  83. else {
  84. game.Move('Recycle','Prince', game, game);
  85. // if (Math.random() >= 0.5) {
  86. // if (game.maxArmyMoundSize() > game.armyMound().length) {
  87. // game.Move("Army", "Male", game, game)
  88. // console.log("New Male Army");
  89. // } else {
  90. // console.log("To many Army")
  91. // }
  92. // } else {
  93. // game.Move("Worker", "Male", game, game)
  94. // console.log("New Male Worker");
  95. // }
  96. }
  97. }
  98.  
  99. if (game.princessMound().length > 0) {
  100. first = game.princessMound()[0];
  101. mother = game.princess();
  102. console.log("Princess:");
  103. console.log("Trait 1: " + first.traits[0].trueValue + " > " + mother.traits[0].trueValue + " = " + (first.traits[0].trueValue > mother.traits[0].trueValue).toString());
  104. console.log("Trait 2: " + first.traits[1].trueValue + " > " + mother.traits[1].trueValue + " = " + (first.traits[1].trueValue > mother.traits[1].trueValue).toString());
  105. console.log("Trait 3: " + first.traits[2].trueValue + " > " + mother.traits[2].trueValue + " = " + (first.traits[2].trueValue > mother.traits[2].trueValue).toString());
  106. console.log("Trait 4: " + first.traits[3].trueValue + " > " + mother.traits[3].trueValue + " = " + (first.traits[3].trueValue > mother.traits[3].trueValue).toString());
  107. console.log("Trait 5: " + first.traits[4].trueValue + " > " + mother.traits[4].trueValue + " = " + (first.traits[4].trueValue > mother.traits[4].trueValue).toString());
  108. if (first.traits[0].trueValue > mother.traits[0].trueValue && first.traits[1].trueValue > mother.traits[1].trueValue && first.traits[2].trueValue > mother.traits[2].trueValue && first.traits[3].trueValue > mother.traits[3].trueValue && first.traits[4].trueValue > mother.traits[4].trueValue) {
  109. game.Move('MateYoung','Princess', game, game);
  110. console.log("New Princess");
  111. }
  112. else {
  113. game.Move('Recycle','Princess', game, game);
  114. // if (Math.random() >= 0.5) {
  115. // if (game.maxArmyMoundSize() > game.armyMound().length) {
  116. // game.Move("Army", "Male", game, game)
  117. // console.log("New Male Army");
  118. // } else {
  119. // console.log("To many Army")
  120. // }
  121. // } else {
  122. // game.Move("Worker", "Male", game, game)
  123. // console.log("New Male Worker");
  124. // }
  125. }
  126. }
  127. };
  128.  
  129. function workerCode() {
  130. this.onmessage = function (event) {
  131. }
  132.  
  133. var time = 500;
  134. setTimeout(function () { Tick() }, time);
  135.  
  136. function Tick() {
  137. postMessage("Tick");
  138. setTimeout(function () { Tick() }, time);
  139. }
  140. }
  141.  
  142. var blob = new Blob([
  143. "(" + workerCode.toString() + ")()"
  144. ], {type: "text/javascript"});
  145.  
  146. // Note: window.webkitURL.createObjectURL() in Chrome 10+.
  147. var worker = new Worker(window.URL.createObjectURL(blob));
  148. worker.onmessage = function (e) {
  149. main();
  150. };
  151. worker.postMessage("hello"); // Start the worker.
  152.  
  153. })();