[REL] Headlight controls

Discussion in 'Other' started by Seven Smiles, Aug 20, 2019.

  1. Jamilton

    Jamilton Registered

    Joined:
    Jun 15, 2017
    Messages:
    19
    Likes Received:
    11
    Even running as administrator, the manual flash function did not work. Pitlane flashing still works fine. Should I try running the debug version?
     
  2. davehenrie

    davehenrie Registered

    Joined:
    Jul 6, 2016
    Messages:
    2,917
    Likes Received:
    1,677
    can you take a screenshot of the app running? So we can see how your buttons are configured.
     
  3. Jamilton

    Jamilton Registered

    Joined:
    Jun 15, 2017
    Messages:
    19
    Likes Received:
    11
    Images of the app when in the pitlane and on track are provided. H key for headlight toggle, Left Control for flash. I had also tried F and some other keys, as well as the * key on my USB keypad, but to no avail.
     

    Attached Files:

  4. davehenrie

    davehenrie Registered

    Joined:
    Jul 6, 2016
    Messages:
    2,917
    Likes Received:
    1,677
    The left ctrl option to flash your lights may be the problem. 'leftctrl' is used in conjunction with other commands. Try picking an unused single key or button on your controller.
     
  5. Jamilton

    Jamilton Registered

    Joined:
    Jun 15, 2017
    Messages:
    19
    Likes Received:
    11
    I just tried setting it to G there, still no effect.
     
  6. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    785
    Likes Received:
    849
    Note that I’m on holiday until next week and can’t investigate this problem.
     
    Jamilton likes this.
  7. Sanchit Rathi

    Sanchit Rathi Registered

    Joined:
    Jan 22, 2020
    Messages:
    43
    Likes Received:
    18
    Hello I hope you had a nice holiday, I too am having the same issue as Jamilton, the pit lane flash is working, but not the button. If you have time could you please look into it? Thank you very much for this mod
     
  8. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    785
    Likes Received:
    849
    Now that I look properly I think the problem is that @Jamilton has used the same control (Keyboard H) for the Player Toggle and the rFactor Toggle. They're two different things, when you press the Player Toggle control it operates the rFactor Toggle key to change the headlight state in game. If they're the same then my program will send its "fake" H just after rFactor sees the real H from the keyboard. The outcome is a probably undefined, I'll try it out tomorrow.

    Though Left Ctrl should still flash the headlights...
    :confused: I don't know how much testing I did with using the keyboard for Player Headlight Controls, I designed the program thinking of using controller buttons to operate the headlights.
     
    Last edited: Feb 21, 2020
    Sanchit Rathi likes this.
  9. Sanchit Rathi

    Sanchit Rathi Registered

    Joined:
    Jan 22, 2020
    Messages:
    43
    Likes Received:
    18
    Thank you for your swift reply, Attached are the settings being used for the app by me, I have used F key to toggle headlights instead of H in player control, however pressing F does not turn on the headlight, furthermore I tried using LCTRL and APOSTROPHE as my flash headlight key, it didnt work either. Not sure why this is happening. Only error I got since i have run the app was the controller.json file error. I fixed that in the ini by specifying the location for the controller.json. Your help will be greatly appreciated.
    headlight settings 1.png
     
  10. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    785
    Likes Received:
    849
    OK, I have an answer. You may not like it! Keyboard events are only occurring when Headlights has focus, if rFactor has focus (the game is running) only game controller buttons generate events. So Headlights works when I use it with Flash headlights mapped to a button on the £5 game controller I use as a "button box". Headlights shouldn't let you map a keyboard button as that doesn't work.

    I remember a similar problem in another of my programs which was caused by having the GUI to configure things running at the same time as the code which handles the running game so I may be able to fix it by splitting Headlights into two but there's only one way to find out and I won't promise when I might be motivated to try it.
     
    Jamilton likes this.
  11. Sanchit Rathi

    Sanchit Rathi Registered

    Joined:
    Jan 22, 2020
    Messages:
    43
    Likes Received:
    18
    Hi, thank you very much for the detailed reply, sorry for my delayed response but i do have a steering wheel so ill give it a shot on the buttons over there and get back to you.
     
  12. RoWo

    RoWo Registered

    Joined:
    Jul 16, 2014
    Messages:
    312
    Likes Received:
    364
    Hi! Using this tool for a while now and like it. Last weekend I had an endurance race with driver swap and realized, that the tool doesn't work after taking over the car control.
    Can you please check this?
     
  13. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    785
    Likes Received:
    849
    I've never done a driver swap. I guessed where the problem would be (identifying which of the vehicles is the one the player is driving) but it's not that, it is evaluated every time data is read. Did you check if the Toggle headlight button worked? That's the only one that doesn't care whether the headlights are on or not. I'll investigate, I have other changes to make anyway.
     
  14. Kahel

    Kahel Registered

    Joined:
    Jun 6, 2020
    Messages:
    6
    Likes Received:
    6
    Looks like an interesting tool.
    I tried to accomplish the same with a tool made for flight simulator that allowed advanced mapping and tweaking.
    Could easily make the flash function and other interesting stuff but it was a pain to map it to my button box with always on, always off toggles... at least with rf2 it wasn't working well... so I gave up.

    Will definitively give your tool a try. Thanks for sharing.
     
    Last edited: Jun 7, 2020
  15. Bidle

    Bidle Registered

    Joined:
    Jul 13, 2019
    Messages:
    36
    Likes Received:
    20
    Thank you so much, works for me as a charm.
    Only now looked at a flashing solution after watching some of the VEC 24h Lemans. Before I just used the headlights button to flash.
     
  16. Bor S

    Bor S Registered

    Joined:
    May 5, 2020
    Messages:
    5
    Likes Received:
    0
    Seven, like your work, did install it and it works for a part.
    When I and in the pits and drive on the limiter the lights flashes.
    But there is a issue with the controls. The keyboard key works only with switching light on and off (maybe that is the game ), but I cannot get any keys to work, not on the keyboard and not on the controller.
    Did add the controller path to the headlight control config file.
    Run the debug file, and got a lot of info, but do not know how to fix the problem. Would appreciate you help.
     

    Attached Files:

  17. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    785
    Likes Received:
    849
    You have keyboard keys mapped to the headlight functions, they have to be controller buttons something like this
    headlightControls.jpg

    You can use keyboard (V in your case) or a controller button in rFactor but for now at least this program only uses controller buttons.

    Thanks for the files, it makes it easier to see the problem.
     
  18. Bor S

    Bor S Registered

    Joined:
    May 5, 2020
    Messages:
    5
    Likes Received:
    0
    Seven, thank you for your fast response.

    There are 2 problems:
    -The lights in game are on V, as they are in your program. Switching on and off works fine.
    But the flash button C does not work.
    Automatic flashing in Pits works fine.

    - I tried to set the flash key to the controler (Logitech G29) but the program does not responde when I push a button on the controler (when I am programming the button). Like it does not "see" the controler. headlight contols a .png hin is on
     
  19. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    785
    Likes Received:
    849
    OK, that's what you should be doing. I know it works because I have a G25 and I was using that when I wrote this program. (FYI the V key is only working "inside" rFactor, neither V nor C are being used by Headlights.)
    I'm working on the program now so I'll add some extra debug to get more information about your controller. The program has grown since I first wrote it so I am re-writing some of the logic which has got a bit messy so I can't promise a new version quickly.
     
    Corti and atomed like this.
  20. Bor S

    Bor S Registered

    Joined:
    May 5, 2020
    Messages:
    5
    Likes Received:
    0
    Seven, thank you, I will be using it as it is now. Already better than without the program.
    Will be keeping track of this topic, and try your new version when you are able to produce it. Keep on the good work.
     

Share This Page