Again Help Chapter 2 - 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: Again Help Chapter 2 (/showthread.php?tid=2709) |
Again Help Chapter 2 - BloodyHash - 05-19-2024 So let me show a demo HP= 0 PRINT " A MONSTER APPEARD" PRINT (1) GERMAN SUPLEX INPUT X IF X = 1 THEN HP = 0 what i want is if people press other then 1 i wanna put "ERROR" and then put back to PRINT (1) GERMAN SUPLEX RE: Again Help Chapter 2 - SMcNeill - 05-19-2024 The best way to do this type of thing is with some type of INPUT VALIDATION loop. Let me share simple demo for you: HP = 0 DO PRINT " A MONSTER APPEARD" PRINT "(1) GERMAN SUPLEX" INPUT X IF X <> 1 THEN PRINT "ERROR -- INVALID CHOICE" LOOP UNTIL X = 1 IF X = 1 THEN HP = 0 DO.... LOOP UNTIL.... the input variable is in the proper range to be valid RE: Again Help Chapter 2 - BloodyHash - 05-19-2024 THANKS SIRE WILL TEST IT OUT RE: Again Help Chapter 2 - Dimster - 05-19-2024 Hi BloodyHash. Will your program have a menu with more Choices/Options? Will the user/player chose by number or by typing out the word? That's a good idea to have an error trap routine on the menu choices. |