Page 1 of 2

Caps Lock State Node?

Posted: 18 May 2016, 15:08
by shermanpat
Was trying to us the Caps Lock button as a bool to change some controls in a program with feedback on the keyboard for the user. But I didn't see any node that tell me what the state of the Cap Lock key is. Am I just forgetting about a node?

Thanks

Re: Caps Lock State Node?

Posted: 18 May 2016, 20:20
by Chris
Hi Sherman,

Connect a keyboard node to the toggle input of a toggle node. Obviously this is dependant on the current state of the caps lock key during scene start up, but that the only way to get the cap locks key to fire a bool, unless you use a script.

Chris

Re: Caps Lock State Node?

Posted: 19 May 2016, 07:17
by shermanpat
That is what I did for a work around which can break depending on what the state is at time of opening the scene. But I can work with that for this scenes needs, was just looking to use the light on the keyboard as a notice for a toggle of a Cut or Fade animation types.

Re: Caps Lock State Node?

Posted: 19 May 2016, 08:12
by Chris
try this ;)

Re: Caps Lock State Node?

Posted: 19 May 2016, 08:16
by Chris
Just thought, you'll need to connect a scene event node to the script method to recheck the caps lock on scene start up ;)

Re: Caps Lock State Node?

Posted: 20 May 2016, 23:52
by shermanpat
Thanks for sharing, will test it out in a few days.

Re: Caps Lock State Node?

Posted: 24 May 2016, 14:26
by shermanpat
So simple, thanks.

I never know where to start when trying to create scripts like this. But when I see them it makes good sense, gotta work on my scripting know how!

Re: Caps Lock State Node?

Posted: 31 May 2016, 12:00
by Eric_RD
You don't even need a Script for that:

Create an Int expression node with the following expression
Convert.ToInt32(System.Console.CapsLock)
this node outputs: 0 or 1

Or a String Expression with
System.Console.CapsLock.ToString()
output: True or False

Everytime you change any of the inputs of these expressions they give you the current CapsLock state.
You can connect both expression outputs to a Bool Node to cast it into a boolean value.

Re: Caps Lock State Node?

Posted: 31 May 2016, 16:06
by Chris
This is a great point Eric!

I always over look the fact that these things can be accomplished in the expression nodes.

Can you call on any namespace from the expression nodes?? or is it just certain ones from the .net library??

Cheers
Chris

Re: Caps Lock State Node?

Posted: 31 May 2016, 20:14
by shermanpat
That sure makes it simple to just do that in a expression node. Thanks for sharing.