Abducted Pixels

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
(Xus)
Abducted Pixels

Post by (Xus) » Sun Jan 23, 2005 11:12 pm

Someone help me before I go insane; i dimension all my arrays with (width * height)/2 + 2 like I am supposed to, but whenever I BLOAD a tile I dimensioned in the same way, four pixels are missing at the bottom right, all along the bottom border. I'm going crazy with frustration trying to figure out why, and I don't think I'll last much longer. Please help.

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Sun Jan 23, 2005 11:35 pm

Can I see your code? That's probably the only way I can help.
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

(Xus)

Post by (Xus) » Mon Jan 24, 2005 9:25 pm

How do I get this thing to display code?[/code]

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Tue Jan 25, 2005 1:27 am

The easiest way is to just paste the code in and highlight it. Then just hit the code tag up by the message title. ;)
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

(Xus)

Post by (Xus) » Wed Jan 26, 2005 11:57 pm

I'm using 4.5, so it won't let me copy and paste to this window, and it won't open correctly on Notepad, is what I'm saying. I also tried opening on 1.1 and then opening THAT on Notepad, but to no avail. I've concluded, however, that all the problems lie in my file save/load system. I currently use BSAVE/BLOAD. Would Open...Close work better perhaps? If so, how would I use those commands with an array image?

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Thu Jan 27, 2005 8:26 am

To post your code on a message board:

While you are using QBasic, goto FILE, SAVE AS...

You will then see a FORMAT box. In that box, click on TEXT(readable by other programs)... that will save it in ASCII format, instead of BINARY.

Then you can open the file from notepad without getting all the strange binary characters. ;)

QB 1.1 does not open binary files. :cry:

I would highly reccomend to use BLOAD to load images that were saved with BSAVE. They were meant to be used together. There ixs an example program in the QB online help file... You might wanna check it out. ;)

Otherwise, If you want to write your own image loader, check this site out. It has the specs for just about every file format you could ask for. :P

http://www.wotsit.org/


Just look for what you want, take your time, try your best and post some code when you have a problem that you cannot solve. ;)
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

(Xus)

Post by (Xus) » Fri Jan 28, 2005 1:46 am

Holy crap! I had no idea QBasic could save in other formats. Cool. Thanks for all your help. I've now got a slew of things to try before the end of the week, and then I can evaluate them all and opt for the most eficient course of action. Thanks again.

(Xus)

Post by (Xus) » Fri Jan 28, 2005 9:44 pm

Question of interest, more than need. Answer only if you'd like to. Could I create a file for my array with open/close rather than bsave, and then save it the same way? If so, would I open as type binary? Then, how would I actually go about reading the array into BASIC? Remember, answer only if you wish. I was just curious.

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Sun Jan 30, 2005 11:25 am

Yeah, you could do it that way.

Assuming you have the image drawn in the upper left hand corner, you could do something like this...

Code: Select all

'For SAVING
Open MyFile$ for Output as #1
 For y=0 to imageheight
    For x=0 to imagewidth
       PixelColor$ = STR$(Point(X,Y))
       Print #1, PixelColor$
    Next
 Next
Close #1

Code: Select all

'For LOADING
Open MyFile$ for Input as #1
 For y=0 to imageheight
    For x=0 to imagewidth    
      Input #1, PixelColor$
      PSET(X,Y), VAL(PixelColor$)
    Next
 Next
Close #1

See how it works? ;)
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

Ralph
QBasic God
Posts:134
Joined:Sat Nov 06, 2004 2:27 am
Location:Katy, Texas

Post by Ralph » Sun Jan 30, 2005 9:24 pm

The good Dr_Davenstein may be insane, but he sure knows his programming! My hat is off to you!
Ralph. Running QuickBASIC Version 4.5, Windows XP Home Edition, Version 2002, Service Pack 2, and HP LaserJet 4L printer.

(Xus)

Post by (Xus) » Tue Feb 01, 2005 1:14 am

Tru. True indeed. I thank all that care.

User avatar
~XUS~
Full Member
Posts:27
Joined:Tue Feb 01, 2005 9:08 pm
Contact:

Post by ~XUS~ » Wed Feb 02, 2005 10:36 pm

This is a test. Yay! I'm a member!
Justly is our impending doom thrust upon us, for mightily did we scar Gaia with our conquest out of laze, and so long coming has been our demise. You have been warned. The anguish is yours. -Aaron-

User avatar
~XUS~
Full Member
Posts:27
Joined:Tue Feb 01, 2005 9:08 pm
Contact:

Post by ~XUS~ » Wed Feb 02, 2005 10:38 pm

What's this about a "nebie" under my name?!
Justly is our impending doom thrust upon us, for mightily did we scar Gaia with our conquest out of laze, and so long coming has been our demise. You have been warned. The anguish is yours. -Aaron-

Dr_Davenstein
QBasic God
Posts:166
Joined:Tue Mar 25, 2003 12:45 am
Location:U.S.A.
Contact:

Post by Dr_Davenstein » Thu Feb 03, 2005 6:58 am

Newbie!!! You are a noob!!!!!!!!

Just kidding. :lol:

I think it changes with how long you've been a member, or how many posts you have made... or something. :lol:
Come check out [url=http://www.freebasic.net/forum/index.php]FreeBASIC[/url]. The syntax is based on QuickBasic, but it expands to use pointers, operator overloading, etc... The list goes on and on!

User avatar
~XUS~
Full Member
Posts:27
Joined:Tue Feb 01, 2005 9:08 pm
Contact:

Post by ~XUS~ » Thu Feb 03, 2005 8:52 pm

Hmmm... Ranks in message boards. What an innovative idea.
Justly is our impending doom thrust upon us, for mightily did we scar Gaia with our conquest out of laze, and so long coming has been our demise. You have been warned. The anguish is yours. -Aaron-

Post Reply