Author Topic: Keybind to detect if button is pressed or released  (Read 796 times)

There's a script to detect if the button keybinded is pressed or released.
The script did this:
(Person presses the button) The console says: Button pressed!
(Person takes finger off the button) The console says: Button released!
Not sure where that script came from, but I no longer have it.
I know there's a thing where you shouldn't give out full codes in Coding Help, so
if you have to, just suggest a place for me to learn about coding keybinds or something.
I would try to start out with a code, but it would do no good because I have no
idea where to begin.

Code: [Select]
if (!$Bindings)
{
    $remapDivision[$remapCount] = "Binding Division";
    $remapName[$remapCount] = "Keybind";
    $remapCmd[$remapCount] = "bindingFunction";
    $remapCount++;
    $Bindings=true;
}
function bindingFunction(%bool)
{
    if(%bool)
        echo("Keybind Pressed");
    else
        echo("Keybind Released");
}
Is this what you need?

You're not supposed to give out full codes but only because the other person learns.

No one follows that sentiment though.

You're not supposed to give out full codes but only because the other person learns.

No one follows that sentiment though.
There's not much to say about that code.

Code: [Select]
if (!$Bindings)
{
    $remapDivision[$remapCount] = "Binding Division";
    $remapName[$remapCount] = "Keybind";
    $remapCmd[$remapCount] = "bindingFunction";
    $remapCount++;
    $Bindings=true;
}
function bindingFunction(%bool)
{
    if(%bool)
        echo("Keybind Pressed");
    else
        echo("Keybind Released");
}
Is this what you need?
Yes, thank you.

You're not supposed to give out full codes but only because the other person learns.

No one follows that sentiment though.
I think this specific scenario doesn't matter as much