Replacing characters in a Textbox with 'x' when player is entering a password

Started by shaun9991, Thu 07/03/2019 21:14:15

Previous topic - Next topic

shaun9991

Hey guys!

I've tried to find a solution for this but no avail as yet. There is a section in our next game when the player needs to enter a password on a computer screen. Rather than the password simply showing as typed in the Textbox, is there a way of displaying all text characters typed within that Textbox as an 'x', for example? I think I've seen this in AGS games before.

Many thanks! Any help is super appreciated  :)
Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Privateer Puddin'



Khris

The other way is to use a Label and add an X to a string when the player presses a keyboard key and the password GUI is visible.

shaun9991

Thanks Khris! I've been trying your suggestion but I can't get it to work correctly. Would this be using the Append/AppendChar string functions?

Thanks!
Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Khris

Yes, something like

Code: ags
  // in on_key_press

  if (gPassword.Visible) {
    password = password.AppendChar(k);  // k is the eKeyCode param
    xString = xString.AppendChar('X');
    lblPassword.Text = xString;
  }

shaun9991

Awesome, thanks Khris - I managed to get it working with your help :)
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Gurok

[img]http://7d4iqnx.gif;rWRLUuw.gi

SMF spam blocked by CleanTalk