Best way to realize a password field

  • #10, by sebastianTuesday, 02. May 2017, 06:32 7 years ago
    @marvel: 
    instead of deleting less than and greater than here in the forums you should replace them by < and >
    ( & lt ; and & gt ; ) 

    Thread Captain

    2346 Posts


  • #11, by marvelTuesday, 02. May 2017, 08:14 7 years ago
    Alright,
    thanks a lot guys. Basically it works now, but I have these problems:

    1. How do I find out if it's the right password?
    Is there any function to compare to strings and set a condition to true then?

    2. The cursor is messed up
    I created a loop for the cursor showing an additional "|"... and made a small pause of 500ms after that. But when I type now, also the typing gets paused ^^

    3. Pressing Enter
    How could I check for the right passwort, when the user presses "Enter". This would be the normal behavior - like in the windows login.



    Key Killer

    598 Posts

  • #12, by sebastianTuesday, 02. May 2017, 08:22 7 years ago
    just check in an Lua if :

    if Values["password"].String == "secret_password" then
      Conditions["password_correct"].ConditionValue = true
    else
    Conditions["password_correct"].ConditionValue = false
    end

    when pressing the Confirmation button or after each keypress.

    In VS itself ita also possible to check the condition "password_correct" 


    For the loop: this has to be a separated action, not the same as you call in the script. 



    EDIT: @return

    add an 

    elseif eventType == eKeyReturn and keycode == 13  then 

    under the Backspace elseif in the posted script. This should handle the pressing of the Return Key. You could builtin also the script block above and just run an action part instead of setting a condition 



    Thread Captain

    2346 Posts

  • #13, by marvelTuesday, 02. May 2017, 08:43 7 years ago
    Alright, checking for the correct passwort works. smile

    But what still doesn't work is the thing with the cursor. See my approach attached.

    Also I'm still looking for a chance to check the password by pressing Enter grin

    Key Killer

    598 Posts

  • #14, by sebastianTuesday, 02. May 2017, 08:52 7 years ago
    here is by the way a complete script of my mentioned stuff for others:


    (it starts and checks unique VS Actions/Conditions. Can be edited to check only for current acene, etc) 

    Edit: maybe the eKeyReturn could also be an eKeyDown because the keycode is still checked. 

    @marvel is this the action you call after each key pressure? 

    In this you only have to refresh the text and maybe change the object font for the moment (via lua).  No pauses, no"|"

    In ANOTHER Action you do 

    ==================
    change object font to password font
    display text "password" 
    change object font to default font
    wait 500ms
    change object font to password font
    display text "password|" 
    change object font to default font
    wait 500ms
    jump to action part #1
    ==================

    this action gets called if you open/enter the scene and stopped when close/leave it or pressing enter + password=correct

    Thread Captain

    2346 Posts

  • #15, by afrlmeTuesday, 02. May 2017, 12:05 7 years ago
    haha Thomas, you were correct earlier about conflicting values with the same names. Trying to access them in display object texts would also be an issue, but you only really need 1 value that can be used for any password puzzle anyway as you can recycle it.

    Imperator

    7278 Posts