ID:152972
May 13 2005, 4:13 pm
|
|
I have read the developer faq on this and the dm guide,I still do not understand what they are for.
|
"..()" means "call the parent type's version."
mob //this is the parent type With that, if you were of type /mob you would see "1" output when your MyProc function was called. If you were of type /mob/sub_type, however, you would see "2". It is also important to note that built-in functions for the root type they were defined for will do their normal action when you use ..() Therefor, also there is not actually an /atom/movable/Login, you can still use ..() in /mob/Login and it will do its otherwise normal action. With the following, type /mob/sub_type will see both "1" and "2". mob As for return values, that brings a value over to the spot where the function was called. mob And, as Unknown Person said, "." is a variable that contains a return value. If the function ends without return being called, it will automatically return whatever "." equals. mob mob //mob's parent is /atom/movable We can use this in many ways. For my example I will bring up random battles brought up during movement for your typical RPG. You probably don't want a battle to occur if the player tried to walk into a wall and the movement failed. mob |
Every procedure has a variable named '.'. Simply, it is the default return value the procedure would have.
would be the same as
So what is good about it? The difference is that doing . = ..() would let you do the default stuff for the proc and still continue if you want to return it.
This would not say "You moved!" to the mob, because the proc would have already stopped.
This, however, would output "You moved!"
~~> Dragon Lord