ID:164885
 
Ok, ive noticed alot of people using "M." in front of alot of stuff in their programs but i have absolutely no clue what that means. If someone could clear taht up for me itd be very helpful.

(sorry for the blant explanation, couldnt really sum it up any more.)
do you mean like for example:

mob/verb/blahblah(mob/M in world) //example


i think M is a mob, infact i feel sure
In response to Neo Shinryu (#1)
M is a variable and most people prefer it. You could replace that M from anything to "riiingdinnnggdinnnngddddkkkwooooo" to the letter Y. It really doesn't matter, it's just a variable that has all the traits of mobs (or objects, turfs, and areas, depending on what trait you give it).
Its a user-defined variable or argument (an argument being, in essence, a variable.) It doesn't matter what you call such things... you could call them M, you could call them Steve, you could call them, literally, whatever (as in "whatever.Move(that_place)".

A lot of people use the first initial of whatever category of atom (area, turf, obj, or mob) for their arguments, simply so you can tell at a glance what it's referring to... or because they saw other people do it and never wondered why.

Example:

The Entered() proc has a single argument, which is the atom which did the entering. You need to give that argument a name to refer to the thing in question, though.

A lot of people will use usr, under the assumption that usr will always be the one who entered... like follows:
turf/deathtrap/Entered()
usr.Die() //HA HA! YOU DIED!

That might seem dine and fandy in testing, because if you move your character into the deathtrap, you do indeed die (assuming you defined Die())... however, if you drop or throw an obj into the deathtrap, or push another character into the deathtrap... it'll kill you, because you're the usr.

So, you need to make use of the argument.

If you know you'll only ever care about mobs entering, you can do it like this:

turf/death/trap/Entered(mob/M)
if (ismob(M)) //because, remember, an obj could be dropped here.
M.Die()


You can also use this in verbs: kill(mob/M as mob in oview(1)). Note: letter "M" doesn't appear anywhere in the game, it's only internal to your code, and only to the proc in which it was defined. It's there so that you can refer to it.
In response to Hedgemistress (#3)
You want Entered() there, not Enter(). Enter() is called to say "Can I enter?". Entered is "I have entered". It is important - I've written several procs that use Enter() to figure out whether I can get into a turf for pathfinding purposes, etc.
In response to Jp (#4)
What are you talking about? I clearly used Entered(), not Enter(). I even double-checked by hitting the edit button to make sure that the, um, source code for the post was correct.

And it was.

So there.
In response to Hedgemistress (#5)
Hedgemistress wrote:
What are you talking about? I clearly used Entered(), not Enter(). I even double-checked by hitting the edit button to make sure that the, um, source code for the post was correct.

And it was.

So there.

lol no problem :)