Key Input (technical demo)

  • #1, by afrlmeWednesday, 10. September 2014, 19:14 10 years ago
    Please read the readme.txt file included in the root folder of the .ved file before opening the key_input_demo.ved file.

    If you lack patience &/or hate repetition then I recommend not attempting to create any key input based puzzles for your game as this thing took me almost 2 days (approx) to finish & debug. I could have made it simpler, sure... but I wanted to create an example of what can be done with a bit of creative thinking & scripting.

    Regards,
    Lee.

    P.S: This is for advanced users of Visionaire Studio; or crazy people, who like to jump ass backwards into the deep end first...

    Imperator

    7278 Posts


  • #2, by SDMonoWednesday, 10. September 2014, 21:19 10 years ago
    That's really impressive. A lot of work to program all the buttons and scripting the crap out off it!!! Master Lee has done it again. smile Thanks!!!

    Forum Fan

    148 Posts

  • #3, by afrlmeWednesday, 10. September 2014, 21:46 10 years ago
    Cheers smile

    Was a mixture of loads of all the mentioned things. The lua part was relatively small & simple though. Few lines for each function.

    1. add() -- added character to end of variable which then updates a vs value.
    2. remove() -- removes last character from vs value
    3. updateStr() -- updates vs value with current result string
    4. clear() -- reset both vs values back to nil
    5. checkAnswer() -- compared current string value of str_txt to answer of current active table index.a & return true/false actions.

    All in all it was very boring to create.

    Hopefully the devs will sort out true key input at some point so that all we have to do is enable a condition to switch between regular key input actions & true key input. Not sure how it would work at the minute though. In theory I believe we would have to focus on some kind of input box which is linked to a value to input text to it which would be displayed with object text. I'm not sure how else it could be done.

    Imperator

    7278 Posts

  • #4, by AkcayKaraazmakThursday, 11. September 2014, 10:33 10 years ago
    Well done mate! smile

    Great Poster

    440 Posts

  • #5, by LebosteinFriday, 29. January 2016, 12:01 8 years ago
    Very great example! Possible to input a text (to a string variable) without defining every character key in the key actions section? I need a thing like: "Input your name: _"

    Key Killer

    621 Posts

  • #6, by afrlmeFriday, 29. January 2016, 12:16 8 years ago
    I made this before the Lua key input event handler / listener was implemented into Visionaire Studio. I believe it would be a lot faster & easier to create with the key event handler as it can simply return whatever key was pressed & you can also listen out for special keys too.

    Imperator

    7278 Posts

  • #7, by LebosteinFriday, 29. January 2016, 13:43 8 years ago
    Can I find an example with the Lua key input event handler?

    Key Killer

    621 Posts

  • #8, by afrlmeFriday, 29. January 2016, 13:51 8 years ago
    http://wiki.visionaire-tracker.net/wiki/RegisterEventHandler - example 3 at the bottom of the page. It's a bit of a complicated example as it covers various different types of key input. The only thing you really need to do is check if it's a character & return that. If it's space bar then you insert a " " empty character & if it's delete / backspace then I guess you would remove the last character stored inside of a variable or values string field. You could probably sort it all out in 10 to 20 lines or so - I can't really say how many off the top of my head.

    * edit: just thought about a method of making it more global. You would create a variable that you set as nil to begin with. This would be added as an if query inside of the key event function to check when key event handler should function. To use the handler you would update the variable to the name of a VS value you want to add a string to & then whenever characters are released it would add that character to the end of the values current string. When you submit it with a button or enter you would reset the variable back to nil to kill the key event handler.

    Sorry if it's not that clear. Just theorizing off the top of my head (again).

    Imperator

    7278 Posts