Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- label autorun
- //-----Vars - change as needed------
- VALC = "xxx,yyy" //Valley coordinates
- 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"]
- HEROES = "any,!mayor,!trainer,!defender" //Exclude your poly and main training heroes here
- WAVES = 7 //Make sure you have same number of heroes free and not doing anything else
- CAPSECONDS = 4 //Number of seconds after the main hit lands to cap the valley - might vary by a few seconds
- CAPCITY = "771,89"
- label gettroops
- id = GetFieldId(VALC)
- lev = GetLevel(id)
- TRP = TROOPS[lev-1]
- //TRP = "wo:1,w:1,s:1,p:1,sw:1,a:32000,c:1,b:150,t:100"
- if (TRP == null) goto gettroops
- echo "Troops are: " + TRP
- //-------Hit - dont touch these --------
- //GAP = round( (city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP), 5)) * 2 / WAVES + 2)
- echo "Start cap city."
- //Dummy = m_context.getCityManagerByFieldId(GetFieldId(CAPCITY)).script.callScript('call "capcity.txt"')
- sleep 2
- label loop2
- GAP = round( (city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP), 5)) * 2 / WAVES + 2)
- if ( m_context.maintenanceStart > 0 ) goto sleepy
- execute "abandon " + VALC
- repeat 1
- execute "attack " + VALC + " " + HEROES + " " + TRP
- HITTIME = date().time + (city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP), 5) + CAPSECONDS) * 1000
- execute "sleep " + GAP
- loop loop2
- label sleepy
- if ( m_context.maintenanceStart == 0 ) goto autorun
- sleep 65
- loop sleepy
- //------------ END OF MAIN CITY -------------------
- label autorun
- //~~~~~~~~~~~~~~Second City~~~~~~~~~~~~
- //-----Vars - change as needed-------
- TRP2 = "s:1"
- HEROES = "any"
- cityAcoords = "xxx,yyy" //These are the attacking city coords!!!
- //--------Start - dont touch these -------------
- sleep 4
- label startfight
- myArray = []
- info = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
- GAP = info.GAP
- VALC = info.VALC
- HITTIME1 = info.HITTIME
- HITTIME = info.HITTIME
- GAP2 = city.getTravelTime(city.fieldId, GetFieldId(VALC), GetTroops(TRP2), 5)
- label loop1
- if ( m_context.maintenanceStart > 0 ) goto sleepy
- testVal = myArray.push(HITTIME)
- label check1
- if ( (date().time + GAP * 200 + GAP2 * 1000 + 10000) > HITTIME1) goto cycle
- execute "sleep " + GAP / 10
- loop check1 10
- info2 = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
- HITTIME = info2.HITTIME
- loop loop1
- label cycle
- label checkvar1
- if ( (date().time + GAP2 * 1000 + 6000) > HITTIME1) goto loop2
- info2 = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
- if (HITTIME == info2.HITTIME) goto checkvar1
- HITTIME = info2.HITTIME
- testVal = myArray.push(HITTIME)
- SLEEP3 = (HITTIME1 - date().time) / 1000 - GAP2 - GAP / 10
- execute "sleep " + SLEEP3
- label loop2
- if ( m_context.maintenanceStart > 0 ) goto sleepy
- HITTIME2 = myArray.shift()
- HIT_TIME = date(HITTIME2).toString().split(" ")[3]
- //echo "HIT_TIME is " HIT_TIME
- execute "abandon " + VALC
- repeat 2
- execute "attack " + VALC + " " + HEROES + " " + TRP2 + " @:" + HIT_TIME
- if $error && Starts($error.message, "Inappropriate camp time") @execute "attack " + VALC + " " + HEROES + " " + TRP2
- SLEEP2 = (HITTIME2 - date().time) / 1000 + GAP - GAP2 - GAP / 6.5
- //echo "SLEEP2 is " SLEEP2
- execute "sleep " + SLEEP2
- label checkvar2
- sleep 1
- info2 = m_context.getCityManagerByFieldId(GetFieldId(cityAcoords)).script.variables
- if (HITTIME == info2.HITTIME) goto checkvar2
- HITTIME = info2.HITTIME
- testVal = myArray.push(HITTIME)
- loop loop2
- label sleepy
- id = GetFieldId(VALC)
- if (GetLevel(id) = 10) execute "attack " + VALC + " " + HEROES + " " + TRP2
- if (GetLevel(id) = 10) repeat 22
- if (GetLevel(id) != 10) execute "abandon " + VALC
- if (GetLevel(id) != 10) repeat 22
- if ( m_context.maintenanceStart == 0 ) goto autorun
- sleep 60
- loop sleepy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement