ID:1507596
 
(See the best response by Koshigia.)
Under client
Code:
    Up()
var/area/A = usr.loc //creates a variable to hold usr.loc
if (A.up) usr.Move(locate(A.up)) //moves player north if possible
else usr << "You can't go there." //otherwise not
Down()
var/area/A = usr.loc //creates a variable to hold usr.loc
if (A.down) usr.Move(locate(A.down)) //moves player north if possible
else usr << "You can't go there." //otherwise not


I did the same thing I did for N,S,E,W directions but I get an undefined procedure error. Am I safe to assume that Up and Down aren't built in? and How do I go about changing it

Best response
Correct, Up() and Down() are not default procedures. You would have to make them yourself.

*edit*

Disregard the area thing. I read in the title that it's for a MUD, and I know that is one method for handling rooms in a MUD.


all you would have to do to define it is switch this...

client
Up()
var/area/A = usr.loc //creates a variable to hold usr.loc
if (A.up) usr.Move(locate(A.up)) //moves player north if possible
else usr << "You can't go there." //otherwise not
Down()
var/area/A = usr.loc //creates a variable to hold usr.loc
if (A.down) usr.Move(locate(A.down)) //moves player north if possible
else usr << "You can't go there." //otherwise not


to...

client
proc

Up()
var/area/A = usr.loc //creates a variable to hold usr.loc
if (A.up) usr.Move(locate(A.up)) //moves player north if possible
else usr << "You can't go there." //otherwise not
Down()
var/area/A = usr.loc //creates a variable to hold usr.loc
if (A.down) usr.Move(locate(A.down)) //moves player north if possible
else usr << "You can't go there." //otherwise not


Also, keep in mind that you will have to figure out how you want to use this procedure. Make it a verb, map to keyboard, etc etc
what I did was moved them to proc
and then called them with verbs, but your way seems more efficient.

*edit*
just read that you said I still had to verb them. lol. So I'm going to leave it how it is now.

also, are spaces and underscores not permitted in names? I keep getting a runtime error: Cannot read null.name, whenever I include a space or underscore in the area's name
this is valid
area/test_area
name = "Test Area"

There's two little known addendums to the direction macros:

step(mob,UP)
step(mob,DOWN)


You can literally use them just like any other direction:

step(mob,NORTH|UP)
step(mob,EAST|DOWN)
step(mob,NORTHWEST|UP)


You won't find much documentation on these, because they stopped being used heavily back in the DUNG days.
I realize I'm a little off topic, but I didn't want to start a new thread for this...

code:
Darkness                  //create a new area prototype
name = "Darkness"
desc = "You awake in a confined space, laying face up. You can move neither left or right. It's dark and you can only see a glimpse of light through a crack. You feel the touch of silk against your hands and sence a door above you."
up = "DarkCrypt"

DarkCrypt
name = "DarkCrypt"
desc = "Having forced the door open you feel a chill down your spine as you climb out of what you now know to be a Coffin. You seem to be in an underground crypt, several other coffins lay in two rows. A stairway leads up to the next floor."
up = "StGabrielsCathedralEasternTransept"


StGabrielsCathedralEasternTransept
name = "St Gabriels Cathedral Eastern Transept"
desc = "You're standing in the eastern most part, of the cross shaped cathedral of St. Gabriel."


mob
Login()
Move(locate("Darkness"))
..() //calls the parent

Move(area/A) //overrides mob's Move() proc
..() //calls the parent
src << "<b>[A.name]</b>"
src << A.desc //displays room description
src << "People here: \..."
for (var/mob/M in A) //loops through mobs in room, displaying each
if (M == src) src << "You \..."
else src << "[M] \..."


when I type up to goto St. Gabriel's I get:

runtime error: Cannot read null.name
proc name: Move (/mob/Move)
usr: Modenkye (/mob)
src: Modenkye (/mob)
call stack:
Modenkye (/mob): Move(null)
Up()
Modenkye (/mob): up()

I'm thinking the problem is in the src << "[A.name]" part of the code, and how it but I don't know what I'm doing wrong.

You're trying to move to a string?
Move(locate("stringname"))


And you're not creating a new area prototype with

Darkness


You're creating a new type of object. I mean, you could be SORTA making a new area prototype with

Darkness
parent_type = /area


But that's not the desired effect, is it?

Room
var
Num = 0 // Room number

ExitN = 0 // Exit numbers
ExitE = 0
ExitS = 0
ExitW = 0

New(var/num, var/N, var/E, var/S, var/W)
..()
src.Num = num
src.ExitN = N
src.ExitE = E
src.ExitS = S
src.ExitW = W

Del()
..()

proc
Entered(var/mob/M)
M << output("\nCurrent Room: [src.Num]","main_out")
if(!isnull(ExitN)) M << output("There is an exit to the north.", "main_out")
if(!isnull(ExitE)) M << output("There is an exit to the east.", "main_out")
if(!isnull(ExitS)) M << output("There is an exit to the south.", "main_out")
if(!isnull(ExitW)) M << output("There is an exit to the west.", "main_out")


What I've displayed here is my code on my own text-based RPG regarding moves. When a command is processed like "go north" I check for an exit to the north of the current room, and set a player "Current Room" variable (defined as such)
mob/Room/CurrentRoom ;

to the new room they enter. This new room is an INSTANCE OF THE ROOM OBJECT. So I have a new room object for every room I want to have.

I'm starting to think Zilal's tutorial is a bit broken.
I didn't realize you were using tags. It'll work fine as long as you define tags and instantiate objects properly.
Try to figure out what is going on with the "a" (it's supposed to be an /area). It appears as if it doesn't exist by the time the error occurs, or isn't being used as an argument to the Move() procedure.