So i am making a random map generator in QBasic for Battlefield 3.
The idea is, whenether i run the program, the program should print a map name from already predefined strings. The code i have so far is:
CLS
REM --------------------- RANDOM NUMBER VALUE --------------------------
RANDOMIZE TIMER: A = INT((RND * 100)): B = INT((RND * 10)): C = (A + B)
NUM = INT(C - (RND * 10))
REM --------------------------- MAPS - -------------------------------
A$ = "Caspian Border"
B$ = "Damavant Peak"
C$ = "Grand Bazaar"
D$ = "Kharg Island"
E$ = "Norshar Canals"
F$ = "Operation Firestorm"
G$ = "Operation Metro"
H$ = "Seine Corssing"
I$ = "Tehran Highway"
REM ----------------------------- GAME MODE ----------------------------
RSH$ = "Rush"
TDM$ = "Team Deathmatch"
CQS$ = "Conquest"
CQSL$ = "Conquest Large"
SQDM$ = "Squad Deathmatch"
REM --------------------------- PLAYER COUNT -----------------------------
AA$ = "16 Players"
BB$ = "32 Players"
CC$ = "64 Players"
REM ------------------------ PROCESSING CODE ----------------------------
PRINT "Bore-o-mat 3000 Initilaized"
PRINT "The random number is"; NUM; "therfore the map drawn is:"
IF NUM > 10 THEN PRINT A$
IF NUM > 20 THEN PRINT B$
IF NUM > 30 THEN PRINT C$
IF NUM > 40 THEN PRINT D$
IF NUM > 50 THEN PRINT E$
IF NUM > 60 THEN PRINT F$
IF NUM > 70 THEN PRINT G$
IF NUM > 80 THEN PRINT H$
IF NUM > 90 THEN PRINT I$
END
Lets say the random NUM is 22.
It checks if NUM is bigger than 10 and prints A$, because 22 > 10. It does the same for B$. When it comes to C$, the program breaks as NUM is not > 30. Thats normal. The problem is that i get more than one map name. I get a few. Reffer to the picture:
http://i.stack.imgur.com/TTnXQ.png
I want only one string based of the random number.
How do i break the code from going to the next line? Is there a simpler way of pulling random strings?
Like i run the program and it pulls a random string out of the A$, B$, C$ etc.
Cheers :)