Not logged inOpenClonk Forum
Up Topic General / Help and Questions / Func for buttons
- - By vagner Date 2015-10-11 10:06
After the new controls,
Left Mouse = func ControlUse()
Right Mouse = func ControlThrow()

What is the func to key "Q"?
What is the func to key "E"?
What is the func to key "Space"?

What i  want to do: In ekereload some weapons have more then one mode. I want change the mode on press "Q". Any ideas?
Parent - - By Sven2 [us] Date 2015-10-11 11:22 Edited 2015-10-11 11:30
Either define your own custom keys or overload the global PlayerControl function or the object's ObjectControl function to catch these controls.

In the clonk script:
public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool repeat, bool release, ...)
{
  if(ctrl == CON_Interact && !release)
  {
    Message("Space was pressed.");
    return true; // return true to overload normal key handling
  }
  if (ctrl == CON_Contents && !release)
  {
    Message("E was pressed.");
    return true;
  }
  if (ctrl == CON_QuickSwitch && !release)
  {
    Message("Q was pressed.");
    return true;
  }
  // Normal key handling (movement, etc.)
  return inherited(plr, ctrl, x, y, strength, repeat, release, ...);
}


You can look up these names in the global System.ocg/PlayerControls.txt file here. You can also have your own System.ocg/PlayerControls.txt in your scenario to define extra controls on any key.
Parent - By vagner Date 2015-10-11 12:38 Edited 2015-10-11 13:16
Thanks!, but if i change the clonk script, then i will change for all objects. I want change the key only for two kinds of weapons.
:-(, but i will see what i can do.
Up Topic General / Help and Questions / Func for buttons

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill