Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Type tutorial (DBP)

Author
Message
Edgel
18
Years of Service
User Offline
Joined: 5th Jul 2006
Location: U.S.A
Posted: 21st Aug 2006 19:20 Edited at: 21st Aug 2006 19:21
This tutorial assumes you have a basic knoledge of DBP. I'm not sure if this tutorial will work on DBC. You need to know about variables and data types before you can understand types.

What is a type?
A type is a set of variables that are contained inside a larger catagory. You can use these variables again and again to make many items that have all the characteristics associated with the catagory.

How to make a type
You are given a challenge: make the properties in monopoly in DBP. This is when you need to use types. Each property must have a name, a price, and price per house, a starting rent, a rent with 1-4 houses, a rent with a hotel, a mortage, and a color. First we define all these characteristics of a "property"

As you can see, we created a type property. We then made a variable for each characteristic of a property, and defined what kind of variable it was. Now we just need to make different properties.

So we have made a variable name for mediterranean Avenue, and made it a property. Notice how there is a rem statement at the beginning. This is because though we want to be able to easily recognize what property it is, we want to variable name to be shorter, so we made a rem statement that shows what property it is. Then we gave it the values for each characteristic of a property. We can do this again and again, changing the name of Medit_Ave to anything we want, and it will become a property.

Hopefully now you have a better understanding of what types are and how to use them. Feel free to post questions if you have them, or errors if there are any().
Mickm
18
Years of Service
User Offline
Joined: 22nd Apr 2006
Location: Kingston, ON
Posted: 21st Aug 2006 19:40
Nice beginners tutorial.

One thing to remember is TYPES are excellent when you combine them with Arrays



Online Flash Games and Guides .::. http://www.gamestack.org
Online Notebook .::. http://onlinenotes.gamestack.org
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 21st Aug 2006 19:54 Edited at: 21st Aug 2006 19:55
Yeah, you can also make types using other types.



Edgel
18
Years of Service
User Offline
Joined: 5th Jul 2006
Location: U.S.A
Posted: 21st Aug 2006 20:37 Edited at: 21st Aug 2006 21:56
Yeah I probably should have included using arrays with types but I never really thought about using 2 types together. Thanks Zotoaster and Mickm.
Ligh
21
Years of Service
User Offline
Joined: 16th Nov 2003
Location:
Posted: 27th Aug 2006 18:32
can you declare an array in a type?

Login to post a reply

Server time is: 2024-11-27 09:43:10
Your offset time is: 2024-11-27 09:43:10