The program only wants to run once . . . - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: The program only wants to run once . . . (/showthread.php?tid=2896) |
The program only wants to run once . . . - Kernelpanic - 07-30-2024 The program only ever works once. Then one have to delete the exe file, otherwise it will always just show "unknown". Even deleting the program and using a different name didn't help. Does anyone know what could be wrong? Thanks! I think I've had a similar case before, but I can't remember how I solved the problem. Code: (Select All)
RE: The program only wants to run once . . . - justsomeguy - 07-30-2024 Don't you need a loop to keep it going? RE: The program only wants to run once . . . - DSMan195276 - 07-30-2024 Could you give a bit more of an explanation of what goes wrong? The screenshot looks like it shows two functional runs of the program and neither of them hit the "Unbekannt" case. RE: The program only wants to run once . . . - bplus - 07-30-2024 Works fine for me I run hit escape and 27 comes up I run again hit spacebar and 32 comes up I run again hit a and get some Unbekannt word comes up. What is wrong with any of that? no rhyming? RE: The program only wants to run once . . . - Kernelpanic - 07-30-2024 (07-30-2024, 06:57 PM)DSMan195276 Wrote: Could you give a bit more of an explanation of what goes wrong? The screenshot looks like it shows two functional runs of the program and neither of them hit the "Unbekannt" case.When I reloaded and started the program, it worked, despite the old exe file. When I started it again, see screenshot. At first it wasn't saved, but I also deleted the "untitled.exe". It is normally that the exe-file is saved in the same directory as the source file. I am now sure that I have had this problem before. RE: The program only wants to run once . . . - DSMan195276 - 07-30-2024 (07-30-2024, 08:46 PM)Kernelpanic Wrote: When I reloaded and started the program, it worked, despite the old exe file. When I started it again, see screenshot.What about that screenshot shows it running incorrectly? That's what I'm missing, it looks like it ran just fine and hit the case where `_KeyHit` returned zero Is the problem the "Untitled" in the title? RE: The program only wants to run once . . . - Kernelpanic - 07-30-2024 Quote:What about that screenshot shows it running incorrectly? That's what I'm missing, it looks like it ran just fine and hit the case where `_KeyHit` returned zeroAgain: I start the program, press the space bar, and it is displayed correctly. I start the program again, press the space bar again, and it displays "unknown". The same thing happens with "ESC". After deleting the exe file, it works again, but only once. Then the game repeats itself. I just tried it again. RE: The program only wants to run once . . . - Jack - 07-30-2024 Sylvester, err Kernelpanic is right, the program doesn't behave as one would expect RE: The program only wants to run once . . . - SMcNeill - 07-31-2024 The _DELAY 2 isn't a very reliable way to try and get a keypress into the keyboard buffer. Start up times vary, so if the screen is initialing and you hit that space bar, it may not register it. Instead of just k = _KEYHIT, trap for a key event and then move on. DO k = _KEYHIT LOOP UNTIL k If you want to include it in a timer, then try something like: t# = TIMER + 2.0 <-- 2 seconds DO k = _KEYHIT LOOP UNTIL k OR (TIMER > t#) Is this a Linux only issue? I can't seem to reproduce it at all, on my Win 11 machine. RE: The program only wants to run once . . . - Jack - 07-31-2024 Steve, I ran it on Win 11 and it shows the problem. have not tried it on Linux |