api.select.idleFabber();

Discussion in 'Mod Discussions' started by ohnimus, March 10, 2014.

  1. ohnimus

    ohnimus New Member

    Messages:
    23
    Likes Received:
    3
    api.select.idleFabber();
    api.unit.build( '/pa/units/land/bot_factory/bot_factory.json', 1, false );

    i think it fails because of no target sleection (hear the sound)
    so howto target ? circular/area/metal and filter ?
  2. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    I didn't think this was possible unless the unit is currently on screen. Also, keep in mind that you are selecting all idle fabbers on the current planet.
  3. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    If you execute the code you posted like that the 2nd line will fail because selections are an asynchronous process.
    So the first line commands the client to do a selection and the client will report back to the js layer selection handler once the selection has been made. That can take a few milliseconds. So you can't directly do the 2nd line, it needs to be somewhere in the selection handler.

Share This Page