Page 1 of 2 12 LastLast
Results 1 to 10 of 21

Thread: Command / key-press macros

Hybrid View

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

    Command / key-press macros

    Guys,

    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.




    Raceroom


    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


    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.


    If you get a drive through or stop-go penalty, the app will automatically open the pit menu and select 'serve penalty', and close it again. When you then enter the pitlane it'll automatically confirm that action. So you don't need to do anything to serve a drive through other than enter the pitlane (at the right speed of course).


    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".




    PCars2


    default key bindings:
    "Car Management": e
    "ICM Menu Up": w
    "ICM Menu Down": s
    "ICM Menu Left": a
    "ICM Menu Right": d


    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 make lots of assumptions. I've added another macro that can request the correct amount of fuel to finish the current race, triggered with the voice command "fuel to the end", "fuel to the end of the race". It works by calculating the recent fuel consumption and working out how many more litres are needed to finish. It then presses a few keys to move the pit menu to the refuel amount and presses the 'increase' key the correct number of times.

    This will only work if the pit menu is in the correct state to begin with. Otherwise the app will be pressing lots of keys and potentially selecting lots of unwanted stuff in the pit menu. So be careful here.

    For this to work in Raceroom, the app requires that the game is configured to use metric measurements (gallons are silly). The default pit preset must be configured with one of the preset fuel amounts added ("safe" / "normal" / "risky"). It's essential that the fuel option is green (selected) in this strategy (otherwise the app won't be able to set a fuel amount). Like this:



    For this to work in pCARS2, the app requires that the game is configured to use metric measurements (gallons are silly). The selected pit preset must have no fuel added (0 litres).


    Note that once you've executed this macro, the in-game pit menu will have a fuel amount selected that's some number of litres. This means the menu will be in a state where the macro can't be run again. In Raceroom this is easy enough to remedy - you just need to select the default pit preset again. In pCARS2 there's no sensible workaround.

    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  

  2. #2
    Junior Member Paul Bee's Avatar
    Join Date
    Dec 2017
    Posts
    2
    I need help to understand this please.

    I'm a sim racer of 'more mature years' and have, until now, restricted my racing activities to the PS4 platform, most notably with the original Project Cars and Crew Chief on an Android device. However, with some rather disappointing 'issues' in the new Project Cars release, I've made the move to a PC platform within the past 2 weeks and am currently in the middle of a very steep learning curve.

    I downloaded Raceroom and have even managed to get Crew Chief set up..... The next phase, when December 25th comes along, will be my first venture in to VR and so I have read your post on voice commands with great interest.

    Do I need to install and set up voice command software? Voice Attack or somesuch? I'm running Windows 10 which I believe has a voice command function. Should I spend time learning setting this up and when done, will I be able to adopt your voice command functions?

    Any help would be much appreciated.

    Thanks
    Paul

  3. #3
    Crew Chief Mega Corp CEO mr_belowski's Avatar
    Join Date
    Feb 2017
    Posts
    1,042
    Crew Chief voice recognition uses Microsoft Speech Recognition. This is *not* the same as Windows Speech Recognition. To use voice recognition with Crew Chief, you need to install the recognition engine:

    https://www.microsoft.com/en-gb/down....aspx?id=27225

    and then install a speech recognition language pack:

    https://www.microsoft.com/en-gb/down....aspx?id=27224


    that's all you need to do - no training or anything. You mic needs to be the default audio recording device.

  4. #4
    Junior Member Paul Bee's Avatar
    Join Date
    Dec 2017
    Posts
    2
    Thank you. I'll look in to it.

  5. #5
    Junior Member
    Join Date
    Dec 2017
    Posts
    3
    Mr. Belowski-
    I wanted to be able to send messages in Assetto Corsa text chat using speech, so I forked the repository to find out how I could add that behavior. I thought GrammarBuilder.AppendWildcard() [or maybe DictationGrammar and SetDictationContext] might let me grab any text following some initial marker phrase (e.g., "Say "), and then I could use SendKeys() to send the keystrokes to AC.

    This was until I found saved_command_macros.json

    Is the design of saved_command_macros flexible enough to allow me to send arbitrary words as keystrokes to AC?
    Last edited by Danny; 02-17-2018 at 02:07 AM.

  6. #6
    Crew Chief Mega Corp CEO mr_belowski's Avatar
    Join Date
    Feb 2017
    Posts
    1,042
    The speech recognition engine is grammar based, not trained. It's not designed to recognise free speech - you have to limit the stuff it listens for otherwise the search space becomes too big and it gets very unreliable.

    If there is a fixed list of chat messages you want to send, then that can be done with saved_command_macros.

    If you want free diction here, you'll need to integrate the windows built in speech recognition engine

  7. #7
    Junior Member
    Join Date
    Feb 2018
    Posts
    3
    Hi my friend. Love your app.

    I used DRE before but yours is much better. I also donated so uou can continue to enhance and aupport it. :]

    One question related to macros. I use iracing and need to program 2 commands via voice or wheel button

    1) tear off(to clean my visor). Default iracing keys are alt+t
    2) trigger whipers. Default iacing is ctrl+shift+w

    How do i do that in crew chief

  8. #8
    Crew Chief Mega Corp CEO mr_belowski's Avatar
    Join Date
    Feb 2017
    Posts
    1,042
    If you need to assign an action to a key-combination (alt-t or whatever), CC doesn't (yet) support that. The macros are single-key press only.

    If you want to reconfigure iRacing so your tear-off is triggered by, say, just the 't' key, you'd need to add this key to the iRacing key bindings:

    Code:
    {
            "description": "iRacing command mappings - these are the key assignments in the Options -> Controls",
            "gameDefinition": "IRACING",
            "keyBindings" : [
            {
                "action": "Lap Timing Black Box",
                "key": "F1"
            },
    .....
                   {            "action": "Tear off",
                "key": "KEY_T"
            }

    and then make a macro in the 'macros' section:

    Code:
    {
            "name": "Tear off",
            "description": "Presses T",
            "voiceTriggers": [ "tear off" ],
            "commandSets": [
            {
                "description": "iRacing only",
                "gameDefinition": "IRACING",
                "actionSequence": [ "Tear off" ],
                "keyPressTime": 10,
                "waitBetweenEachCommand": 200
            }]
        },
    .....
    Last edited by Sparten; 03-01-2018 at 04:17 PM.

  9. #9
    Junior Member
    Join Date
    Feb 2018
    Posts
    3
    Thanks a million.

    It's almost there.

    I rather not change the default since it's used across multiple of my apps...

    I can wait. Your app is getting better and better...for now, I am running voice attack simultaneously to send a few extra commands...

  10. #10
    Junior Member
    Join Date
    Feb 2018
    Posts
    2
    I've attempted to add the "tear off" comand like the example above, it kinda works but doesn't actually do the tear off.
    I have the "T" key configured in options to do the visor tear off.
    Thanks for any help of what I've done wrong, details are below\

    Jay

    When I start Crew Chief I get this
    Code:
    17:41:00.523 : Loading user-configured command macros from Documents/CrewChiefV4/ folder
    17:41:00.716 : Action Tear off not recognised
    17:41:00.720 : Loaded 17 macro voice triggers into the speech recogniser
    then when I say "tear off" I get
    Code:
    17:58:53.887 : recognised : tear off confidence = 0.9245504
    17:58:53.895 : Sending actions Tear off
    so it "works" I think, but the visor tear off does not occur in iRacing

    what I've configured in my json file
    Code:
    {
    		    "action": "Tear off",
    			"key": "T"
    		},
    
    .....
    and the macro part
    Code:
    	{
            "name": "Tear off",
            "description": "Presses T",
            "voiceTriggers": [ "tear off" ],
            "commandSets": [
            {
                "description": "iRacing only",
                "gameDefinition": "IRACING",
                "actionSequence": [ "Tear off" ],
                "keyPressTime": 10,
                "waitBetweenEachCommand": 200
            }]
        },
    Last edited by jtfreels; 02-28-2018 at 11:58 PM.

Page 1 of 2 12 LastLast

Posting Permissions

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