DOS Games Message Board
DOS Games Discussion
A message board to talk about DOS games, get help, and find old games.
Do NOT post warez or abandonware requests please
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
NEW! DOSGames.com has been massively upgraded to v2.0 with TONS of new features!
Check out the new design and dozens of new features including online play!


Qbasic Programmers,I need some help.

 
Post new topic   Reply to topic    DOS Games Discussion Forum Index -> Game Creation
Author Message
tinman47
Lord of Gaming
Lord of Gaming


Offline
Joined: 24 Feb 2007
Posts: 230

PostPosted: Fri Apr 27, 2007 8:47 pm     Post subject: Qbasic Programmers,I need some help. Reply with quote

After a few weeks of studying QB,I finally have a grasp on QB(IN JUST 2 WEEKS! Laughing ).QB is awesome.It allows your dreams to come true with a few or alot of commands with no knowledge at all,just common sense.But anyway,I've been programming in QB today and I came across a problem;the SUB and GOSUB command.Without these two commands,I will have a much harder time making big games and apps.Reply your technique or even reply techniques for game design.Thank you. Sleeping
Back to top
dosraider
Admin
Admin


Offline
Joined: 15 Mar 2005
Posts: 9245
Location: ROTFLMAO in Belgium.

PostPosted: Sat Apr 28, 2007 3:34 am     Post subject: Re: Qbasic Programmers,I need some help. Reply with quote

tinman47 wrote:
After a few weeks of studying QB,.......with a few or alot of commands with no knowledge at all,...a problem;the SUB and GOSUB command.



Sorry for that.

Get real will ya ? If you even don't understand the SUB nor GOSUB lines, you hardly can state "I finally have a grasp on QB".
Put your lazyness aside and study a bit more. If you ever want to be able to program something : LEARN.
Back to top
emmzee
Site Admin
Site Admin


Offline
Joined: 14 Sep 2002
Posts: 2406
Location: Ontario, Canada

PostPosted: Sat Apr 28, 2007 9:47 am     Post subject: Reply with quote

Here's what seems to be a decent tutorial:

http://tedfelix.com/qbasic/

(It includes some info about how subs and functions work)
Back to top
Swiftcutter
Experienced Member
Experienced Member


Offline
Joined: 23 Jun 2005
Posts: 84

PostPosted: Sat Apr 28, 2007 11:07 am     Post subject: Reply with quote

A sub (subroutine) is like a mini-program that you can run from the main program. That way, instead of typing the same code over and over at different places in your program, you can just make it a sub and run that.

Here's an example. This program will generate three random numbers between 1 and 10 and print them to the screen.

Code:
'This part defines the sub. It must come before anything else in the program

SUB roll10

PRINT (INT(RND*10)+1)

END SUB

'This part is the main program. It runs (or "calls") the "roll10" sub three times.

RANDOMIZE TIMER
CLS

roll10
roll10
roll10


To keep things organized, Qbasic stores your subs separate from the main program code. Press F2 to access them.

Hope that helps. I'm moderately well-versed in Qbasic, so LMK if you have any more questions. :)
Back to top
tinman47
Lord of Gaming
Lord of Gaming


Offline
Joined: 24 Feb 2007
Posts: 230

PostPosted: Fri May 04, 2007 5:35 pm     Post subject: Reply with quote

Great,this completely solved my problem!

Thanks...

FOR DESTROYING THE EVIL IN MY SOUL... Malevolent
Back to top
Display posts from previous:   
Post new topic   Reply to topic    DOS Games Discussion Forum Index -> Game Creation All times are GMT - 5 Hours
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group and Ask an Expert
Also powered by Darren and the other admin and mods' hard work! ;)