[Plugin] Keycode

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • <font color=red>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.</font>

    <font size="4">Plug-in: KeyCode</font>

    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

    <font face="Courier New, Courier, mono">- <font color=red>(DEPRECATED) KeyCode -> Capture key : System -> Set value {variable} = KeyCode.Code</font>

    • 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</font>

    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

    • <font color=red>(DEPRECATED) Code: An integer value which contains the key scan code, set by the Capture key condition. Default = 0.</font>
    • 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

  • This sounds like it would be amazingly helpful for allowing users to customize controls during runtime. Thanks very much. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • 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.

  • 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!

  • 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.

  • 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.

  • 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?

  • 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... <img src="smileys/smiley36.gif" border="0" align="middle">)

    EDIT: I delete the test file since you had a copy now.

  • Hi,

    My team member gonzdevour make an icon for Keycode plugin. Hope you will like it!

    <img src="http://i1220.photobucket.com/albums/dd443/gonzdevour/keyIcon.png" border="0" />

  • Hi,

    My team member gonzdevour make an icon for Keycode plugin. Hope you will like it!

    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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks guys! I have been trying to work more on this plug-in, but work was pretty harsh this week.

    I will use one of them for the icon, because the one I have is pretty bad.

  • I have updated the original post with a format I borrowed from Mipey's spritefont post (I hope you don't mind Mipey).

    Also, the icon has been updated with one of the icons provided by rexrainbow and I chose the keyboard, because it seems to translate a lot better to the smaller format when displayed in the event sheet. Thanks guys!

  • Do I mind? DO I MIND?! <img src="smileys/smiley7.gif" border="0" align="middle" />

    Nah, not really. <img src="smileys/smiley17.gif" border="0" align="middle" /> Good work!

  • The plug-in has been updated. It now will return the hardware scan code, the Unicode code, and the Unicode character, in separate expressions. I deprecated the Code expression, so the plug-in should still work with existing projects.

  • I'm finally getting to the point where I want to add customizable controls to my game, so here I am again! I haven't actually done anything yet, so no comments/criticisms/questions, but consider this a friendly bump. <img src="smileys/smiley17.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)