ID:169863
Apr 21 2005, 1:32 pm
|
|
Hello all, I'm wondering, what exactly are Datums used for. When do you use them and why?
|
Apr 21 2005, 1:35 pm
|
|
Here's an excellent read: http://www.byondscape.com/ascape.dmb/LummoxJR.2002-0927/
|
I suggest reading Lummox's article that tenkuu linked you to, but just to clarify:
In DM, the datum is the ancestor of every object. It's the object that is the closest to the top of the object tree. Everything inherits from the /datum object! By definition, an atom is a mappable object. Therefore, if you want to make an object, but the object will never have to appear on the map, that object should be a datum! When you define something with no indnetation before it, the "datum/" is implied. Therefore, instead of defining a datum like so: datum/admin We're perfectly free to define it like this: admin "Admin?", you may ask, why would that be a datum? Well, you see, datums are often used as containers. For example, let's say that I want administrative verbs for my game. I need to store the verbs under an object, of course. Now, many beginning developers would, at this point, start defining verbs under a /mob/admin object. This method may work, but if the /mob/admin object will never appear on the map, why should it be a mob? For that matter, why should it be an atom at all?! Let's make it a datum! var/list/admins = list("Wizkidd0123","DragonMasterGod") That, of course, is only one of the hundreds of great uses for datums! You'll learn more by reading Lummox's article, and from there, try to find your own ways to use them! |
In response to tenkuu
|
|
Whoa, I never knew about what datums were or how they are used, but I've heard of them. I just never had the patience to look them up. Thank for the replies to this guy's thread, it helped me out as well.
|
In response to Wizkidd0123
|
|
Dude Wizkid, you and Lummox are great. Thank you guys for all of your help. I can always count on Lummox and Wizkid for the good advice.
|
In response to Wizkidd0123
|
|
is the ..() like a return thing?
|
You can also use them for skills and thing in generic RPGS:
Skill Then you just add the datum to a list for mobs, and call their Use() procedure when they're used. |