Qbasicnews.com

Full Version: TYPE command and stuff like that
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey guys it's been awhile since I've been on since I have just undergone a move to a different part o' the states, so I need some help because for some reason all the forums got erased or something along with my questions.......

I had a problem with my program running out of string space, and so people told me to use TYPE

TYPE player
playername as string
weaponpower as int



so on


but what do you put here?

Close type
end type
type end

?? I forget, and then also....... how would you set the variables to what you want them to be? Someone told me - player.weaponpower = 3
or something like that but I don't know, is that right? Someone could help me out and it would be appreciated.. thanks.
You use END TYPE e.g.

TYPE Player
health as integer
END TYPE

You then need to make a variable/array of it as TYPE makes a data type not a memory place to hold the information.

You do it like this:

DIM Bob as Player

You can then use it like a normal variale via the fullstop. e.g.

Bob.health = 100

I hope that helps.
*sigh* another rtfm moment...:

http://qbasicnews.com/qboho/qcktype.shtml
*cries of joy*

[Image: bawling.gif]

[slogan]
...because these moments are really special...
[/slogan]
Hey Nova,

before postin' in this forum, I would have a look in the QB help. You know, there's a index of all QB commands. There you have to search for the command you want to know more about. On the following page you get info about this command and some examples.
Y know, what toonski said: R.T.F.M..
... or what i linked to *hugs my precious qboho*
Okay so I admit it, I am lazy and you guys know what you're going, okay? You don't have to rub it in.... Yeah, so, that helps quite a bit then thanks. Typing that (dim bob as player) that would make it shared right!? Just making sure, sorry, it's been awhile since I've been about these forums, so thanks guys.
woah, buddy, no need to get angry. "rtfm" was meant as a tip, not a putdown. dim SHARED variable(whatever) as x makes it shared.

http://qbasicnews.com/qboho/qckadvr.dimr.shtml
Quote:woah, buddy, no need to get angry. "rtfm" was meant as a tip, not a putdown. dim SHARED variable(whatever) as x makes it shared.

http://qbasicnews.com/qboho/qckadvr.dimr.shtml

That "f" in there tends to imply anger on the part of whoever's using the "rtfm" acronym.

(I in fact didn't learn about user-defined types from the "f---- manual." I learned about them, and QB's ability to handle them, from a book giving an example of how to call interrupts. Smile )
Pages: 1 2