That's probably the most common question in the beginner's forum. Do a search in this forum, and I'm sure you'll see lots of information with examples, etc. You can also read articles on blitzcoder.
In a nutshell, types (more formally, Custom Types -- since integer, float, and string are all built-in types, but also types nonetheless) allow you to define your own variable type in Blitz. Each custom type has certain attributes, which can be made of other types.
You define a custom type like this, for example:
Once you've defined the type, you can create variables for that type like this:
"P1" is the variable name, "Player" is the type, and since it's a custom type, it's designated with a ".".
Once you've defined the type and have a variable, you can create an instance of your type:
(You can also declare the variable and create a new type instance in one shot, like this)
Whenever you create a new type instance (with the New keyword), it automatically gets put into an internal linked list. There is one linked list for each kind of custom type. See "First" and "Last", etc.
You can change and access the attributes of P1 like this:
Well, I guess that's more than a nutshell. And actually, I only spoke a little bit on how to use types -- not much on why they're useful, etc. With this as a start, I recommend you read the forums, articles, online docs, etc. You'll pick it up in no time.
In a nutshell, types (more formally, Custom Types -- since integer, float, and string are all built-in types, but also types nonetheless) allow you to define your own variable type in Blitz. Each custom type has certain attributes, which can be made of other types.
You define a custom type like this, for example:
Type Player Field Name$ Field Age% End Type
Once you've defined the type, you can create variables for that type like this:
P1.Player
"P1" is the variable name, "Player" is the type, and since it's a custom type, it's designated with a ".".
Once you've defined the type and have a variable, you can create an instance of your type:
P1 = New Player
(You can also declare the variable and create a new type instance in one shot, like this)
P1.Player = New Player
Whenever you create a new type instance (with the New keyword), it automatically gets put into an internal linked list. There is one linked list for each kind of custom type. See "First" and "Last", etc.
You can change and access the attributes of P1 like this:
P1\Name = "Zaphod Beeblebrox" P2\Age = 42
Well, I guess that's more than a nutshell. And actually, I only spoke a little bit on how to use types -- not much on why they're useful, etc. With this as a start, I recommend you read the forums, articles, online docs, etc. You'll pick it up in no time.