How do I Select Commander

Discussion in 'Mod Discussions' started by warrenkc, June 26, 2014.

  1. warrenkc

    warrenkc Active Member

    Messages:
    542
    Likes Received:
    191
    Anybody know how I can perform the command to select the commander? I am working on a UI Mod that will select the commander and hopefully center the camera above it. Thanks ahead of time for any help.
    Javascript code:

    $(function() {
    $('body').append('<div id="locate_commander"><p>Select Commander</p></div>');

    var element = $('#locate_commander');
    element.click(selectCommander);

    function selectCommander() {
    element.html("Clicked");
    engine.call("holodeck.setCommanderId", msg.data.client.commander.id);
    }
    });
  2. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I think the Commander HUD mod includes that?

    Look at the select commander keybinding, or Autoselect Commander mod. Generally, api.select.commander and api.camera.track.

    This selects all commanders in a team army game. Judging from your code you've been looking at PTE, which I haven't really tested in that scenario.
  3. warrenkc

    warrenkc Active Member

    Messages:
    542
    Likes Received:
    191
    Thanks. That is helpful.
    I was thinking about adding a button above the ping button to select the commander. Any tips for that?
  4. Clopse

    Clopse Post Master General

    Messages:
    2,535
    Likes Received:
    2,865
    Doesn't pressing b do that?

    Awh maybe not what you are looking for.
  5. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    But this is the modding forum! Here we make simple things complicated just for fun.

    This is what inputmap.js does when you press 'b'
    Code:
            'select commander': input.doubleTap(api.select.commander, function () { api.camera.track(true); input.doubleTap.reset(); }),
    

Share This Page