AHHHHHHH Im a newb and i cant remember how to clear the screen without clearing special items
I''m writing a text game in qbasic and i want hp,mp,gp in one corner of the screen, now i can do all that but i can''t clear the screen without clearing hp,mp,go
It depends on how your program is set up. If you have a section of the screen where you have graphics and then a section of the screen where you have text, you can clear one or the other using CLS 1 (clear graphics) or CLS 2 (clears text) You can set up the section that is text using:
VIEW PRINT topline TO bottomline
Otherwise, if you are only using text you''re just going to have to keep track of your variables for hp, mp and gl and maybe make a function (or sub) called something like "clearscreen" and have it include a call to CLS but right after that print out the hp, mp and go where you want them. Maybe something like
DECLARE SUB ClearScreen
SUB ClearScreen (hitpoints, magicpoints, gold)
CLS
LOCATE x, y ''where you want to print
PRINT "Hit Points = ", hitpoints
LOCATE x1, y1
PRINT "Magic Points = ", magicpoints
LOCATE x2, y2
PRINT "Gold = ", gold
END SUB
keep in mind, it has been years since I have programmed in QBasic and I don''t know if that code will work but you can try it out. I found a couple good QBasic references on the web by searching for "QBasic syntax" on google.com
good luck,
bcj
VIEW PRINT topline TO bottomline
Otherwise, if you are only using text you''re just going to have to keep track of your variables for hp, mp and gl and maybe make a function (or sub) called something like "clearscreen" and have it include a call to CLS but right after that print out the hp, mp and go where you want them. Maybe something like
DECLARE SUB ClearScreen
SUB ClearScreen (hitpoints, magicpoints, gold)
CLS
LOCATE x, y ''where you want to print
PRINT "Hit Points = ", hitpoints
LOCATE x1, y1
PRINT "Magic Points = ", magicpoints
LOCATE x2, y2
PRINT "Gold = ", gold
END SUB
keep in mind, it has been years since I have programmed in QBasic and I don''t know if that code will work but you can try it out. I found a couple good QBasic references on the web by searching for "QBasic syntax" on google.com
good luck,
bcj
If you are using any graphical screens (7-13), you can simply add a line statement:
LINE (x1,y1)-(x2,y2), colr, BF
Where...
x and y 1 are the upper left point
x and y 2 are the lower right point
colr is the background color (0 = black)
BF is NOT TO BE CHANGED, as this placed a filled box to the area instead of a straight line!!!
<<================>>
Brian Wright
afn49482@hotmail.com
<<================>>
LINE (x1,y1)-(x2,y2), colr, BF
Where...
x and y 1 are the upper left point
x and y 2 are the lower right point
colr is the background color (0 = black)
BF is NOT TO BE CHANGED, as this placed a filled box to the area instead of a straight line!!!
<<================>>
Brian Wright
afn49482@hotmail.com
<<================>>
<<================>> Brian Wrightafn49482@hotmail.com<<================>>
If, later on, you are still having trouble, there is a great book I used to make games on QBasic(years ago). It''s called The Revolutionary Guide to QBasic. It''s really good and explains everything that you could want about creating games and/or mastering QBasic. Good luck!
"Remember, I'm the monkey, and you're the cheese grater. So no messing around."
-Grand Theft Auto, London
"It's not whether I win or lose, as long as I piss you off"
-Morrigan, Super Puzzle Fighter II Turbo
"Remember, I'm the monkey, and you're the cheese grater. So no messing around."
-Grand Theft Auto, London
"It's not whether I win or lose, as long as I piss you off"
-Morrigan, Super Puzzle Fighter II Turbo
D:
WARNING-I''M ABOUT TO BETRAY MY LEVEL OF NERDINESS
you COULD write to different text pages. 40x25 has 8, 80x25 has 4. i believe, if i remember correctly, that it has to do with the SCREEN command, or the PAGE command.
but anyway, you can write to any page with POKE, and read from it with PEEK, as long as you DEF SEG=&HB800
the text page is divided into pairs of bytes with char/attribute. 40x25 takes up 2048 bytes, and a 80x25 takes up 4096 bytes.
you COULD write to different text pages. 40x25 has 8, 80x25 has 4. i believe, if i remember correctly, that it has to do with the SCREEN command, or the PAGE command.
but anyway, you can write to any page with POKE, and read from it with PEEK, as long as you DEF SEG=&HB800
the text page is divided into pairs of bytes with char/attribute. 40x25 takes up 2048 bytes, and a 80x25 takes up 4096 bytes.
Get off my lawn!
is there any possible way to ''de-compile'' qbasic programs?
I once made a really cool QB4.5 program and after a hard drive crash, all I had left was the exe, but not the source, and I''d really like to see what the hell I was doing... heh.
===============================================
"Tell brave deeds of war."
Then they recounted tales, -- "There were stern stands And bitter runs for glory."
Ah, I think there were braver deeds.
I once made a really cool QB4.5 program and after a hard drive crash, all I had left was the exe, but not the source, and I''d really like to see what the hell I was doing... heh.
===============================================
"Tell brave deeds of war."
Then they recounted tales, -- "There were stern stands And bitter runs for glory."
Ah, I think there were braver deeds.
This is my signature. There are many like it, but this one is mine. My signature is my best friend. It is my life. I must master it as I must master my life. My signature, without me, is useless. Without my signature, I am useless.
I don''t think there''s any way to de-compile a QB .exe into QB code. Perhaps there''s some way you can de-compile it into asm...
/. Muzzafarath
/. Muzzafarath
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Last I heard, there WAS some guy trying to make the start of an .EXE unassembler for QB. Try the QCity section of tek.zext.net and you might just find it.
As for the CLS question, if my $#%&ing programming site was up yet it might have provided some info, but noooo... damn local server.
Aah, the olden days of QBasic.
As for the CLS question, if my $#%&ing programming site was up yet it might have provided some info, but noooo... damn local server.
Aah, the olden days of QBasic.
Bradley Mason Shaw Bond
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement