What I’m trying to accomplish is the following.
“Press [player_binding_for_crouch] + [player_binding_for_interact] to do something”.
That would be LCONTROL + T in my case.
This can be easily accomplished with the “Input binding string”.
However there is a problem if the player is using Toggle Crouch instead of Hold Crouch.
Let’s take the following two scenarios:
-
Using hold crouch:
Bindings:https://i.postimg.cc/ht1qpT0h/hold-crouch-bindings.png
Result:https://i.postimg.cc/0213FrjS/hold-crouch-result.png
This is working as expected. -
Using Toggle Crouch
Bindings:https://i.postimg.cc/LsPLc4nq/toggle-crouch-bindings.png
Result:https://i.postimg.cc/D0pSWRSk/toggle-crouch-result.png
As you can see, the binding for crouch disappeared. This is because Toggle Crouch it’s not present in the “Buttons” constants list.
https://i.postimg.cc/PrmxnL4n/buttons-list.png
Adding the Toggle Crouch in the Buttons constant so “Input binding string” can display the binding for Toggle Crouch will not help much either.
Let’s go back to what I’m trying the accomplish.
How will I know when to show the hold crouch bindings or toggle crouch buttons?
Or even worse, what if someone has different buttons for hold crouch and toggle crouch? I will show them both?
The only possible solution I see for this is to remove the option for a player to have different bindings for Hold and Toggle Crouch.
Instead, the Crouch button will always be the same and a option for Toggle will be added. (On / Off).
Something like this: https://i.postimg.cc/50t2WntX/toggle-crouch-concept.png
Yes, you are going to take away the ability to have different keys for Hold Crouch and Toggle Crouch, but how many players are doing that anyway.
rule("Input binding string test")
{
event
{
Ongoing - Global;
}
actions
{
Create HUD Text(All Players(All Teams), Null, Null, Custom String(" "), Top, 1, Color(White), Color(White), Color(White),
Visible To and String, Default Visibility);
Create HUD Text(All Players(All Teams), Null, Null, String("{0} {1} {2}", Custom String("Press "), String("{0} {1} {2}",
Input Binding String(Button(Crouch)), Custom String(" + "), Input Binding String(Button(Interact))), Custom String(
" to do something.")), Top, 2, Color(White), Color(White), Color(White), Visible To and String, Default Visibility);
}
}