python-sc2 icon indicating copy to clipboard operation
python-sc2 copied to clipboard

Update examples with do_actions

Open aatkin opened this issue 6 years ago • 2 comments
trafficstars

  • Update all examples to use await self.do_actions() instead of await self.do(), to encourage users to use the more performant (and futureproof) version

Additional thought: perhaps implement some way of deprecating self.do()?

aatkin avatar Dec 03 '18 14:12 aatkin

cyclone push is not building any units. I also got these errors:

ERROR:sc2.bot_ai:Error: ActionResult.NotSupported (action: UnitCommand(AbilityId.TERRANBUILD_BARRACKS, Unit(name='SCV', tag=4350279681), (141, 34), False))
ERROR:sc2.bot_ai:Error: ActionResult.NotSupported (action: UnitCommand(AbilityId.TERRANBUILD_BARRACKS, Unit(name='SCV', tag=4344512513), (141, 32), False))
ERROR:sc2.bot_ai:Error: ActionResult.NotSupported (action: UnitCommand(AbilityId.TERRANBUILD_BARRACKS, Unit(name='SCV', tag=4342415361), (137, 36), False))
ERROR:sc2.bot_ai:Error: ActionResult.NotSupported (action: UnitCommand(AbilityId.TERRANBUILD_BARRACKS, Unit(name='SCV', tag=4350279681), (141, 32), False))
ERROR:sc2.bot_ai:Error: ActionResult.NotSupported (action: UnitCommand(AbilityId.TERRANBUILD_BARRACKS, Unit(name='SCV', tag=4343726081), (141, 36), False))

In zerg_rush.py:

File "/python-sc2-update-examples/examples/zerg/zerg_rush.py", line 37
for queen in self.units(QUEEN).idle:
SyntaxError: invalid syntax

Probably a missing ) in every actions.append. Also:

File "/python-sc2-update-examples/examples/zerg/zerg_rush.py", line 87, in on_step
if not err:
NameError: name 'err' is not defined

tweakimp avatar Dec 19 '18 11:12 tweakimp

Partially fixed version available in branch do_actions. Still needs some fixes on error handling. I'm hoping to have them ready this week.

Dentosal avatar Jan 02 '19 04:01 Dentosal