Author Topic: $remapCmd - I can't find anything wrong with this?  (Read 898 times)

Yes, this is an IRC in development but I'm very rusty at GUI's since I haven't touched them for years.

Please may someone point in the direction of why when I press my bound key that I bind in the menu, the function isn't getting called?

Here's the toggle bind part.
Code: [Select]
$IRCBind = 0;

if($IRCBind == 0) {
$IRCBind = 1;
$remapDivision[$remapCount] = "IRC";
$remapName[$remapCount] = "General Discussion";
$remapCmd[$remapCount] = "toggleIRC";
$remapCount++;
}

function toggleIRC() {
        echo("Test function");
if($IRCengaged == 0) {
$IRCengaged = 1;
pushIRCgui();
} else {
$IRCengaged = 0;
popIRCgui();
}
}

The function is actually being called twice. Once when you press and once when you release. So the GUI is being closed as soon as the key is released.

Code: [Select]
function toggleIRC(%x) {
  if(%x)
  {
    echo("Test function");
  if($IRCengaged == 0) {
  $IRCengaged = 1;
  pushIRCgui();
  } else {
  $IRCengaged = 0;
  popIRCgui();
  }
  }
}
That will now call only when pressed.

Thanks, though there is another issue now.

When I press the button on my GUI.

It goes to a function and is supposed to echo the text in the box.

When you press send though it sends a blank line and won't send anything more.


Edit: Managed to solve this one
« Last Edit: June 27, 2016, 05:21:09 AM by National Rail »

Thanks, though there is another issue now.

When I press the button on my GUI.

It goes to a function and is supposed to echo the text in the box.

When you press send though it sends a blank line and won't send anything more.
Post your code

Post your code

Forgot about that, anyway, it's fixed now but thanks for helping.

Pardon the double post, but the issue has come back with the keybind not actually triggering the function now.

Code: [Select]
echo("Loading keybind");
$remapDivision[$remapCount] = "IRC";
$remapName[$remapCount] = "General Discussion";
$remapCmd[$remapCount] = "toggleIRC";
$remapCount++;

function toggleIRC(%x) {
echo("Attempting to toggle chat");
if(%x) {
echo("Toggling Chat");
if($IRCengaged == 0) {
$IRCengaged = 1;
pushIRCgui();
} else {
$IRCengaged = 0;
popIRCgui();
}
}
}

The echo doesn't even get sent, when the button is pressed that it is bound to.