Tastenzählen

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

ozzi789

Betreff: Tastenzählen

BeitragSo, Apr 27, 2008 23:23
Antworten mit Zitat
Benutzer-Profile anzeigen
Hai ich hab da ein Problemchen und ich raffs einfach ned Confused

Ich möchte eine "Passwort" abfrage machen.
Die geht eigentlich schon aber das Problem is ich will mit * anzeigen wieviele tastenschon gedrückt wurden, momentan zählt er aber nur die, welche w,a,k,e,u oder p heissen/sind.

Vieleicht ums verständlicher zu machen, ein Code der merkt wen eine Taste gedrückt wird ( nicht waitkey) und die anzahl als Variable speichert und dan ein Text der soviele * zeichnet wie die anzahl gross is ...



Code: [AUSKLAPPEN]

Graphics 640,480,16,1
AppTitle "PWC, Ozzi"
SetBuffer BackBuffer()
Global gfxSparks, frmSparks, tmrSparks


gfxSparks=LoadAnimImage("c:\Graphics\pwd.bmp",280,45,0,2)
password2$ = "wakeup"

FlushKeys




While Not KeyHit(1)
 
Cls

If MilliSecs() > tmrSparks + 500 Then
tmrSparks=MilliSecs()
frmSparks=( frmSparks + 1 ) Mod 2
EndIf
Text 400,300, "Esc to Flushkeys"

DrawImage gfxSparks,180,200,frmSparks

If KeyHit(1) wort$= "" And wortnumb$ = ""



Text 200,400,String("*",Len(wortnumb$))


If KeyHit(17)
wort$=wort$+"w"
wortnumb$ = wortnumb$ + "%"
EndIf

If KeyHit(30)
wort$=wort$+"a"
wortnumb$ = wortnumb$ + "%"
EndIf

If KeyHit(37)
wort$=wort$+"k"
wortnumb$ = wortnumb$ + "%"
EndIf

If KeyHit(18)
wort$=wort$+"e"
wortnumb$ = wortnumb$ + "%"
EndIf

If KeyHit(22)
wort$=wort$+"u"
wortnumb$ = wortnumb$ + "%"
EndIf

If KeyHit(25)
wort$=wort$+"p"
wortnumb$ = wortnumb$ + "%"
EndIf



If wort$ = password2$ End

If KeyHit(29) Or KeyHit (56) ExecFile("shutdown -r -t 00")

Flip
Wend
End



Thx
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5

Caesium

BeitragMo, Apr 28, 2008 0:42
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]
a = GetKey()

If a > 31 And a < 128
   wort$ = wort$ + Chr$(a)
   wortnumb$ = wortnumb$ + "%"
EndIf


ich denke ich verstehe dich richtig, oder?
Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist da schon schwieriger. Smile

ozzi789

BeitragMo, Apr 28, 2008 0:58
Antworten mit Zitat
Benutzer-Profile anzeigen
Caesium hat Folgendes geschrieben:
Code: [AUSKLAPPEN]
a = GetKey()

If a > 31 And a < 128
   wort$ = wort$ + Chr$(a)
   wortnumb$ = wortnumb$ + "%"
EndIf


ich denke ich verstehe dich richtig, oder?


ja hast du omg ich hab s iwie mit getkey (a)
und a = 1to 128 versucht -.-



thx Smile
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group