Advertisement
RaythEvony

2 city lumber farmer

Dec 9th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. label autorun
  2. //-----Vars - change as needed------
  3. VALC = "xxx,yyy" //Valley coordinates
  4. TROOPS = ["a:50","a:100","a:200","w:1,s:1,p:1,sw:1,a:400,wo:1","w:1,s:1,p:1,sw:1,c:1,a:800,wo:1","w:1,s:1,p:1,sw:1,c:1,a:1600,wo:1","w:1,s:1,p:1,sw:1,c:1,a:3200,wo:1","wo:1,w:1,s:1,p:1,sw:1,a:8000,c:1,b:1,t:50","wo:1,w:1,s:1,p:1,sw:1,a:15000,c:1,b:10,t:50","wo:1,w:1,s:1,p:1,sw:1,a:19900,c:1,b:150,t:100"]
  5. HEROES = "any,!mayor,!trainer,!defender" //Exclude your poly and main training heroes here
  6. WAVES = 7 //Make sure you have same number of heroes free and not doing anything else
  7. CAPSECONDS = 4 //Number of seconds after the main hit lands to cap the valley - might vary by a few seconds
  8. CAPCITY = "771,89"
  9. label gettroops
  10. id = GetFieldId(VALC)
  11. lev = GetLevel(id)
  12. TRP = TROOPS[lev-1]
  13. //TRP = "wo:1,w:1,s:1,p:1,sw:1,a:32000,c:1,b:150,t:100"
  14. if (TRP == null) goto gettroops
  15. echo "Troops are: " + TRP
  16.  
  17. //-------Hit - dont touch these --------
  18. //GAP = round( (city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP), 5)) * 2 / WAVES + 2)
  19. echo "Start cap city."
  20. //Dummy = m_context.getCityManagerByFieldId(GetFieldId(CAPCITY)).script.callScript('call "capcity.txt"')
  21. sleep 2
  22.  
  23. label loop2
  24. GAP = round( (city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP), 5)) * 2 / WAVES + 2)
  25. if ( m_context.maintenanceStart > 0 ) goto sleepy
  26. execute "abandon " + VALC
  27. repeat 1
  28. execute "attack " + VALC + " " + HEROES + " " + TRP
  29. HITTIME = date().time + (city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP), 5) + CAPSECONDS) * 1000
  30. execute "sleep " + GAP
  31. loop loop2
  32.  
  33. label sleepy
  34. if ( m_context.maintenanceStart == 0 ) goto autorun
  35. sleep 65
  36. loop sleepy
  37. //------------ END OF MAIN CITY -------------------
  38.  
  39.  
  40. label autorun
  41. //~~~~~~~~~~~~~~Second City~~~~~~~~~~~~
  42. //-----Vars - change as needed-------
  43. TRP2 = "s:1"
  44. HEROES = "any"
  45. cityAcoords = "xxx,yyy" //These are the attacking city coords!!!
  46.  
  47. //--------Start - dont touch these -------------
  48. sleep 4
  49. label startfight
  50. myArray = []
  51. info = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
  52. GAP = info.GAP
  53. VALC = info.VALC
  54. HITTIME1 = info.HITTIME
  55. HITTIME = info.HITTIME
  56. GAP2 = city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP2), 5)
  57.  
  58. label loop1
  59. if ( m_context.maintenanceStart > 0 ) goto sleepy
  60. testVal = myArray.push(HITTIME)
  61. label check1
  62. if ( (date().time + GAP * 200 + GAP2 * 1000 + 10000) > HITTIME1) goto cycle
  63. execute "sleep " + GAP / 10
  64. loop check1 10
  65. info2 = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
  66. HITTIME = info2.HITTIME
  67. loop loop1
  68.  
  69. label cycle
  70. label checkvar1
  71. if ( (date().time + GAP2 * 1000 + 6000) > HITTIME1) goto loop2
  72. info2 = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
  73. if (HITTIME == info2.HITTIME) goto checkvar1
  74. HITTIME = info2.HITTIME
  75. testVal = myArray.push(HITTIME)
  76. SLEEP3 = (HITTIME1 - date().time) / 1000 - GAP2 - GAP / 10
  77. execute "sleep " + SLEEP3
  78.  
  79. label loop2
  80. if ( m_context.maintenanceStart > 0 ) goto sleepy
  81. HITTIME2 = myArray.shift()
  82. HIT_TIME = date(HITTIME2).toString().split(" ")[3]
  83. //echo "HIT_TIME is " HIT_TIME
  84. execute "abandon " + VALC
  85. repeat 2
  86. execute "attack " + VALC + " " + HEROES + " " + TRP2 + " @:" + HIT_TIME
  87. if $error && Starts($error.message, "Inappropriate camp time") @execute "attack " + VALC + " " + HEROES + " " + TRP2
  88. SLEEP2 = (HITTIME2 - date().time) / 1000 + GAP - GAP2 - GAP / 6.5
  89. //echo "SLEEP2 is " SLEEP2
  90. execute "sleep " + SLEEP2
  91. label checkvar2
  92. sleep 1
  93. info2 = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
  94. if (HITTIME == info2.HITTIME) goto checkvar2
  95. HITTIME = info2.HITTIME
  96. testVal = myArray.push(HITTIME)
  97. loop loop2
  98.  
  99. label sleepy
  100. id = GetFieldId(VALC)
  101. if (GetLevel(id) = 10) execute "attack " + VALC + " " + HEROES + " " + TRP2
  102. if (GetLevel(id) = 10) repeat 22
  103. if (GetLevel(id) != 10) execute "abandon " + VALC
  104. if (GetLevel(id) != 10) repeat 22
  105. if ( m_context.maintenanceStart == 0 ) goto autorun
  106. sleep 60
  107. loop sleepy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement