Problem beim Input und dem schreiben einer Datei
Übersicht

![]() |
SephkaBetreff: Problem beim Input und dem schreiben einer Datei |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi ich hab ein Pogramm bei dem man am Anfang das Passwort für spätere Zugriffe bestimmen soll,dieses Passwort wird dan in eine Datei geschrieben.
Mein Problem wenn ich Input benutze klappt es. Wenn ich die Funktion newinput benutze :Code: [AUSKLAPPEN] Function newinput$(x1,y1,x2,y2,frage$,maxl)
klappt es nicht.
a = GetKey() If a => 32 And a <= 255 And Len(antwort$) <= maxl-1 Then antwort$ = antwort$ + Chr$(a) If KeyDown(28) Then Return antwort$ If KeyDown(14) Or KeyDown(203) And Len(antwort$) > 0 And MilliSecs()-backtime > 125 Then antwort$ = Left(antwort$,(Len(antwort$)-1)) backtime = MilliSecs() End If Color 25,100,200 Rect x1, y1,x2-x1, y2-y1,1 Color 10,50,150 Rect x1, y1,x2-x1, y2-y1,0 textlange = StringWidth(antwort$) texthohe = StringHeight(antwort$) fragelange = StringWidth(frage$) Color 0,50,ccolor Rect x1+28+(Len(antwort$)*8),y1+4,10,texthohe-1,1 ccolor = ccolor + 5 If ccolor = 255 Then ccolor = 100 Color 255,255,255 stern$ = Replace(LSet ("",Len(antwort$))," ","*") Text x1+3,y1+3, frage$ + " " + stern$ End Function Hier der Code : Code: [AUSKLAPPEN] If ReadFile("config.ini")= 0 Then
Repeat newpw$ = newinput(0,0,0,0,">>",6) Flip Cls Until KeyHit(28) savefile = WriteFile("config.ini") WriteLine savefile,newpw$ CloseFile savefile Flip Cls antwort = "" End If Warum? |
||
![]() |
RallimenSieger des 30-EUR-Wettbewerbs |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich tippe mal darauf das Antwort$ nicht Global ist! | ||
[BB2D | BB3D | BB+]
|
![]() |
Sephka |
![]() Antworten mit Zitat ![]() |
---|---|---|
Rallimen hat Folgendes geschrieben: Ich tippe mal darauf das Antwort$ nicht Global ist!
Ne antwort$ ist global |
||
![]() |
ToeB |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich tippe mal darauf das du in der function nix zurückgibst.
muss heißen Code: [AUSKLAPPEN] Newinput(0,0,0,0,">>",6)
newpw$ = antwort$ mfg ToeB |
||
Religiöse Kriege sind Streitigkeiten erwachsener Männer darum, wer den besten imaginären Freund hat.
Race-Project - Das Rennspiel der etwas anderen Art SimpleUDP3.0 - Neuste Version der Netzwerk-Bibliothek Vielen Dank an dieser Stelle nochmal an Pummelie, welcher mir einen Teil seines VServers für das Betreiben meines Masterservers zur verfügung stellt! |
![]() |
RallimenSieger des 30-EUR-Wettbewerbs |
![]() Antworten mit Zitat ![]() |
---|---|---|
Imn der Function steht
Code: [AUSKLAPPEN] If KeyDown(28) Then Return antwort$
In der Haptschleife Code: [AUSKLAPPEN] Until KeyHit(28)
das geht nur selten gut Besser wäre es wenn du es so schreibst Code: [AUSKLAPPEN] Global antwort$
If ReadFile("config.ini")= 0 Then Repeat newinput(0,0,0,0,">>",6) Flip Cls Until KeyHit(28) ; geändert savefile = WriteFile("config.ini") WriteLine savefile,antwort ;geändert CloseFile savefile Flip Cls antwort = "" End If Function newinput$(x1,y1,x2,y2,frage$,maxl) a = GetKey() If a => 32 And a <= 255 And Len(antwort$) <= maxl-1 Then antwort$ = antwort$ + Chr$(a) ;If KeyDown(28) Then Stop Return antwort$ If KeyDown(14) Or KeyDown(203) And Len(antwort$) > 0 And MilliSecs()-backtime > 125 Then antwort$ = Left(antwort$,(Len(antwort$)-1)) backtime = MilliSecs() End If Color 25,100,200 Rect x1, y1,x2-x1, y2-y1,1 Color 10,50,150 Rect x1, y1,x2-x1, y2-y1,0 textlange = StringWidth(antwort$) texthohe = StringHeight(antwort$) fragelange = StringWidth(frage$) Color 0,50,ccolor Rect x1+28+(Len(antwort$)*8),y1+4,10,texthohe-1,1 ccolor = ccolor + 5 If ccolor = 255 Then ccolor = 100 Color 255,255,255 stern$ = Replace(LSet ("",Len(antwort$))," ","*") Text x1+3,y1+3, frage$ + " " + stern$ End Function |
||
[BB2D | BB3D | BB+]
|
![]() |
Sephka |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hab das problem vorhin selber gelöst aber trotzdem Danke | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group