programm beenden - GELÖST!
Übersicht

![]() |
BlitzproggerBetreff: programm beenden - GELÖST! |
![]() Antworten mit Zitat ![]() |
---|---|---|
moin,
ich habe in zwei proggs den genauselben Code: [AUSKLAPPEN] ElseIf Instr (wline$,"_end:")
die beiden sind im selben ordner und haben die gleiche strucktur, nur sind es verschieden weit entwickelte versionen.
wline$ = Replace (wline$,"_end:","") mtimer = Int (wline$) Delay mtimer End mein problem: in der älteren funktion funktioniert das und das programm wird beendet und in der neueren nicht. was mache ich da falsch? mfg |
||
Mein aktuelles Projekt, Irnithal: http://www.blitzforum.de/worklogs/415/
Unfreiwilliger Gewinner des BAC# 115. ![]() |
- Zuletzt bearbeitet von Blitzprogger am Do, Nov 06, 2008 14:16, insgesamt einmal bearbeitet
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Die Variable wline$ enthält einfach kein "_end:" würde ich vermuten; ggf. wird sie auch an anderer Stelle schon durch Replace umgeschrieben und nicht mehr erkannt; ohne kompletten Code nicht zu sagen.
Ein String - auch ein Leerer - ist als Interger immer Null, das macht den mtimer nicht besonders Sinnvoll, aber das nur am Rande. |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
Eingeproggt |
![]() Antworten mit Zitat ![]() |
---|---|---|
Blitzprogger hat das mit dem Delay meines Erachtens nach richtig gemacht, wenn alles davor richtig verlief...
Beispielsweise ein "_end:1000" wird zu "1000" replaced und das als Integer ist 1000, oder? Jednefalls braucht man, um den Fehler zu finden den gesamten Code in dem wline$ irgendwie manipuliert wird. |
||
Gewinner des BCC 18, 33 und 65 sowie MiniBCC 9 |
![]() |
Blitzprogger |
![]() Antworten mit Zitat ![]() |
---|---|---|
den code könt ihr haben Code: [AUSKLAPPEN] For l.rl = Each rl
wline$ = l\txt$ If l\id = SEARCHID Then okay = 1 If okay = 1 Then If Instr (wline$,"}") Then okay = 0 : Exit If Instr (wline$,"if_pg_>") Then wline$ = Replace (wline$,"if_pg_>","") If PLAYERGOLD > Int (wline$) Then Goto weiter Else Goto sprung EndIf ElseIf Instr (wline$,"if_pl_>") Then wline$ = Replace (wline$,"if_pl_>","") If PLAYERLIFE > Int (wline$) Then Goto weiter Else Goto sprung EndIf EndIf .weiter If Instr (wline$,"_t:") Then wline$ = Replace (wline$,"_t:","") If Instr (wline$,"PLAYERNAME") Then wline$ = Replace (wline$,"PLAYERNAME",PLAYERNAME$) If Instr (wline$,"PLAYERLIFE") Then wline$ = Replace (wline$,"PLAYERLIFE",PLAYERLIFE) If Instr (wline$,"PLAYERGOLD") Then wline$ = Replace (wline$,"PLAYERGOLD",PLAYERGOLD) Print wline$ ElseIf Instr (wline$,"_inp") Then ANTWORT$ = Input ("-->") ElseIf Instr (wline$,"_pname") Then PLAYERNAME$ = Input ("-->") ElseIf Instr (wline$,"_a:") Then wline$ = Replace (wline$,"_a:","") dot = Instr (wline$,",") esn$ = Left (wline$,dot-1) ant$ = Right (wline$,Len(wline$)-dot) If Trim (Lower (ANTWORT$)) = Trim (Lower (ant$)) Or Trim (ANTWORT$) = "" Then SEARCHNAME$ = esn$ okay = 0 Goto find_sn_sid ElseIf Instr (wline$,"_end:") wline$ = Replace (wline$,"_end:","") mtimer = Int (wline$) Delay mtimer End ElseIf Instr (wline$,"_plife:") wline$ = Replace (wline$,"_plife:","") PLAYERLIFE = PLAYERLIFE + Int (wline$) If PLAYERLIFE < 0 Then SEARCHNAME$ = "dead" okay = 0 Goto find_sn_sid EndIf ElseIf Instr (wline$,"_pgold:") wline$ = Replace (wline$,"_pgold:","") PLAYERGOLD = PLAYERGOLD + Int (wline$) If PLAYERGOLD < 0 Then PLAYERGOLD = 0 .sprung EndIf EndIf EndIf Next das ist die "alte" version in der es funktioniert Code: [AUSKLAPPEN] For l.rl = Each rl
wline$ = l\txt$ If l\id = SEARCHID Then okay = 1 If okay = 1 Then If Instr (wline$,"}") Then okay = 0 : Exit If Instr (wline$,"if_pg_>") Then wline$ = Replace (wline$,"if_pg_>","") ddots = Instr (wline$,":") var = Int (Left (wline$,ddots-1)) wline$ = Right (wline$,(Len(wline$))-ddots) If PLAYERGOLD > var Then Goto weiter Else Goto sprung EndIf ElseIf Instr (wline$,"if_pl_>") Then wline$ = Replace (wline$,"if_pl_>","") ddots = Instr (wline$,":") var = Int (Left (wline$,ddots-1)) wline$ = Right (wline$,(Len(wline$))-ddots) If PLAYERLIFE > var Then Goto weiter Else Goto sprung EndIf EndIf .weiter If Instr (wline$,"_t:") Then wline$ = Replace (wline$,"_t:","") If Instr (wline$,"PLAYERNAME") Then wline$ = Replace (wline$,"PLAYERNAME",PLAYERNAME$) If Instr (wline$,"PLAYERLIFE") Then wline$ = Replace (wline$,"PLAYERLIFE",PLAYERLIFE) If Instr (wline$,"PLAYERGOLD") Then wline$ = Replace (wline$,"PLAYERGOLD",PLAYERGOLD) Print wline$ ElseIf Instr (wline$,"_inp") Then ANTWORT$ = Input ("-->") ElseIf Instr (wline$,"_pname") Then PLAYERNAME$ = Input ("-->") ElseIf Instr (wline$,"_a:") Then wline$ = Replace (wline$,"_a:","") dot = Instr (wline$,",") esn$ = Left (wline$,dot-1) ant$ = Right (wline$,Len(wline$)-dot) If Trim (Lower (ANTWORT$)) = Trim (Lower (ant$)) Or Trim (ANTWORT$) = "" Then SEARCHNAME$ = esn$ okay = 0 Goto find_sn_sid ElseIf Instr (wline$,"_end:") wline$ = Replace (wline$,"_end:","") mtimer = Int (wline$) Delay mtimer End ElseIf Instr (wline$,"_plife:") wline$ = Replace (wline$,"_plife:","") PLAYERLIFE = PLAYERLIFE + Int (wline$) If PLAYERLIFE < 0 Then SEARCHNAME$ = "dead" okay = 0 Goto find_sn_sid EndIf ElseIf Instr (wline$,"_pgold:") wline$ = Replace (wline$,"_pgold:","") PLAYERGOLD = PLAYERGOLD + Int (wline$) If PLAYERGOLD < 0 Then PLAYERGOLD = 0 .sprung EndIf EndIf EndIf Next das ist die "neue" version in der es nicht geht. das mit dem type rl sind mittels readline aus einer datei ausgelesene zeilen ich habe bei beiden versionen die genau gleiche datei, eben ->in der alten gehts ->in der neuen nicht mfg |
||
Mein aktuelles Projekt, Irnithal: http://www.blitzforum.de/worklogs/415/
Unfreiwilliger Gewinner des BAC# 115. ![]() |
![]() |
Hummelpups |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] ElseIf Instr (wline$,"_a:") Then
wline$ = Replace (wline$,"_a:","") dot = Instr (wline$,",") esn$ = Left (wline$,dot-1) ant$ = Right (wline$,Len(wline$)-dot) If Trim (Lower (ANTWORT$)) = Trim (Lower (ant$)) Or Trim (ANTWORT$) = "" Then SEARCHNAME$ = esn$ okay = 0 Goto find_sn_sid ElseIf Instr (wline$,"_end:") wline$ = Replace (wline$,"_end:","") mtimer = Int (wline$) Delay mtimer End Warum ist da kein EndIf? ist auch in der alten version so, aber so wies ei´ngerückt ist, sollte da eins sein |
||
blucode - webdesign - Ressource - NetzwerkSim
BlitzBasic 2D - BlitzMax - MaxGUI - Monkey - BlitzPlus |
![]() |
Blitzprogger |
![]() Antworten mit Zitat ![]() |
---|---|---|
weil da ein goto ist...
habs trotzdem mal versucht, doch es gibt eine fehlermeldung. ich habe das übel gefunden: in Code: [AUSKLAPPEN] For l.rl = Each rl
wline$ = l\txt$ If l\id = SEARCHID Then okay = 1 If okay = 1 Then If Instr (wline$,"}") Then okay = 0 : Exit If Instr (wline$,"if_pg_>") Then wline$ = Replace (wline$,"if_pg_>","") ddots = Instr (wline$,":") var = Int (Left (wline$,ddots-1)) wline$ = Right (wline$,(Len(wline$))-ddots) If PLAYERGOLD > var Then Goto weiter Else Goto sprung EndIf ElseIf Instr (wline$,"if_pl_>") Then wline$ = Replace (wline$,"if_pl_>","") ddots = Instr (wline$,":") var = Int (Left (wline$,ddots-1)) wline$ = Right (wline$,(Len(wline$))-ddots) If PLAYERLIFE > var Then Goto weiter Else Goto sprung EndIf EndIf .weiter If Instr (wline$,"_t:") Then wline$ = Replace (wline$,"_t:","") If Instr (wline$,"PLAYERNAME") Then wline$ = Replace (wline$,"PLAYERNAME",PLAYERNAME$) If Instr (wline$,"PLAYERLIFE") Then wline$ = Replace (wline$,"PLAYERLIFE",PLAYERLIFE) If Instr (wline$,"PLAYERGOLD") Then wline$ = Replace (wline$,"PLAYERGOLD",PLAYERGOLD) Print wline$ ElseIf Instr (wline$,"_inp") Then ANTWORT$ = Input ("-->") ElseIf Instr (wline$,"_pname") Then PLAYERNAME$ = Input ("-->") ElseIf Instr (wline$,"_a:") Then wline$ = Replace (wline$,"_a:","") dot = Instr (wline$,",") esn$ = Left (wline$,dot-1) ant$ = Right (wline$,Len(wline$)-dot) If Trim (Lower (ANTWORT$)) = Trim (Lower (ant$)) Or Trim (ANTWORT$) = "" Then SEARCHNAME$ = esn$ okay = 0 Goto find_sn_sid ElseIf Instr (wline$,"_end:") wline$ = Replace (wline$,"_end:","") mtimer = Int (wline$) Delay mtimer End ElseIf Instr (wline$,"_plife:") wline$ = Replace (wline$,"_plife:","") PLAYERLIFE = PLAYERLIFE + Int (wline$) If PLAYERLIFE < 0 Then SEARCHNAME$ = "dead" okay = 0 Goto find_sn_sid EndIf ElseIf Instr (wline$,"_pgold:") wline$ = Replace (wline$,"_pgold:","") PLAYERGOLD = PLAYERGOLD + Int (wline$) If PLAYERGOLD < 0 Then PLAYERGOLD = 0 .sprung EndIf EndIf EndIf Next Print "Ihre Antwort wurde nicht gefunden." okay = 0 Goto find_sn_sid ist dieseCode: [AUSKLAPPEN] Goto find_sn_sid der fehlerursprung:
beim beenden des programms springt der lesecursor wieder an punkt ".find_sn_sid". wenn ich die zeile rausnehme geht alles, allerdings wüsste ich nicht wie ich es ersetzen könnte. wenn ich eine var habe und sowas wie Code: [AUSKLAPPEN] if var = 1 then goto find_sn_sid geht es trotzdem nicht. der punkt "find_sn_sid" befindet sich vor dem gezeigten programmausschnitt. wie könnte ich dieses goto ersetzen?
EDIT: problem gelöst! ich habe den fehlerhaften auschnitt in Code: [AUSKLAPPEN] Print "-------------------------"
geändert
Print "Möglicherweise wurde ihre Eingabe nicht gefunden." Print "Bitte drücken sie eine Taste um weiterzuspielen." Print "Programm mit ESC beenden." Print "-------------------------" okay = 0 WaitKey() If KeyDown(1) = 0 Then If ENDE = 0 Then Goto find_sn_sid EndIf Else End EndIf mfg |
||
Mein aktuelles Projekt, Irnithal: http://www.blitzforum.de/worklogs/415/
Unfreiwilliger Gewinner des BAC# 115. ![]() |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group