//This is a test mud created by Ginnungagap.
world
New() //overrides the world's New() proc
for (var/Atype in typesof(/area)) //loops through area prototypes
var/area/A = new Atype //creates a new instance of each prototype
A.tag = A.name //makes its tag the same as its name
..() //calls the parent
mob
Login()
Move(locate("r00001"))
..()
new /obj/blade (loc)
Move(area/A) //overrides mob's Move() proc
..() //calls the parent
src << "<b>[A.name]</b>"
src << A.desc //displays room description
src << "\nPeople here: \..."
for (var/mob/M in A) //loops through mobs in room, displaying each
if (M == src) src << "You \..."
else src << "[M] \..."
src << "\nStuff here: \..."
for (var/obj/O in A) src << "[O] \..."
src << "\nExits: \..." //displays any exits
if (A.north) src << "north \..."
if (A.south) src << "south \..."
if (A.east) src << "east \..."
if (A.west) src << "west \..."
src << "" //forces carriage return
area
var
north
south
east
west
r00001
desc = "You're in the center of what appears to be a MUD. Are you a nerd, or what?"
east = "r00002"
west = "r00003"
south = "r00004"
north = "r00005"
r00002
west = "r00001"
east = "r00006"
r00003
east = "r00001"
r00004
north = "r00001"
r00005
south = "r00001"
r00006
west = "r00002"
east = "r00007"
r00007
west = "r00006"
mob
var/HP = 100
var/MaxHP = 100
mob/verb/look(O as obj|mob in view()) //look command with health of target
if(ismob(O))
var/mob/mob = O
src << "You see [mob]."
if(mob.desc) src << mob.desc
switch(round((mob.HP/mob.MaxHP)*100))
if(0 to 19)
src << "[mob] is near death."
if(20 to 39)
src << "[mob] is seriously injured."
if(40 to 59)
src << "[mob] has some big cuts and bruises."
if(60 to 79)
src << "[mob] has some scratches."
if(80 to 99)
src << "[mob] is in good condition."
else
src << "[mob] is in perfect health."
mob/verb/l(O as obj|mob in view()) //look command with health of target - shortened to "l"
if(ismob(O))
var/mob/mob = O
src << "You see [mob]."
if(mob.desc) src << mob.desc
switch(round((mob.HP/mob.MaxHP)*100))
if(0 to 19)
src << "[mob] is near death."
if(20 to 39)
src << "[mob] is seriously injured."
if(40 to 59)
src << "[mob] has some big cuts and bruises."
if(60 to 79)
src << "[mob] has some scratches."
if(80 to 99)
src << "[mob] is in good condition."
else
src << "[mob] is in perfect health."
else if(isobj(O))
var/obj/obj = O
src << "You look at [obj]."
if(obj.desc) src << obj.desc
else src << "It looks rather ordinary."
mob
verb
emote(msg as text) //what the usr types is passed in
usr << "Everyone sees:" //the usr sees the first message;
view() << "[usr] [msg]" //the whole room sees the second one
say(msg as text) //what the usr says is passed into "msg" as text
Msg23("You say, '[msg]'","[usr] sa ys, '[msg]'") //gives our task to Msg23
wave(var/mob/M as mob in oview()) //waves to a mob in oview()
Msg223("You wave to [M].",target = M,"[usr] waves to you.","[usr] waves to [M].")
inventory()
usr << "You are carrying:"
for (var/obj/O in usr.contents) usr << O
mob
verb
inv()
usr << "You are carrying:"
for (var/obj/O in usr.contents) usr << O
mob
var
tmp
has_hands = 1
wielded
mob
rat
name = "giant rat"
desc = "This is one HUGE rat!"
has_hands = 0
obj
blade
name = "blade"
desc = "You see a long blade before you, crafted out of iron."
var
wielded
wielded = 1
verb
wield()
usr << "You wield [src]."
suffix = "(wielded)"
usr.wielded = src
remove()
usr << "You stop wielding [src]."
suffix = null
usr.wielded = null
drop(var/obj/O as obj in oview())
usr << "You drop [src]."
suffix = null
usr.wielded = null
O.loc = usr.loc
get(var/obj/O as obj in oview())
Msg23("You get [O].","[usr] gets [O].")
O.loc = usr.contents
mob
verb
get(var/obj/O as obj in oview())
Msg23("You get [O].","[usr] gets [O].")
O.loc = usr.contents
drop(var/obj/O as obj in oview())
usr << "You drop [src]."
suffix = null
usr.wielded = null
O.loc = usr.loc
proc
Msg223(second1,target,second2,third)
usr << second1 //outputs first text string to usr
target << second2 //outputs second text string to verb target
for (var/mob/M in oview()) //outputs third to mobs in view() who are neither
if (M != target) M << third
Msg23(second,third) //declares a new proc that takes 2 arguments
usr << second //outputs the first to the usr
oview() << third //outputs the second to oview()
client //overrides the client's North() proc
North()
var/area/A = usr.loc //creates a variable to hold usr.loc
if (A.north) usr.Move(locate(A.north)) //moves player north if possible
else usr << '"You can't go in that direction!" //otherwise not
client
South()
var/area/A = usr.loc
if (A.south) usr.Move(locate(A.south))
else usr << "You can't go in that direction!"
client
East()
var/area/A = usr.loc
if (A.east) usr.Move(locate(A.east))
else usr << "You can't go in that direction!."
client
West()
var/area/A = usr.loc
if (A.west) usr.Move(locate(A.west))
else usr << "You can't go in that direction!"
Problem description:
Currently my look (and "l") command only looks for an obj or a mob - how do I make it repeat the process that occurs when you enter a room instead? (shows a.desc, mobs in room, items in room, exits)
Edit: what I meant to say is, how do I allow my look command to also be able to show the room you're in if no argument is added. (i.e. just typing "look" instead of "look [obj]")
Thank you kindly.
Edit: Specifically, I mean you don't have to put which area is in which direction, you would just put actual exits on the map, and you can't get into the next area unless you go through that exit.
At any rate, to the question at hand. Look up area > procs > Enter() in the reference. Then, this should do what you want.