Blockland Forums > Modification Help
Function with keybind
(1/3) > >>
alex dude:
I'm wanting to execute a function when i press a key binded button and then execute another when pressed again, like a toggle. How would i go about doing this?
Nexus:
This needs to be in a client.cs file.

$remapDivision[$remapCount] = "Section Name";
$remapName[$remapCount] = "Action Name";
$remapCmd[$remapCount] = "function";
$remapCount++;
phflack:
then in the remapCmd part, where nexus said function, that's to call a function (ie, "quack", would call function quack(){})
then in the function for a toggle you could then have
$togglethingy = !$togglethingy;
if($togglethingy)
{
a();
}
else
{
b();
}
a and b as functions
Bauklotz:
function myToggle(%val) {
    if(!%val)
        return;
    $myToggle = !$myToggle;
}
alex dude:
Thanks guys, i'm going to test it now.
Navigation
Message Index
Next page

Go to full version