Posts: 14
Threads: 8
Joined: May 2024
Reputation:
0
So let me show a demo
HP= 0
PRINT " A MONSTER APPEARD"
PRINT
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
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
05-19-2024, 01:36 PM
(This post was last modified: 05-19-2024, 01:37 PM by SMcNeill.)
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
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
Posts: 382
Threads: 56
Joined: Apr 2022
Reputation:
13
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.