Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (NnamueN, 1 invisible), 1,489 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Senior Member
Ralph  Offline 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:
Code:
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").cry
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. wink
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 Offline
Expert
mpdeveloper_B  Offline
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: mpdeveloper_B] #245472
01/10/09 06:34
01/10/09 06:34
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Maybe, you should store the lastpressed key before the if(key_any) wait(), and also compare if its still the same. Because otherwise, when another key is pressed during wait, the previous key got lost, which is probably why your strings are crippled.

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 Offline
Member
kwpsp  Offline
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 Offline
Expert
EvilSOB  Offline
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 Offline OP
Senior Member
Ralph  Offline OP
Senior Member

Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Originally Posted By: EvilSOB
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 Offline
Expert
EvilSOB  Offline
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...
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 Offline OP
Senior Member
Ralph  Offline 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.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1