ID:157790
 
So, I'm making an advanced party system and I cannot find out how to do this. All I need help with is making a custom "class" (as C/C++ would put it), then how to make something a part of that "class". Example:

["Class" Name]
-Name
-Age

("Object") is a ["Class"] and inherits all variables from it.

Then something like:
// ...
var/I = new(//The object that inherits all the variables)
I.name = "Test"
I.age = 5


If anyone understands what I'm trying to do here, please help me. Thanks!

~Hi1
They're called datums in DM. You create a custom datum the same you would to make a new mob.

mob/var

customClass/var
In response to Spunky_Girl
I figured I use datums, but wasn't sure. How would I create a new [object] of that datum?

I have:
PARTIES
var
name
members=list()

mob/verb/Create_Party(mob/M in oview(usr))
PARTIES/P //=new(?)
P.name = input("Enter name:","Name")
P.members += usr.name


I know it wont work, but how do I do that?
In response to Hi1
Exactly like creating a new atom...

new /atom

new /PARTIES
In response to Spunky_Girl
Ah! Thank you so much! :)
In response to Hi1
Hi1 wrote:
I figured I use datums, but wasn't sure. How would I create a new [object] of that datum?

I have:
> PARTIES //are you making PARTIES an obj?
> var
> name
> members=list()
>
> mob/verb/Create_Party(mob/M)//in oview(usr) is uneeded.
> PARTIES/P = new()
> P.name = input("Enter name:","Name")
> P.members += M.name
//IDK if you are talking about you being the party or adding someone to it. In this case the mob is you and you do not use usr.
>

I know it wont work, but how do I do that?
now you just add the New() proc.
In response to Gamekrazzy
Can you please stop replying to posts which the original poster had their questions done with? If you looked at the last post...
In response to GhostAnime
GhostAnime wrote:
Can you please stop replying to posts which the original poster had their questions done with? If you looked at the last post...
sorry, my bad