Results 1 to 10 of 40

Thread: Command / key-press macros

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Crew Chief Mega Corp CEO mr_belowski's Avatar
    Join Date
    Feb 2017

    Command / key-press macros


    In the latest release we've added the ability to send sequences of key presses from the app to the game (PC only), in response to voice commands (or in a couple of special cases, triggered by events in the game). This is all a work in progress and has no pretty user interface - it's all driven by a configuration file.

    The app includes some common macros for Raceroom and ProjectCars2, but I expect the list to grow (a lot), so if there are any common sequences of key presses you're having to make to do stuff in-game these could be incorporated into the default macro configuration. Stuff like requesting a pit stop, selecting pit actions, etc.

    Here's the text from the help file, which explains it a bit more:

    Command macros
    The app can send sequences of key presses in response to voice command or some specific (hard-coded) in-game events. These can be used for anything you like, but their primary function is to ease the pain of navigating the awkward in-game pit menus. The app comes with a default set of command macros which (at the time of writing) are for PCars2 and Raceroom only. More will be added for other games. The default commands can be found in [install folder]/saved_command_macros.json. If you want to make your own, copy this file to a your Documents folder, in a subfolder called CrewChiefV4 (i.e. Documents/CrewChiefV4/saved_command_macros.json) and edit it as you like.

    The first thing you need to do is to update your key assignments in-game so they match the keys that the command macro will send.


    default key bindings:
    "Pit Menu Toggle": q
    "Pit Menu Select": e
    "Pit Menu Up": w
    "Pit Menu Down": s
    "Pit Menu Decrease": a
    "Pit Menu Increase": d
    "Pit Request Toggle": r
    "Real-time Chat": c

    Ensure that there's a least one Pitstop Preset defined (from the in-game pit menu).

    You can request a pit stop by saying "pit request", "in this lap" or "box this lap". This will open the pit menu, select 'pit request' and close it again after a few seconds delay. When you enter the pitlane the app will automatically open select 'confirm pit actions' from the pit menu so you don't have to fumble around.

    You can also cycle pit presets with the voice commands "next strategy", "next pit preset", "previous strategy", "previous pit preset".

    If you want to manually navigate the pit menu with voice commands, use "pit menu toggle", "pit menu up", "pit menu down", "pit menu left", "pit menu right" and "pit menu select".


    default key bindings:
    "Car Management": e
    "ICM Menu Up": w
    "ICM Menu Down": s
    "ICM Menu Left": a
    "ICM Menu Right": d
    "Pit Request Toggle": q
    "In-game Chat Box": t

    You can request a pit stop by saying "pit request", "in this lap" or "box this lap". This will open the pit menu, select 'pit request' and close it again.

    You can select strategies with the voice commands "strategy one" / "strat one", up to "strategy four" / "strat four".

    If you want to manually navigate the pit menu with voice commands, use "pit menu toggle", "pit menu up", "pit menu down", "pit menu left" and "pit menu right".

    Advanced command macros

    As you can see from the previous section, key press macros are complicated and a bit dumb - the app has no idea what state the pit menu is in so it has to either make lots of assumptions or work quite hard to put the menu into a known state.

    There are 2 macros for adding fuel. In both cases, for them to work in R3E the selected pit preset must have fuel *selected* (i.e. highlighted green). One uses the logic of the app's 'Fuel' event to calculate how much fuel is needed to finish the race ("fuel to the end" voice command), the other uses the amount of fuel requested in the voice command ("add fuel, 100 litres" or whatever). These macros opens the pit menu, navigate to the fuel option and attempt to reset it to zero litres. Because they can't know how much fuel might already be set on this menu they have to press the 'decrease' button lots (150) times. This ensure it's at zero before they then add the calculated or requested amount of fuel.

    *Note that these will only work correctly if you use Litres as your unit*.

    Another point to note here is that these fuelling macros press 'decrease' 150 times quite quickly to ensure the fuel amount is zero before they start increasing it. When things are configured correctly it works well, but it's a lot of key presses and if something goes wrong the end result may be undesirable.

    The macro feature can also be used to automate chat messages. There are examples for pCars2 and R3E. Again, these just send sequences of key presses.

    There are a few special key press commands in save_commands_macros.json to help ease the pain of wiring these things up. The "actionSequence" element is the list of key presses. These usually refer to action items in the keyBindings section at the top of the file. However, they can also be plain keys - e.g. [..., "a", "b", "c", ...].

    - To send a fixed number of multiple key presses use "{MULTIPLE,153}Pit Menu Decrease" (presses the Pit Menu Decrease key 153 times).
    - To send a number of multiplekey presses based on some app logic, use "{MULTIPLE,Fuel}ICM Menu Right" (presses ICM Menu Right however many times the Fuel event told it to). This requires specific application code to work but i'm happy to take requests .
    - To send a number of multiple presses based on the voice command that triggered the macro, the voice command needs to use a special format with the number range to recognise in curly braces - e.g. "add fuel, {1,150} litres" (recognises "add fuel 0 litres" up to "add fuel 150 litres", in steps of 1). Use "{MULTIPLE,VOICE_TRIGGER}Pit Menu Increase" to press (in this example) Pit Menu Increase the number of times recognised in the voice command.
    - To send a sequence of key presses from some free text, use "{FREE_TEXT}sorry, my bad". Each of the keys after {FREE_TEXT} will be pressed in sequence. Only letters, commas, hypens and full-stops are supported. This is to make chat macros more straightforward (e.g. ["Real-time Chat", "{FREE_TEXT}good pass", "ENTER"]).

    The file saved_commands_macros.json in your app's installation folder has examples of all this stuff and lots of comments that should further demystify the process. Alternatively just get the correct in-game key bindings and just use the stuff I've already configured.

    Hopefully the game devs will make these menus or the actions they trigger easier to use for 3rd party apps. But until they do, these complicated automated interactions are always going to be flaky.
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts