|
Size: 858
Comment:
|
Size: 816
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| Example on how to use information obtained from the travelinfo script command for use in variables. | |
| Line 2: | Line 3: |
| Example made by Romulus on how to use information otherwise obtained from the travelinfo script command for use in variables. | {{{ tr = "a:94k,t:2k,w:2k,s:2k" x = city.x + 20 y = city.y + 30 |
| Line 4: | Line 6: |
| tr = "a:94k,t:2k,w:2k,s:2k" x = city.x + 20 y = city.y + 30 |
targetId = GetFieldId(x, y) trBean = GetTroops(tr) attackTime = city.getTravelTime(city.fieldId, targetId, trBean, 5) transTime = city.getTravelTime(city.fieldId, targetId, trBean, 2) carryingLoad = city.getCarryingLoad(trBean) echo "Distance to " + city.coords + ": " + FormatDistance(city.fieldId, targetId) echo "Carrying load: " + carryingLoad echo "Attack time: " + round(attackTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(attackTime * 2)) echo "Reinforce time: " + round(transTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(transTime * 2)) }}} |
| Line 8: | Line 17: |
| targetId = GetFieldId(x, y) trBean = GetTroops(tr) attackTime = city.getTravelTime(city.fieldId, targetId, trBean, 5) transTime = city.getTravelTime(city.fieldId, targetId, trBean, 2) carryingLoad = city.getCarryingLoad(trBean) echo "Distance to " + city.coords + ": " + FormatDistance(city.fieldId, targetId) echo "Carrying load: " + carryingLoad echo "Attack time: " + round(attackTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(attackTime * 2)) echo "Reinforce time: " + round(transTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(transTime * 2)) |
|
| Line 18: | Line 18: |
| CategoryScriptingLanguage CategoryScriptingLanguage | ---- ScriptExamples |
Example on how to use information obtained from the travelinfo script command for use in variables.
tr = "a:94k,t:2k,w:2k,s:2k" x = city.x + 20 y = city.y + 30 targetId = GetFieldId(x, y) trBean = GetTroops(tr) attackTime = city.getTravelTime(city.fieldId, targetId, trBean, 5) transTime = city.getTravelTime(city.fieldId, targetId, trBean, 2) carryingLoad = city.getCarryingLoad(trBean) echo "Distance to " + city.coords + ": " + FormatDistance(city.fieldId, targetId) echo "Carrying load: " + carryingLoad echo "Attack time: " + round(attackTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(attackTime * 2)) echo "Reinforce time: " + round(transTime) + " secs, load: " + floor(carryingLoad - trBean.foodConsumption(transTime * 2))

![[+]](/moin_static/explorer/img/toggle1.png)

![[-]](/moin_static/explorer/img/toggle0.png)
