Game Development Community

MoveMap.bindCmd not working

by Richard_H · in Torque Game Engine · 12/06/2006 (6:33 pm) · 7 replies

Hi,

I've been working on a game an I require the ability to toggle a variable by pushing a button. So, it sounded simple enough, I just added this to default.bind.cs:
function toggleThirstBow()
{
   echo("(;.;)");
   if($thirstBow)
   {
      $thirstBow = 0;
      echo("Thirst bow off.");
   }
   else
   {
      $thirstBow = 1;
      echo("Thirst bow on.");
   }
}

moveMap.bindCmd( keyboard, q, "toggleThirstBow();", "");
error("----------------------------- toggleThirstBow bound to q");
I checked and my error message pops up telling me it should be working, but when I hit q, nothing. I tried changing it and I still get nothing. I ran the function from the console and it worked.
Can anyone see something wrong with this?

#1
12/06/2006 (6:40 pm)
Try deleting your prefs and config files.
#2
12/06/2006 (7:19 pm)
Add

moveMap.bindCmd( keyboard, q, "toggleThirstBow();", "");


to the config.cs too


Aun
#3
12/07/2006 (3:32 am)
I tried both, yet unfortunetly neither worked...
#4
12/07/2006 (6:21 am)
moveMap.bindCmd(keyboard, "q", "", "toggleThirstBow();");
#5
12/07/2006 (5:33 pm)
Why bother binding it as a command if your not passing a varible. Pointless..

moveMap.bind(keyboard,  q, toggleThirstBow);
#6
12/07/2006 (5:50 pm)
Neither of these work...
I'm really clueless as to why, but the toggleThirstBow work, other movemap commands work, yet this doesn't...
#7
12/07/2006 (5:53 pm)
Never mind, it turns out I deleted the wrong config file. For some reason there were two, when I removed them it started working, thanks for all the help.