[Plugin] Keycode

Post your completed addons to share with the community

Post » Tue Nov 01, 2011 8:34 pm

This plug-in has been removed. It is no longer necessary, due to the addition of key code functionality to the built-in keyboard plug-in.

If you require a copy of the plug-in to be able to open a project, PM me. Otherwise, please use the built-in keyboard plug-in.



Plug-in: KeyCode
Capture key from keyboard and return hardware scan code, Unicode code, and Unicode character.

Installation
- Extract the contents of the zip file into \Construct2\exporters\html5\plugins
- Folder name: wastrel_keycode

Features
- Capture the hardware scan code and the Unicode code/character for a key from the keyboard

Usage
- (DEPRECATED) KeyCode -> Capture key : System -> Set value {variable} = KeyCode.Code
- KeyCode -> Capture key : System -> Set value {variable} = KeyCode.ScanCode
- KeyCode -> Capture key : System -> Set value {variable} = KeyCode.UnicodeCode
- KeyCode -> Capture key : System -> Set value {variable} = KeyCode.UnicodeChar
- {Some/empty condition} : Start capture
- {Some/empty condition} : End capture


Conditions
- Capture key: Captures the next keystroke from the keyboard and places the hardware scan code into the ScanCode expression; the Unicode code into the UnicodeCode expression; and the Unicode character into the UnicodeChar expression. Use System -> Set value to set a variable to the key code value. The Capture key condition is enabled using the Start capture action, and is disabled with the End capture action.

Actions
- Start capture: Enables the Capture key condition to capture the next keystroke. Capture key will continue to capture keystrokes until End capture is called. Generally, Start capture will be called with a specific condition (e.g button press) to capture one keystroke (e.g. to set key mappings). Start capture can also be called using an event with an empty condition, for continuous key captures.
- End capture: Disables the Capture key condition.

Expressions
- (DEPRECATED) Code: An integer value which contains the key scan code, set by the Capture key condition. Default = 0.
- ScanCode: An integer value which contains the key scan code, set by the Capture key condition. Default = 0.
- UnicodeCode: An integer value which contains the Unicode code, set by the Capture key condition. Default = 0.
- UnicodeChar: A string value which contains the Unicode character, set by the Capture key condition.

Examples



Wastrel2013-01-10 18:07:27
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Tue Nov 01, 2011 8:54 pm

This sounds like it would be amazingly helpful for allowing users to customize controls during runtime. Thanks very much.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Wed Nov 02, 2011 6:19 am

It's seems "keydown" will always trigger condition "Capture key".
Adding an action "Start to scan key" is better. "Capture key" will be triggered once after a "Start to scan key".


Plugin 8directionMP and platformMP have an action to allow user set customize control by keycode.
Maybe these can work together.rexrainbow2011-11-02 08:06:31
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Wed Nov 02, 2011 10:19 am

@SullyTheStrange: that's the very the reason I started working on this. :D

@rexrainbow: Are you saying to not have a condition, but to only have the "Start to scan key" as an action, then capture off of that? I was thinking having Capture key as a top level condition might be too restrictive.

I must have missed your MP plug-ins before. Are they actually extending the existing plug-ins? I had wanted to do that with the Keyboard plug-in and just add the capture function. I will check them out.

I will also take a look at moving the capture function down to the action level.

Thanks!

Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Wed Nov 02, 2011 12:50 pm

8directionMP, platformMP

No, I mean to using an action "Start to scan" to activate the scan.
After that, the key-down will trigger "Capture key".
Then using expression to get the keycode.

I fix the plugin, you can download here.
rexrainbow2011-11-02 12:54:55
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Wed Nov 02, 2011 12:58 pm

The reason why I have not implement the key-scan in behavior plugin is, I think the key-scan is more general.
Put the key-scan into "Plugins" is better in "Behaviors", like yours.rexrainbow2011-11-02 12:59:11
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Wed Nov 02, 2011 1:05 pm

@rexrainbow: Oh, I see what you mean now. Yeah, I was considering implementing something like that with events, but it's much cleaner the way you did it. Do you care if I keep it as part of the plug-in?
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Wed Nov 02, 2011 1:12 pm

It's my pleasure.

I am thinking about a control capture that allow user configure control from keycode, mouse, touch...
Like this plugin in C1.

The architecture of C2 is different with C1, so that it's may a little difficult. (Oh, I just thinking... )

EDIT: I delete the test file since you had a copy now. rexrainbow2011-11-02 13:59:36
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Fri Nov 04, 2011 11:13 pm

Hi,
My team member gonzdevour make an icon for Keycode plugin. Hope you will like it!
rexrainbow2011-11-05 00:58:22
B
97
S
22
G
177
Posts: 4,113
Reputation: 103,531

Post » Sat Nov 05, 2011 11:11 am

[QUOTE=rexrainbow] Hi,
My team member gonzdevour make an icon for Keycode plugin. Hope you will like it!
[/QUOTE]

Keycode is a great work, thanks.

Here are 3 ico in this rar,
the first 2 made a little change from the original keycode ico,
the third is I found from some free icon site.

Maybe you'd like to choose one of them.

http://dl.dropbox.com/u/31590694/ScirraBugReport/KeycodeIcon.rar
B
106
S
27
G
8
Posts: 209
Reputation: 12,525

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests