how?

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

...

how?

Post by ... »

how do i stop a loop when some1 press a key without putting INPUT
Steve

Post by Steve »

Here is what you use:


Do

Print "some random crap"

IF Inkey$ = "s" Then System

Loop
mennonite

yeah! also

Post by mennonite »

depends on whether you want them to press a specific key or not...

if you want them to be able to press Any key:

Do

Print "some random crap"

Loop until inkey$ <> ""


also, to have them use ESC key:

Loop until inkey$ = chr$(27)
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

I will explain it (and guys, use the code tag!)

Code: Select all

do 'duh, starts the loop

DOYOURLOOPCRAP 'psuedo code

loop until inkey$ = Chr$(Scancode)
'the line above loops the loop until the a key keyboard buffer 
'(retrived by inkey$) is equal to a certain scancode. Then, if it is,
'it stops the loop. You can also use "loop until inkey$ <> "" because
'if no key is in the keyboard buffer, then it returns a null (nothing) 
Just thought you should understand it. I refused to do soooo many things because I didn't understand it. I hated it when Vic said just "to put &h3da, 0 in your code. Just do it." without an exclamation!!!
Image
User avatar
Zamaster
Veteran
Posts: 174
Joined: Wed Jun 15, 2005 1:51 pm

Post by Zamaster »

With you there 100%!
C:\DOS
C:\DOS\RUN
RUN\DOS\RUN
guest

Post by guest »

i'm ...
sorry i didn't read the stuff because i didn't know that this message board go so slow.
i waited like ten minutes and no reply so i left.
i figured out myself. Surprise that this is still here after a month.
now i want to know how to compile .bas to exe using v1.1 qb
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

it cannot be done. you must use qb 4.5 or above.
Image
guest

Post by guest »

i have another question
with qb 1.1, can you add background music?
like make it play during gameplay
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

Look up PLAY in the help index.

No, you cant do 3d. No, you cant play mp3s or wav. No you cant do multiplayer over the internet. No you cant write an OS.
What else.. Nope, I think that covers it.


By the way, the whole idea of a forum is that you post, and wait, usually a few days. This is not a chatroom.
I have left this dump.
guest

Post by guest »

thanks but i read a tutorial dat says u cood do 3d but i don't want to anyways
well can freebasic do those? can u tell me where to get it?
can things happen simultaneously in qb?
like have something moving without any relation with something else that is moving at the same time
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

Yes, you "can" do 3D in QB.. but YOU can't (And neither can I for that matter)

Moving on:
Spelling, learn it, use it. Dat is sum good shitz u no!

And on:
www.freebasic.net

Further down the line now:
No, QB is unable to multitask in any way. You can fake that by quickly switching between actions. Using a loop is very common, then determine what to do and when either by user input or using fixed algorithms.
Multiple variables, or even arrays are also good to know about.



Are you a troll?
I have left this dump.
... or guest or ????

Post by ... or guest or ???? »

thanks alot
but i think i could try to learn 3d... maybe not anytime soon

another question: is freebasic the same as quickbasic or does it use different codes or whatever you call it like LOCATE x, y
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

Its atleast 95% equivalent to QB....the main thing is anything that is 16 bit related is no more being it's a 32 bits language now. hence no memory problems, no DEF SEG statement, it has inline assembly which is a bit better code wise :-) if you need it :-). but remember that it's 32bit assembler, not 16 bits :-).

It has many more SCREEN modes and parameters, integrated mouse support...in short, you don't really have a good reason to stay with QB today. :-)
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
... or guest or ????

Post by ... or guest or ???? »

ok thanks although i had no idea what you mean by bits
i just need to know if the coding stuff is still the same
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

Um... 99%.... Its only a few things that FB doesn't do that QB does, but what more FB does makes up for it.....

btw, FBC alone is a commandline compiler, to start off you might like a IDE:
http://fbide.sourceforge.net/

The FBIde + FBC 0.14b is the best choice.... gives you the whole nine yards....

Also, help on FreeBASIC commands is here:
http://www.freebasic.net/wiki/wikka.php?wakka=FBWiki

You should find that is very much like QB.. :wink:

Also.. basicaly QB is 16bit and has issues with newer 32bit computers,... making FreeBasic compiling at 32bit better... :wink: ... As for what it totaly means, I don't keep up with.... just which is better... :lol:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
paulunknown

Post by paulunknown »

can anyone give me the code for the inkey$ of up down left right?
User avatar
The Awakened
Veteran
Posts: 144
Joined: Sun Aug 07, 2005 1:51 am

Post by The Awakened »

http://petesqbsite.com/sections/tutoria ... ycodes.txt


You CAN look this stuff up on the website before you come here. :wink:
"Sorry for beating you up with a baseball bat Julian, but I DID think that you were a samsquanch."
Seb McClouth

Post by Seb McClouth »

In answer to bits:

Well, when I was back in school, only 3 year ago, anywayz, we still learned about bits and bytes.
8) But to cut to the chase... 16 bit... if you know MS-DOS, that's 16 bit. 16 bit is some kind of boundry. Until we got windows 95 (I believe we actually got it before with WIndows NT) we were introduced to a new boundry, the 32 bit. This standard worked a couple of years, until we noticed we needed to cross the boundry again, giving us: tada: 64 bit. Just for the record: 32-bit works just fine.

Just for the record: the bits in this case have nothing to do with the bits, bytes, kbytes, mbytes, gbytes of the RAM memory or Harddrives etc.

Grtz
Seb
kalc
Coder
Posts: 34
Joined: Thu Aug 18, 2005 1:26 am
Location: Tasmania, Australia

Post by kalc »

LOCATE x,y is not really right. You usually use LOCATE y,x ... y down and x across.
INKEY$? I've finished with that.. GetKey now!
I need a pen
paulunknown

Post by paulunknown »

thanks
and i still use locate x, y
don't really matter
Post Reply