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 / do i understand types right?

Author
Message
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 12th Aug 2007 19:06
ok i have been learning about types (and i think they are awesome if i have it right)(all the tuts confuse and infuriates me) and do they act like variables but more organized and declared later in the program? tell me if i have the syntax right:

then how do i call all those variables and use those types?
PLEASE help me i am VERY desperate and i will love you forever!
thanks,
wicked

H4ck1d
18
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 12th Aug 2007 19:22
That's right, so the way that you could use it in a program is like so:



and then to access the variables would look like this:



etc, etc. Basically, you create a variable using the "as enemy" to make it the enemy type, and then to access the properties, such as health, name, etc, you put a period followed by the property name. Hope that was helpful!

wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 12th Aug 2007 19:24
what is the (10) in dim enemeys(10) as enemys?

Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 12th Aug 2007 19:55
It makes 10 of each of those types.


http://www.freewebs.com/zornoxstudios/
Learning C++ thanks DGDK
H4ck1d
18
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 12th Aug 2007 20:14
Yeah, honestly I've never declared a single variable as a type, because then you could really just use separate variables instead. Types are better used in arrays, where you have multiple things each having the same properties.

wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 12th Aug 2007 20:41
well i am making a RPG and i need easier commands to make objects so types are going to help

Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 12th Aug 2007 21:38
Quote: "what is the (10) in dim enemeys(10) as enemys?"


Quote: "It makes 10 of each of those types."


Array dimensions are zero-based. DIM ENEMYS(10) would create eleven array elements numbered 0 to 11. DIM ENEMIES(10) would do the same thing.

- Jane
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 12th Aug 2007 22:49
Quote: "would create eleven array elements numbered 0 to 11"

You mean numbered 0 to 10.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 13th Aug 2007 00:32
Benjamin -

Thank you. I stand corrected.

- Jane
H4ck1d
18
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 13th Aug 2007 07:21
touché

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 13th Aug 2007 23:09
Quote: "Yeah, honestly I've never declared a single variable as a type, because then you could really just use separate variables instead. Types are better used in arrays, where you have multiple things each having the same properties."


Types are a lot easier to comprehend though. When you get into variables like netSendDelay#, netSendTime#, for example. Its a lot easier to have net.send.delay#, net.send.time#, net.maxplayers, net.players, etc. I use types for every variable possible, usr.health, src(x).position, screen.resolution, etc etc.


Dazzag
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Cyprus
Posted: 14th Aug 2007 13:55
If one of the IDEs (show me if it exists and I have missed it as this is almost "killer app" for me) supported drop down type elements then that would be great. You know, the way VS does it for properties. eg. you setup a type of user, which has health, strength etc. Then when you type user. or user(10). then immediately a drop down of the elements in the type would show for choosing. Nice. Hmmm. Will add it to the Synergy Overlord request system now I think about it...

Cheers

I am 99% probably lying in bed right now... so don't blame me for crappy typing
Current fave quote : "She was like a candle in the wind.... unreliable...."

Login to post a reply

Server time is: 2024-11-26 11:43:14
Your offset time is: 2024-11-26 11:43:14