Control Value Not Changing On Key Press

Discussion in 'Creation Centre' started by nasvrick, Jul 3, 2023.

  1. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    Hello,

    I'm trying to change a control value with a key press. I want the B key press to swith the CVSwitchBatterie to 1. (Then later LOVE + B to reset the control value to 0, its initial value)

    I have uploaded the input mapper and the main engine blueprint file as attached files.

    Thank you!
     

    Attached Files:

  2. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    Hi,

    after renaming .txt to .xml I have opened both files in BPE. Few things...

    InputMapper definition for B key is wrong. With button pressed down you´re increasing control start, but with button released you are decreasing control start. So even if you have defined your button as "PushAndHoldButton", B key in released position starts to decrease control value of associated controler, namely CVSwitchBatterie. So it will be always set to 0 when B key is released and will behave as a normal "PushButton".

    I suggest to change "DecreaseControlStart" to "IncreaseControlStop". This way when you release B key, controler CVSwitchBatterie should stay in position, as there´s no any input to set it back to 0. And put both sensitivities (analog and digital) to higher numbers, so the button will safely get to value 1, when you release B key, and won´t stay between 0 and 1 ;) I use to use numbers between 40 - 60.

    As there´s no script attached, it´s hard to tell about the rest of it.
     
    • Helpful Helpful x 1
  3. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    Hi,

    Thank you for your answer!

    I forgot to add the script files, oups ;)
    I guess there is a problem there too as, even with the modification you suggest, it is still not working.
    As you can see, I'm not sure what to put where ;)
     

    Attached Files:

    Last edited: Jul 5, 2023
  4. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    I need to know what do you mean by LOVE + B.

    Also, you do not need to use two scripts with almost the same code. Usually, the one that belongs to simulation, is just a minimalistic one. The second, attached to main engine blueprint is the one responsible for loco behavior.

    Btw, you have literally nothing in those scripts, so no wonder nothing is working right now :D
     
    Last edited: Jul 5, 2023
  5. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    I don't know why it replace Shift by LOVE xD
     
  6. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    Ah, ok. Shift it is then.

    Here are the files. Try it if it works. I hope so.
     

    Attached Files:

    Last edited: Jul 5, 2023
    • Helpful Helpful x 1
  7. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    Unfortunately, it is still not working.
     
  8. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    Must it be a button?? I see you have not animation attached to it. Is it just virtual controler??
     
  9. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    In the real train, I think it is a lever to switch on the battery and a button on a screen to switch it off.
    As the "high resolution" cabine is in progress, I used a virtual controller (no animation, no link to a "real" action in the cab) to try to understand how to make the system work in TS.
     
  10. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    Ok, and what happens when you switch that lever off?? Will go battery off as well, like when you push the button on display? Is that lever self-adjustabe, means will it return to 0 position, when you release it?? If you provide me enough info, I can prepare it for you. Btw, will you consider your loco as an expert one? Because control settings may depend on it. All my locos have the same InputMapper associated for all control levels - simple, intermediate and expert in engine blueprint.
     
    Last edited: Jul 6, 2023
  11. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    Well, I was wrong it seems: the switch on is via a push bouton which return to a neutral position after press.
    The extinction is via a button around a screen.
    The aim is to provide a as realistic as possible Régiolis (https://en.wikipedia.org/wiki/Régiolis) which will be open source, so yes, I guess it can be called as expert one. The "stop and go" InputMapper will not be used, if possible.
    The external 3D is there and the work just begun with the 3D cabine.
    I don't know what you need to know ?

    Again, thank you for your answers, all are very helpful!
     
  12. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    So if I understood it correctly, one button is switching battery ON, and another one on the screen is switching battery OFF. Am I correct?? If so, it needs two button controlers and one which will represent battery itself. Easy to do, with little scripting.

    Just confirm if I get it correcty or if I´m wrong.
     
    Last edited: Jul 6, 2023
  13. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    Yes, this is correct
     
  14. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    Ok, I will make that for you. In a few days... Sorry, minutes :)
     
    Last edited: Jul 6, 2023
  15. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    Thank you very much!
     
  16. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    Ok, here it is. Just rename it, export and try it. Do not forget to set the control type to Expert...

    It should work as follows - press B to switch batteries ON, and then press C to switch batteries OFF. Two buttons pressed at the same time does nothing, or at least should do nothing. Script is written very fast, so there may be mistakes, but overall it should work, if you export it properly.
     

    Attached Files:

    Last edited: Jul 6, 2023
    • Helpful Helpful x 1
  17. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    I do not know where the problem is but it is still not working :(
    I made an "export with references", tried the files. As it what not working, I tried an "forced export with references" and it still the same thing...
     
  18. kiski

    kiski Member

    Joined:
    Apr 27, 2018
    Messages:
    92
    Likes Received:
    58
    Something must be wrong on your side then. This is so simple, just two buttons, and one Batterie controler, nothing more, so it must work... Do you really put those files where they should be? Do you delete Blueprints.pak in your assets folders after every change you make? Are all paths correct?? Check everything.
     
  19. nasvrick

    nasvrick New Member

    Joined:
    Sep 13, 2020
    Messages:
    10
    Likes Received:
    0
    Will check and report back!
     

Share This Page