Qbasicnews.com

Full Version: what's the point of type definition?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
If you're super-smart, you can do everything with arrays........ :o
Quote:If you're super-smart, you can do everything with arrays........ :o

and want your proggie super-slow. lol.
Not necessarily, man. Just because you don't see the code for structure X doesn't mean it's not there.
I find TYPES very useful for making record-length files:

Code:
TYPE CharacterType
Strength AS INTEGER
Speed AS INTEGER
Magic AS INTEGER
Health AS INTEGER
Mana AS INTEGER
Experience AS LONG
Picture AS STRING * 8
END TYPE

DIM PC as CharacterType

Location% = 1 'or whatever # your character is in the file...

OPEN "CHAR.DAT" FOR RANDOM AS #1 LEN = LEN(PC)
GET #1, Location%, PC
CLOSE #1
For an in depth explanation, go to
www.ethanwiner.com
download his book (WINER.ZIP)
unzip it and look in CHAP2.TXT
searching for the section heading called "USER DEFINED TYPE VARIABLES".
*****
You're really in love with this Winer guy aren't you?

Anyhow it's clear now. TYPEs are useless to me Big Grin
Ethan Winer's name appears on over 250 websites for his contributions to the music industry and especially the computer programming industry. Yes, I hold him in high regard for his expert knowledge of QuickBasic, and especially for his personal support and tutoring on this subject which he gave me several years ago.

Don't abandon TYPE variables altogether, just put them aside for possible use later.
*****
TYPES are not useless. Besides being organizational, they are good for using files and databases. Try and make a proper bitmap loader without using TYPE, and with. You can read headers in one statement. And with the addition of arrays within types it becomes even more useful.

PS. "Joe Antoon", "Toonski" and "Jofers" combine for a total of over 400 hits. Ethan Winer wrote a very good book, but I've never met the guy and there are people actually *in* the community that I hold in much higher regard.
"met"? How many people in the community you speak of have you actually met? If you mean, electronically I've "met" Ethan. He's a very likeable and very helpful guy. Smile Why are you underestimating someone you haven't met? I haven't been active in the community he was active in for a while, but he was quite active in it then. I don't doubt that he still is.
My community is people I've "met" Smile I underestimate people I havent "met". I guess that clears that up. (Hey, I never said he was a unlikeable or unhelpful)
Pages: 1 2 3 4