Types were not included in DBC only in DBPro so they should work, not sure why there not working for you, all I can suggest is check your code.
A type is basically a custom variable made up of other variables grouped together, think of it as a box partitioned into separate areas where different things can be stored based on what each area is defined as. First you have to define the type like :
type mytype
somevariable as string
somevariable2 as integer
x as float
endtype
Quote: "x as float"
- This creates a variable within the type which is set as a float (hence the 'as float'). The point behind it is, you have to tell DarkBasic what these different variables within your type will store. A float is used for holding numbers which contain a decimal point e.g. 56.784, whereas a string would be used for holding text like 'hello world' and an integer would be used for numbers which don’t contain a decimal point like '4576'.
Once this is done you then have to create an instance of your type in memory by defining a variable (a variable can be thought of as a box in which you can store some data) as your type, e.g.
You can then reference a section of your type like this:
- This will store the value 10.5 in the variable x within mytype.
The main reason you should be concerned about using different types of variables like float, string etc, is that most DBPro commands will only accept one type of variable, for example you couldn't pass a string to the position camera command without first converting it to a float, or integer. The real reason for different types of variables is to do with the way processors etc work; but you shouldn’t worry too much about that - and if you are interested there are plenty of web sites on the topic, just do a Google search.
Hmm, hopefully this didn’t turn out too confusing and makes some sense to you