So you want to be a programmer, eh?

Discuss popular GCS tools like ZZT, Megazeux and Adventure Game Studio, as well as programming and other topics related to game design.
Interon

So you want to be a programmer, eh?

Post by Interon »

It can be a tedious, boring job for those new to it. You need lots of patience and persistence if you are ever to do anything useful with it. To make DOS games, try QBasic. It is easier than C++ and Assembler and is a great way to get started.

Here, take some code from me to get you started. This is a simple trivia game. Replace the questions and answers with what you want to use.

This code might help you learn QBasic.

Code: Select all

1 CLS
CLEAR
GOSUB QUESTION1
GOSUB QUESTION2

QUESTION1:
LOCATE 1, 1:INPUT "What is the capital of Canada?", Q$
IF UCASE$(Q$) = "OTTAWA" THEN CLS
IF UCASE$(Q$) = "OTTAWA" THEN LOCATE 1, 1: PRINT "Correct!"
IF UCASE$(Q$) = "OTTAWA" THEN LOCATE 2, 1: PRINT "Press any key to continue . . ."
IF UCASE$(Q$) = "OTTAWA" THEN DO: LOOP WHILE INKEY$ = ""
IF UCASE$(Q$) = "OTTAWA" THEN RETURN
LOCATE 1, 1: PRINT "WRONG!"
LOCATE 2, 1: PRINT "Press any key to continue . . ."
DO: LOOP WHILE INKEY$ = ""
RETURN

QUESTION2:
LOCATE 1, 1:INPUT "What color is coal?", Q$
IF UCASE$(Q$) = "BLACK" THEN CLS
IF UCASE$(Q$) = "BLACK" THEN LOCATE 1, 1: PRINT "Correct!"
IF UCASE$(Q$) = "BLACK" THEN LOCATE 2, 1: PRINT "Press any key to continue . . ."
IF UCASE$(Q$) = "BLACK" THEN DO: LOOP WHILE INKEY$ = ""
IF UCASE$(Q$) = "BLACK" THEN RETURN
LOCATE 1, 1: PRINT "WRONG!"
LOCATE 2, 1: PRINT "Press any key to continue . . ."
DO: LOOP WHILE INKEY$ = ""
RETURN
User avatar
donkeydude
Member
Member
Posts: 21
Joined: Thu Feb 26, 2004 9:05 pm

Post by donkeydude »

yeah, got qbasic. :D
Is it just regular BASIC, or is it different?
Interon

Post by Interon »

It is a more complicated version of BASIC. It uses most of the old BASIC commands so that you could open a BASIC file in QBasic and about 99% of the time it should run. However, QBasic has lots of extra stuff that BASIC doesn't. It's like comparing Windows 3.1 to Windows 95.
User avatar
donkeydude
Member
Member
Posts: 21
Joined: Thu Feb 26, 2004 9:05 pm

Post by donkeydude »

what, like more commands? sounds good...
:devil:
Interon

Post by Interon »

Yeah, that, and separate subroutines, and higher limits. It is a relatively new Basic, by Microsoft, a major player in the Basic programming language versions.
User avatar
Icedragon
Lord of Gaming
Lord of Gaming
Posts: 232
Joined: Sun Mar 21, 2004 4:18 am

Post by Icedragon »

QBasic is cool. I like downloading the games like nibbles and gorrila, and screwing with the colours.
**********
Icedragon
**********
laogaming

Post by laogaming »

AHHHHH!!! QBASIC AHHHHH!!!!!!! man i hated basic when i started it, i love c
ripster88
Member
Member
Posts: 26
Joined: Tue Jul 06, 2004 12:37 am

Post by ripster88 »

Where do you get Qbasic????
User avatar
emmzee
Site Admin
Site Admin
Posts: 2480
Joined: Sat Sep 14, 2002 2:25 pm
Location: Ontario, Canada

Post by emmzee »

You can download QBasic as part of the "old DOS" package, right from Microsoft's FTP site:

ftp://ftp.microsoft.com/softlib/mslfiles/olddos.exe
Owner / Webmaster of DOSGames.com for over 20 years

Download my free ebook: The Historical Reliability of the New Testament
Nixon

Post by Nixon »

Ya should get Qb 4.5 or higher cause you can make .exe with it.

try searching in google cuase I'm to lazy to find a link.

I been programmingin Qb for a few years, but firsat I started In zzt.
ripster88
Member
Member
Posts: 26
Joined: Tue Jul 06, 2004 12:37 am

Post by ripster88 »

I managed to find Qb 4.5. Thanks guys, I'm gonna try it out now.

Say, does any of you know where I could get some games so I can play around with them??? (I've already got the one above)
Interon

Post by Interon »

Invaders 1978 contains the source code
Game master pro

Post by Game master pro »

You can download QBasic as part of the "old DOS" package, right from Microsoft's FTP site:

ftp://ftp.microsoft.com/softlib/mslfiles/olddos.exe
I cant download it, it says "the page cannot be displayed thing" are you sure you got it right
User avatar
barok
Member
Member
Posts: 30
Joined: Sat May 15, 2004 7:13 pm
Location: bushlands of saskatchewan

Post by barok »

This site offers all versions of qb, including some vb downloads.

http://www.download-qb.tk/

if you wish to start qb, the site i recommend is this:

www.qbasic.com

a good site to show you what can be made in qb:

www.vplanet.cjb.net


btw interon, your program is horribly inefficient. you do way too many of the same checks over and over.

1 CLS
CLEAR
GOSUB QUESTION1
GOSUB QUESTION2

QUESTION1:
LOCATE 1, 1:INPUT "What is the capital of Canada?", Q$
answer$ = ucase$(Q$)
IF answer$ "OTTAWA" THEN CLS
LOCATE 1, 1: PRINT "Correct!"
LOCATE 2, 1: PRINT "Press any key to continue . . ."
DO: LOOP WHILE INKEY$ = ""
RETURN
endif
LOCATE 1, 1: PRINT "WRONG!"
LOCATE 2, 1: PRINT "Press any key to continue . . ."
DO: LOOP WHILE INKEY$ = ""
RETURN

QUESTION2:
LOCATE 1, 1:INPUT "What color is coal?", Q$
answer$ = ucase$(Q$)
IF answer$ = "BLACK" THEN CLS
LOCATE 1, 1: PRINT "Correct!"
LOCATE 2, 1: PRINT "Press any key to continue . . ."
DO: LOOP WHILE INKEY$ = ""
RETURN
endif
LOCATE 1, 1: PRINT "WRONG!"
LOCATE 2, 1: PRINT "Press any key to continue . . ."
DO: LOOP WHILE INKEY$ = ""
RETURN

furthermore you continually use do: loop while inkey$ = "". to make the code easier to read, easier on the fingers and to minimize syntax errors, you should create a waitkey subroutine that waits until a keypress.
Qbasic can do much more than you think!
Interon

Post by Interon »

Yeah, despite making 4 games, I'm still kind of an amateur.
User avatar
barok
Member
Member
Posts: 30
Joined: Sat May 15, 2004 7:13 pm
Location: bushlands of saskatchewan

Post by barok »

4 games isn't very many. Darkdread has over a dozen under his belt. Pity he's lost his interest in programming (again). He's starting to sound like micheal jordan. retires, comes back. retires again, comes back, etc. etc.

Being a good enough programmer to make a zelda quality game isn't easy either. I've been working on my game for what, two months? And it's still only a walkaround engine with scripted npc's. Currently i'm stuck with the bounding boxes for npc to npc collisions. It's very confusing. :shifty:

Btw, i'd like to take a look at your games. :laugh:
Qbasic can do much more than you think!
User avatar
Dogbreath
Admin
Admin
Posts: 4620
Joined: Sat Sep 14, 2002 7:02 pm
Location: In the back of a jacked-up Ford.

Post by Dogbreath »

Speaking of Darkdread, did he ever finish Curby/Curty/Curly/whatever the hell it was/ 3 and Mysterious Song 2? I remember playing the demo and being rather impressed, but his site went down shortly after that.
Interon

Post by Interon »

All 4 of them can be found on http://www.dosgamesonline.com

They are called Diamond Grabber 1, Diamond Grabber 2, Cribbage Solitaire, and Letter Targets. Source code is included in all 4 of them (released under the GNU GPL version 2).

Lots of spaghetti code with little or no comments. Also, I did not use the SUBs because I was in no mood to learn them.

However, the games work as I planned them (except for a tiny mathematical bug in Cribbage Solitaire that I could never fix, but I tried very hard).
barok_lazee

Post by barok_lazee »

you're talking about secret of cooey 3, right?

Do you have the mysterious song 2 demo? Think you could upload it somewhere or email it to me? I can't find it.

if you can, here's my email address. [email protected]

Darkdread's games

legend of lith
legend of lith 2
secret of cooey
secret of cooey 2
secret of cooey 3 (unfinished)
mattress warrior (not what you think!)
lianne in: the dark crown
black rhino
mysterious song
mysterious song 2 (unfinished)
distant promises (demo)
in the nocturne
legend of grimtold (unfinished)

there's probably more that i'm missing...
User avatar
Wally
King of the Carrot Flowers
Posts: 4714
Joined: Thu May 01, 2003 8:30 pm

Post by Wally »

if they were more detailed like commander keen they would be awesome :)

seeing a ^ run everywhere in diamond grabber isnt that exciting
Post Reply