License from €75 Log in
DE EN FR ES IT CZ

How to deactivate the keyboard via LUA

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 12 years ago
    I have several key controls in my game. ESC opens a Menu, F5 the Save Games, F8 the Soundcontrol... and so on.

    Now I want to "block" all those keys while I'm in a specific menu by deactivating the keyboard in general. How to do so? smile
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 12 years ago
    This is completely untested on my part. Just a theoretical script.

    You need to create a condition somewhere. Call it: "keyboard_active" & set to true

    Now add this to the script section.
    function keyboardHandler(eventType, character, keycode, modifiers)
     if not Conditions["keyboard_active"].ConditionValue then
      return true
     else
      return false
     end
    end
     
    registerEventHandler("keyEvent", "keyboardHandler")
    


    To toggle keyboard on / off just change the condition value.
  4. · 12 years ago
    Can you tell me what you mean by "Change the condition value"? smile
  5. · 12 years ago
    By changing the condition I mentioned in step 1 to true or false? What else.... razz
  6. · 12 years ago
    Ah, ok... so i need to change the value of the condition. ^^ "Condition value" was irritating.
  7. · 12 years ago
    Same bloody thing! razz

    I suppose I could have said: "change the value of the condition" or I could have even said: "change the conditions value" or I could have said, what I already said. wink

    You say potato & I say patato!
  8. · 12 years ago
    It works like a charm now. Thanks Lee. smile

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?