Creating a Password

  • #1, by monicaamorosTuesday, 13. June 2017, 18:09 3 years ago
    Hello
    I'm a beginner in Visionaire Studio. I've created a simple Room Escape game and as the final obstacle I want to do a password code where you have to write 4 numbers. How can I do that?
    Any help would be really helpful as this is part of a university project.

    Newbie

    3 Posts


  • #2, by AkcayKaraazmakTuesday, 13. June 2017, 18:17 3 years ago
    Player should write them via keyboard or clicking the numbers on a numpad on a scene object?

    Great Poster

    437 Posts

  • #3, by sebastianTuesday, 13. June 2017, 18:37 3 years ago
    I found a topic which deals with the same  question (password is typed by keyboard from the player):

    Thread Captain

    2336 Posts

  • #4, by ke4Tuesday, 13. June 2017, 18:40 3 years ago
    Via Lua script - a keyboard input:

    For visible input:
    You are gonna need to create a value where you will be storing the data.
    And you will also need to create and "Called by other action" action which will be having display object text action part to refresh the text.

    function keyboardHandler(eventType, character, keycode, modifiers)
     if eventType==eEvtKeyTextInput then
      Values["password"].String = Values["password"].String .. character
     elseif eventType == eEvtKeyDown and keycode == 8 then
      Values["password"].String = string.sub(Values["password"].String, 1, -2)
     end
     startAction("Scenes[yourScene].SceneActions[refresh]")
     return false
    end

    registerEventHandler("keyEvent", "keyboardHandler")
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    But there's a lot of options. You can also display just **** instead of the input. Or you can set up some screen with numbers/letters and do it just with mouse clicking.

    In that case you can just make an object for each number/letter and add the number to a string. Then compare the string to your password.

     Values["password"].String = Values["password"].String .. "1"
    1

    Key Killer

    810 Posts

Write post