ID:261855
 
I found this following code snippet under the help < help on menu listed as . path operator, I do not understand why I would get this error. :\


area
var/area
north_exit
south_exit
east_exit
west_exit

Entered()
usr << name
return ..()

Castle
Main_Gate
north_exit = .Castle_Entryway
south_exit = .Moat_Bridge
Castle_Entryway
south_exit = .Main_Gate
Moat_Bridge
north_exit = .Main_Gate
south_exit = .Village/Guard_Post
Village
Guard_Post
north_exit = .Castle/Moat_Bridge
south_exit = .Square
Square
north_exit = .Guard_Post

//handle movement
client/Move(Dest,Dir)
var/area/room = usr.loc
if(istype(room)) //in a room
switch(Dir)
if(NORTH) Dest = room.north_exit
if(SOUTH) Dest = room.south_exit
if(EAST) Dest = room.east_exit
if(WEST) Dest = room.west_exit
return ..()

//set the starting position for new logins
mob/Login()
if(!loc) Move(locate(/area/Castle/Main_Gate))
return ..()

runtime error: Cannot execute null.Enter().
proc name: Move (/client/Move)
source file: Other.dm,42
usr: Shiba Arai (/mob)
src: Shiba Arai (/client)
call stack:
Shiba Arai (/client): Move(/area/Castle/Moat_Bridge (/area/Castle/Moat_Bridge), 2)
Something tells me you have no /area/Castle/Main_Gate on the map to locate. Is this true?
In response to Yota
Uh...what map? This is a text based game. :\
Its throwing you an error because of the usage I believe. I could be wrong, but the way you're trying to link the rooms together won't work. Zilal has a great tutorial that covers this kind of stuff, and I recommend you use it (I did). I'm actually working on a MUD myself...here's the way I do it, cut down to its simple pieces

//** Set up tags for each room, so they can be identified **//
world/New()
for (var/Atype in typesof(/area))
var/area/A = new Atype
A.tag = A.name
..()
//** Move the player from one room to the next **//
mob
Move(area/A)
..()
if (!src.client)
return
Location = A.name
src << "[A.desc]"
src << "Obvious Exits: \..."
if (A.north) src << "north \..."
if (A.south) src << "south \..."
if (A.east) src << "east \..."
if (A.west) src << "west \..."
if (A.northwest) src << "northwest \..."
if (A.northeast) src << "northeast \..."
if (A.southwest) src << "southwest \..."
if (A.southeast) src << "southeast \..."
src << ""
//** A basic room **//
area
Player_Start
desc = "An Ancient Temple\n\
You feel yourself appear and float to the ground in \
a bright flash. About this room there lay various pieces of \
used equipment. You can tell by the altar you are standing \
on that this room is where many people find themselves \
standing. A few other folks leave the room, and you figure \
you might as well follow their footsteps."
north = "Dusty Road1"
//** Obviously, you'll have to write the other directions **//
client
North()
var/area/A = usr.loc
if (A.north)
usr.Msg("You leave north.", "[usr] leaves north.")
usr.Move(locate(A.north))
oview() << "[usr] has arrived from the south."
else usr << "You cannot move that direction."
No put usr in Entered(). Ungh.

Lummox JR
In response to Ghaleon
area
var/area
north
south
east
west
dec
southwest
northeast
northwest
southeast
location

//** Set up tags for each room, so they can be identified **//
world/New()
for (var/Atype in typesof(/area))
var/area/A = new Atype
A.tag = A.name
..()
//** Move the player from one room to the next **//
mob
Move(area/A)
..()
if (!src.client)
return
Location = A.name
src << "[A.desc]"
src << "Obvious Exits: \..."
if (A.north) src << "north \..."
if (A.south) src << "south \..."
if (A.east) src << "east \..."
if (A.west) src << "west \..."
if (A.northwest) src << "northwest \..."
if (A.northeast) src << "northeast \..."
if (A.southwest) src << "southwest \..."
if (A.southeast) src << "southeast \..."
src << ""
//** A basic room **//
area
Player_Start
desc = "An Ancient Temple\n\
You feel yourself appear and float to the ground in \
a bright flash. About this room there lay various pieces of \
used equipment. You can tell by the altar you are standing \
on that this room is where many people find themselves \
standing. A few other folks leave the room, and you figure \
you might as well follow their footsteps."
north = "Dusty Road1"
//** Obviously, you'll have to write the other directions **//
client
North()
var/area/A = usr.loc
if (A.north)
usr.Msg("You leave north.", "[usr] leaves north.")
usr.Move(locate(A.north))
oview() << "[usr] has arrived from the south."
else usr << "You cannot move that direction."


Other.dm:26:error:Location:undefined var
Other.dm:54:error:usr.Msg:undefined proc
Stats.dm:2:error:src.dec:undefined var
Stats.dm:9:error:src.dec:undefined var

Entered()
usr << name
return ..()

As LummoxJR pointed out usr shouldn't be used in Entered(). Look up Entered() in the reference. It gets one parameter which is what is entering the tile. This is who/what you want to send the message to.

client/Move(Dest,Dir)
var/area/room = usr.loc
if(istype(room)) //in a room
switch(Dir)
if(NORTH) Dest = room.north_exit
if(SOUTH) Dest = room.south_exit
if(EAST) Dest = room.east_exit
if(WEST) Dest = room.west_exit

return ..()

Here's your big problem. ..() calls the default client/Move() proc and it expects two parameters a destination loc and a direction. So the parent function calls client.mob.Move(null,null) (Both parameters are null since you didn't pass anything to client/Move()). client.mob.Move() then tries to call dest.Enter(src) to see if the client's mob can enter dest, but dest is null since that was what was passed by client.Move(). This is where the null.Enter() problem comes up.

Long story short you need
return ..(Dest, Dir)
In response to Theodis
dest, dir, undefined var. Though they are defined. Sigh, this is taking forever.
In response to Shiba Arai
dest, dir, undefined var. Though they are defined. Sigh, this is taking forever.

Well you have Dest and Dir as your parameter list not dest and dir. There is quite a difference!
In response to Theodis
Theodis wrote:
As LummoxJR pointed out usr shouldn't be used in Entered(). Look up Entered() in the reference. It gets one parameter which is what is entering the tile. This is who/what you want to send the message to.

Unless the reference has been fixed, though, there are still gaping errors in all the Entered() entries; they all use usr.

Lummox JR
In response to Shiba Arai
I think I goofed up and cut out the declaration part of this. Oh well. Keep working on what Theodis and Lummox have going, it'll probably work just as well, and work nicer too.