Page 1 of 1

Where is KeyEvent function called on?

Posted: Tue Dec 12, 2017 6:24 am
by PrinceOfFunky
I know the classes WindowConsole and Console have this event:

Code: Select all

event bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta )
Is that event called only on specific instances or it can be called on multiple instances?

Re: Where is KeyEvent function called on?

Posted: Tue Dec 12, 2017 8:09 am
by Barbie
I'm a bit confused by your question :omfg: Do you want to simulate input events?
I think it works the other way - see comment in Console.uc:
// Called by the engine when a key, mouse, or joystick button is pressed
// or released, or any analog axis movement is processed.
That function is called by the engine in case of an input event so that UScript programmers can react on what the player is doing. If there is more than one instance of the class Console, the function should be called at those instances, too.

Re: Where is KeyEvent function called on?

Posted: Tue Dec 12, 2017 8:13 am
by PrinceOfFunky
Barbie wrote:If there is more than one instance of the class Console, the function should be called at those instances, too.
That's what I want, but it doesn't get called.
These are the two classes I'm using:

Code: Select all

class InputCapture extends Mutator;

event PostBeginPlay() {
	local TestWindow testWindow;
	local UWindowRootWindow root;
	
	testWindow = new class'TestWindow';
	root = new class'UWindowRootWindow';
	
	root.Console = testWindow;
	testWindow.root = root;	
}

Code: Select all

class TestWindow extends WindowConsole;

event bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta ) {
	Log(Key@Action);
	
	return true;
}

state UWindow {}