2 registered members (NnamueN, 1 invisible),
1,489
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Password field with stars and not characters
#245462
01/10/09 02:13
01/10/09 02:13
|
Joined: Feb 2006
Posts: 385 Oldenburg,Germany
Ralph
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
|
Hey guys, im actually work on a login script. But now i have a problem, i want a password field that shows at the inkey process stars(*) and not the character i write in the inkey-string. This is what i wrote yet:
mouse_mode=0;
STRING* act_char=" ";
str_cpy((login_panel_password.pstring)[0],""); //clear the (stars)string
str_cpy((login_panel_password.pstring)[1],"");//clear the (chars)string
do{
if(key_any==1&&mouse_left==0&&mouse_right==0&&mouse_middle==0){
while(key_any==1){wait(1);}//<- this is the malefactor that slowed the inkey-process,
//but if i cut this out, all characters are doubly or more.
str_cpy(act_char," ");//clear the actually character string (lastpressed)
if(key_lastpressed!=14){//backspace is not pressed
str_for_key(act_char,key_lastpressed);//put the keycode of the last pressed key into act_char
str_cat((login_panel_password.pstring)[0],"*");
str_cat((login_panel_password.pstring)[1],act_char);
}else{
str_trunc((login_panel_password.pstring)[0],1);
str_trunc((login_panel_password.pstring)[1],1);
}
}
wait(1);
}while(key_lastpressed!=28&&str_len((login_panel_password.pstring)[0])<100);
mouse_mode=2;
But if i wrote faster, some characters are not in the string (like this "hllo gys"). Someone knows a trick that the normal inkey function do that what i want or what should i change on my script? Sorry for my bad english. Greetings David.
Last edited by Ralph; 01/10/09 02:14.
|
|
|
Re: Password field with stars and not characters
[Re: Ralph]
#245468
01/10/09 05:56
01/10/09 05:56
|
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B
Expert
|
Expert
Joined: Feb 2006
Posts: 2,185
|
I'm sure there's a way to get it to work. I don't have time now to make a script, but it shouldn't be hard. If all else fails, you could make a bmap text that has nothing but stars as characters.
- aka Manslayer101
|
|
|
Re: Password field with stars and not characters
[Re: Spirit]
#245476
01/10/09 07:13
01/10/09 07:13
|
Joined: Aug 2008
Posts: 153 Germany,Stuttgart
kwpsp
Member
|
Member
Joined: Aug 2008
Posts: 153
Germany,Stuttgart
|
create a new font, only with stars! kwpsp
My system: - Core 2 Quad 6600(4x 2,4GhZ) - 2GB Ram - GeForce 7050(:-)) - Windows seven
|
|
|
Re: Password field with stars and not characters
[Re: kwpsp]
#245477
01/10/09 07:25
01/10/09 07:25
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Ignoring your current script, which looks needlessly complex, Have you thought about putting the Inkey characters into a string that isnt visible, say a temporary string, and everytime a chatacter goes in, make the visible string contain tmepstring.length number of stars?
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Password field with stars and not characters
[Re: EvilSOB]
#245511
01/10/09 13:35
01/10/09 13:35
|
Joined: Feb 2006
Posts: 385 Oldenburg,Germany
Ralph
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
|
Ignoring your current script, which looks needlessly complex, Have you thought about putting the Inkey characters into a string that isnt visible, say a temporary string, and everytime a chatacter goes in, make the visible string contain tmepstring.length number of stars? Thats exact what my script doing! But i like the idea with the extra font with only stars. So thanks to all you help me a lot. Greetings David.
|
|
|
Re: Password field with stars and not characters
[Re: Ralph]
#245524
01/10/09 14:13
01/10/09 14:13
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Sorry, thats what I getfor skim-reading complex code. I looked at it properly and I see what you mean now. Try this as a replacement of your old code... mouse_mode=0;
STRING* act_char=" "; var act_scan=0;
str_cpy((login_panel_password.pstring)[0],""); //clear the (stars)string
str_cpy((login_panel_password.pstring)[1],"");//clear the (chars)string
do{
if(key_any==1 && mouse_left==0 && mouse_right==0 && mouse_middle==0)
{
act_scan = inchar(act_char);
if(act_scan!=14)
{ //backspace is not pressed
str_cat((login_panel_password.pstring)[0],"*");
str_cat((login_panel_password.pstring)[1],act_char);
}
else
{ //backspace IS pressed
str_trunc((login_panel_password.pstring)[0],1);
str_trunc((login_panel_password.pstring)[1],1);
}
}
wait(1);
}while(act_scan!=28&&str_len((login_panel_password.pstring)[0])<100);
mouse_mode=2;
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Password field with stars and not characters
[Re: EvilSOB]
#245845
01/12/09 11:28
01/12/09 11:28
|
Joined: Feb 2006
Posts: 385 Oldenburg,Germany
Ralph
OP
Senior Member
|
OP
Senior Member
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
|
Hi, I test your script but I have a problem. The function "inchar" is not exists in my version of Lite-C Free. So I will work with a font with only stars. Someone knows where i can the a Font-Generator?
Greetings David
EDIT2: Now it works like i want thank you guys for helping me.
Last edited by Ralph; 01/12/09 11:59.
|
|
|
|