Always snap to grid

Legacy:RegularEngine/RegularVersatileKeyBind

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

A Versatile Key Bind is just an interaction that can rest on top of any other binding setup. This allows it to be independant of other keybinds. So one mod's VKB won't conflict with another mod's VKB. Since Epic put in the mod menu setup, this is less of a problem - but many mutators and gametypes still require the occasional custom key. Those add up to the casual player and manipulating them becomes a pain. With a VKB, only your code will interact with your binds.

The setup is pretty simple. Three dynamic arrays which expect to be in sync with each other. One is the key, the other is the command it will call, and the final is the description. A VKBTrader can then reassign these. The interaction just waits for input and checks to see if it should execute.

Interaction >> RegularVersatileKeyBind
class RegularVersatileKeyBind extends Interaction
      config(RegularEngineData);
 
 
var config bool bClientSet;
var config Array<string> Keys;
var config Array<string> Binds;
var config Array<string> Descriptions;
 
function Initialize()
{
    Log("VersatileKeyBind Interaction Initialized");
    if(bClientSet) {
      bClientSet=true;
      SaveConfig();
      }
}
 
function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta )
{
    local int i;
 
    if (Action == IST_Release) {
    //    ViewportOwner.Actor.ClientMessage("Key PRESSED:"$class'Engine.Interactions'.static.GetFriendlyName(Key));
 
    for(i=0; i<Keys.Length; i++) {
        if(Keys[i] ~= class'Engine.Interactions'.static.GetFriendlyName(Key)) {
      //     ViewportOwner.Actor.ClientMessage("Key PRESSED:"$class'Engine.Interactions'.static.GetFriendlyName(Key));
											if(!ViewportOwner.Actor.bIsTyping){ ViewportOwner.Actor.ConsoleCommand(Binds[i]); }
   //        LOG(self$" Called Keybind");
											break;
        }
    }
 
    }
    return false;
}
 
 
 
defaultproperties {
 bClientSet=False
 bActive=True
 Keys[0]="K"
 Binds[0]="keybinds"
 Descriptions[0]="Open This Menu"
 Keys[1]="P"
 Binds[1]="openclasstrader"
 Descriptions[1]="Open Class Menu"
 
 
}