ID:177595
 
Whats the difference between

mob
verb
Edit(obj/M in view())

mob
        verb
                Edit(obj/M as obj|mob|turf|area in view())

and


thanx

DiZzyBonne
The first one assigns an obj, mob, turf, or area to the var obj/M, which probably would cause problems. The second one only allows you to select an obj.
In response to Garthor
Garthor wrote:
The first one assigns an obj, mob, turf, or area to the var obj/M, which probably would cause problems. The second one only allows you to select an obj.

Wrong, actually. Explanation in my other post.

Lummox JR
DiZzyBonne wrote:
Whats the difference between
mob
verb
Edit(obj/M as obj|mob|turf|area in view())
and
mob
verb
Edit(obj/M in view())

This confuses a lot of people. The difference does exist, and it's quite important.

The "as obj" modifier (also "as turf", "as mob|turf", etc.) is a way of telling the game that a verb can only allow certain types of input values--this is also useful for "as text", "as message", "as num", etc. The game passes this info on to the client, so the client automatically restricts your choices. Putting "in view()" and so on is another form of restriction that's applied by the client. The client can't get any more specific than a few general types, so you can't tell it to restrict your choices to just /mob/monster or /obj/food, for example.

On the other hand, just saying Edit(obj/M) isn't the same thing. What this does is to tell DM that for the rest of this verb, M should be treated as if it's an obj--either a regular generic /obj or one of the derived types like /obj/weapon. However--and this is very important--this doesn't gaurantee that M is actually an obj; all it does is tell the compiler to assume that it is. That means if you try to access an obj var and M is really a turf, your game could throw a runtime error.

Lummox JR