ID:179535
 
I was only wondering what these procs mean:
..()
. = ..()
return ..()

I'm not sure when to put them, so I mostly look on some of the libraries or demos.
They all seem to have the same function as "return"
(to the n00b eye, of course).

Thx.
Cravens wrote:
I was only wondering what these procs mean:
..()
. = ..()
return ..()

I'm not sure when to put them, so I mostly look on some of the libraries or demos.
They all seem to have the same function as "return"
(to the n00b eye, of course).

Thx.

All they do is replace ..() with the default proc, ie:

mob/proc/Dance()
world << "[src] dances"

mob/Dance()
..()
world << "[src] looks like a moron."

the result will be:
"Ebonshadow dances"
"Ebonshadow looks like a moron."
In response to Ebonshadow
I thought it worked the other way around?

mob/dancer/Dance()
..()
usr << "Dancer Dances"

mob/Dance()
usr << "Just Dance"

leaves:

Dancer Dances
Just Dance

??
In response to Foomer
Ebon redefined it under mob, where he also defined it. No real point to that other than to show how it works. Yours wouldn't work, because you didn't define it at all (though I'm sure you meant to under mob). With yours, if a normal mob uses it, it just outputs
Just Dance
If a dancer uses it, it outputs
Just Dance
Dancer Dances
In response to Cinnom
Err, those should both be under /proc/...

Keep in mind I haven't actively programmed anything in a while.
Cravens wrote:
I was only wondering what these procs mean:
..()
. = ..()
return ..()

I'm not sure when to put them, so I mostly look on some of the libraries or demos.
They all seem to have the same function as "return"
(to the n00b eye, of course).

These are covered in the reference. If your proc overrides another proc, ..() calls the "old" version. The . value is the default return value for the current proc.

Lummox JR
In response to Foomer
Keep in mind that I've never even used redefining like this. My knowledge on it is probably a bit rusty.