How do you get a obj or turf to reconize your on top
Like or something...
/turf/Hedgemistrissisobnoxoius
icon = 'Idontusedemos!.dmi'
icon_state = "ReallyAnnoying"
Enter()
usr.isontop = 1
ID:173662
![]() Dec 2 2003, 3:22 pm
|
|
//The M is the var that the mob who entered it recieves. So in other words, if you were to have usr << "Your name is [M]' as the action of the Entered() proc, it would display "Your name is Darkfirewolf5", depending on who entered it. EXTREMELY wrong. Yes, M is the var that the mob who entered it receives... given that, why on earth would you have: usr << "Your name is [M]"?? That's a lie. M's name is M.name. usr's name is usr.name. usr's name might be M.name... IF M and usr happen to be the same mob... but if M and user were always automatically the same, then what would be the point of mentioning M to begin with? You would just say usr << "Your name is [usr.name]" and be done with it, no M in sight. The whole point of using M (or m or whatever) is it lets you have a way of referring to exactly the mob (or obj, actually) who entered it. You'd want to, in this case, type M as being mob/M, so that it lets you access mob variables, and you'd also want to put a check in there to make sure that it is in fact a mob, so you don't get run time errors when someone drops an item in this square Entered(mob/m) if (ismob(m)) m.ontop = 1 THAT, assuming mobs have an ontop variable, will set it to 1 when a mob enters this square. It doesn't matter who usr is ('caise if there's a teleport spell/command that sends others away, or a way to push people, or a way to have people follow you like a party, then you have no way of knowing who usr is with regards to m), only who m is. What you do with the ontop var is entirely up to you. It's worth mentioning that this code won't update itself when the mob leaves... you'd want to have a similar code in Exited() to do that. |
Hedgemistress wrote:
//The M is the var that the mob who entered it recieves. So in other words, if you were to have usr << "Your name is [M]' as the action of the Entered() proc, it would display "Your name is Darkfirewolf5", depending on who entered it. turf/Hedgemistrissisobnoxoius WHen I put something simillar to that in my code, it worked. I put: turf and to my amazement (just added that for dramitic scene lol), it said "DiZzyBonne". Now I'm confused lol =S. |
Here we put in nice, simple, easy to understand terms:
<FONT SIZE=8>JUST DO WHAT THE NICE LADY SAYS!</FONT> Thankyou. Yes, if you walk onto the turf, it will say that you are M, but if, say, an animated obj walked onto it, what would happen then? It'd be M, funnily enough. What if a magical flying piece of barbequed cheese roll with chocolate sprinkles flew onto the turf? That magical cheese roll would be M. |
Of course it works.
IN THAT CASE, you are the user AND you are M. What if you drop an item in the square? The item is M and you're usr. What if the game has pushing and someone pushes you into the square? You're M, the pusher is the user. What if a monster chases you and runs over the square, or you summon a pet and it appears in the square? You're usr, the monster or pet is M. If you're counting on the idea that the thing what entered is usr... then tell me why you bother to have an M to begin with. "Cause the demo did?" This is why I tell people to never, ever use a piece of code unless they understand it. Knowing what it's "supposed to do" isn't understanding. |
Like this: