Exit-Dependant Room Description Parent

This object lets you create rooms which show different descs when players enter them from different directions. For example, they might notice some object only if they come in from a certain door, etc.

Author: Javelin@M*U*S*H
Category: Building
Compatibility: CobraMUSH, PennMUSH.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Exit-Dependant Room Description Parent

@create Exit-Dep Room Desc Parent
@lock/Basic Exit-Dep Room Desc Parent==me
@lset Exit-Dep Room Desc Parent/Basic=no_inherit
@set Exit-Dep Room Desc Parent = VISUAL
@set Exit-Dep Room Desc Parent = NO_COMMAND
@ADESCRIBE Exit-Dep Room Desc Parent=@wipe me/from_%#
@set Exit-Dep Room Desc Parent/ADESCRIBE=no_command
@ASUCCESS Exit-Dep Room Desc Parent=think [switch(hastype(me,exit),1,set([loc(me)],FROM_%#:[num(me)]))]
@set Exit-Dep Room Desc Parent/ASUCCESS=no_command
@DESCRIBE Exit-Dep Room Desc Parent=[setq(0,v(from_%#))][switch(0,not(hastype(me,thing)),v(HOW_TO_USE),hastype(me,room),,strlen(%q0),ulocal(objective_desc,%#),hasattr(me,desc_%q0),ulocal(objective_desc,%#),ulocal(desc_%q0,%#))]
@set Exit-Dep Room Desc Parent/DESCRIBE=no_command visual public nearby
&DESC_#100 Exit-Dep Room Desc Parent=In the DESC_db# attributes, you put the desc that should be shown to someone who enters the room by going through the exit with dbref db#.
&HOW_TO_USE Exit-Dep Room Desc Parent=This object lets you create rooms which show different descs when players enter them from different directions. For example, they might notice some object only if they come in from a certain door, etc. To use it, @parent a room and all exits that lead into the room to this object. If player #5 walks through exit #100, the exit will set FROM_#5 on the room to be #100. The room desc shown to the player on entering will thus be DESC_#100, which should be whatever someone entering from that direction would see first. Once inside the room, a 'look' will show the OBJECTIVE_DESC.
&OBJECTIVE_DESC Exit-Dep Room Desc Parent=Here you put the desc that should be shown when someone standing in the room types 'look'. It's for looking around the whole room.
@SUCCESS Exit-Dep Room Desc Parent=[set(loc(me),FROM_%#:[num(me)])]
@set Exit-Dep Room Desc Parent/SUCCESS=no_command