ID:150921
 
okay, i got a vague idea of src, but it seems to confuse me. i read up on it, and I understand it is the 'root' or whatever it said. i also know if i make a verb:

mob/player/verb/my_verb()
world << "[src] says 'word'!"

it will output their name and 'word'. i also know that:

obj/food/apple/verb/eat()
world << "[usr] eats [src]."

okay, now for some strange reason src does not confuse me. however it DID confuse me earlier. i'm just curious to how the compiler knows what src is. specially if you called several functions, from within other functions. (yeah, yeah, they are called procedures in DM, i know. its thats camned C++ settin in again! if this was C++ i'd understand everyhting 100%).

-ponder- okay i'm gonna post this for the hell of it. even though i forgot why src confused me. i'm gonan go read up on it and see if i can get it to confuse me again. then i'll let you know why. =P
On 7/3/01 7:13 am XgavinX wrote:
okay, i got a vague idea of src, but it seems to confuse me. i read up on it, and I understand it is the 'root' or whatever it said.

src is whatever object (not to be confused with obj) the verb or proc belongs to. It is similar to this in C++ (which always confused me, though src makes perfect sense... maybe if I review C++ now this will make more sense)

Whenever you manipulate a member variable in a proc without specifying the object, you are using the src variable.

For example:

obj/food/apple/proc/addone()
number++

is exactly the same as:
obj/food/apple/proc/addone()
src.number++

Once I realized this, src was easy to grasp.


-ponder- okay i'm gonna post this for the hell of it. even though i forgot why src confused me. i'm gonan go read up on it and see if i can get it to confuse me again. then i'll let you know why. =P

Since you understand it now, I'll go ahead and post for anyone else who is confused. A great deal of my DM learning came from watching what other people asked and the answers they recieved :)
In response to Shadowdarke
On 7/3/01 7:35 am Shadowdarke wrote:
On 7/3/01 7:13 am XgavinX wrote:
okay, i got a vague idea of src, but it seems to confuse me. i read up on it, and I understand it is the 'root' or whatever it said.

src is whatever object (not to be confused with obj) the verb or proc belongs to. It is similar to this in C++ (which always confused me, though src makes perfect sense... maybe if I review C++ now this will make more sense)

Whenever you manipulate a member variable in a proc without specifying the object, you are using the src variable.

For example:

obj/food/apple/proc/addone()
number++

is exactly the same as:
obj/food/apple/proc/addone()
src.number++

Once I realized this, src was easy to grasp.


-ponder- okay i'm gonna post this for the hell of it. even though i forgot why src confused me. i'm gonan go read up on it and see if i can get it to confuse me again. then i'll let you know why. =P

Since you understand it now, I'll go ahead and post for anyone else who is confused. A great deal of my DM learning came from watching what other people asked and the answers they recieved :)


hehe, thats waht I realised when I posted this. as i posted it and what i already knew, it kinda clicked and wasn't confusing any more. =P i looked into it more, and stiull nothing is confusing me yet. i must say, BYOND is much different from SMAUG(and much simplier, -ponder- course it seems to confuse me a lot)