ID:144111
 
This is the code I am inputing.

mob
verb
Summon(M as mob in world)
M.loc = locate(usr.x,usr.y-1,usr.z)



and this is the error:

maze.dm:119:error:M.loc:undefined var
Rahulio wrote:
This is the code I am inputing.

mob
verb
Summon(M as mob in world)
M.loc = locate(usr.x,usr.y-1,usr.z)



and this is the error:

maze.dm:119:error:M.loc:undefined var

Define M

mob/verb/Summon(var/mob/M in world)
M.loc=locate(src.x,src.y,src.z)
In response to Derekjeterisgod
Wrong. You are both doing it athe hard way...

        Summon(mob/M in world)
M.loc = usr.loc
In response to Revojake
Well Derek's wasn't wrong, just different than yours...

Yours is wrong in that, Rahulio wanted it to summon them one space below the usr

mob/verb/Summon(mob/M in world)
if(M.client)//optional, you may want to summon any mob
M.loc = locate(usr.x,usr.y-1,usr.z)

You could also do this...
mob/verb/Summon(client/M in world)
if(M.mob)//I like to play it safe most of the time.
M.mob.loc = locate(usr.x,usr.y-1,usr.z)


Hope that helps...

-KirbyAllStar
In response to KirbyAllStar
KirbyAllStar wrote:
You could also do this...
> mob/verb/Summon(client/M in world)


No, you couldn't.
I haven't tried, but perhaps you could without the actual 'in world' part. Thats the behaviour with for() object-loops, anyway.

Oh yeah, right, explaining. When you use the 'in' operator on an atom, that atom's contents list is used instead - using it directly is equivalent. The same is with the /world object - the thing is, the list world.contents contains all the /atoms in the world, but only atoms - so there aren't actually any datums or clients there.
In response to Kaioken
Oh, sorry then, I've never tried it with Clients, I always use mobs and check if they have clients. Thanks for the heads up, I'll know not to use that.

-KirbyAllStar