ds2.1.1/bin/
ds2.1.1/extra/wolfpaw/
ds2.1.1/lib/cmds/admins/
ds2.1.1/lib/cmds/common/
ds2.1.1/lib/cmds/creators/include/
ds2.1.1/lib/cmds/creators/include/SCCS/
ds2.1.1/lib/daemon/services/
ds2.1.1/lib/doc/
ds2.1.1/lib/doc/efun/all/
ds2.1.1/lib/doc/efun/arrays/
ds2.1.1/lib/doc/efun/buffers/
ds2.1.1/lib/doc/efun/compile/
ds2.1.1/lib/doc/efun/floats/
ds2.1.1/lib/doc/efun/functions/
ds2.1.1/lib/doc/efun/general/
ds2.1.1/lib/doc/efun/mixed/
ds2.1.1/lib/doc/efun/numbers/
ds2.1.1/lib/doc/efun/parsing/
ds2.1.1/lib/doc/faq/
ds2.1.1/lib/doc/hbook/
ds2.1.1/lib/doc/help/classes/
ds2.1.1/lib/doc/lpc/basic/
ds2.1.1/lib/doc/lpc/concepts/
ds2.1.1/lib/doc/lpc/constructs/
ds2.1.1/lib/doc/lpc/etc/
ds2.1.1/lib/doc/lpc/intermediate/
ds2.1.1/lib/doc/lpc/types/
ds2.1.1/lib/doc/misc/
ds2.1.1/lib/doc/old/
ds2.1.1/lib/domains/Ylsrim/
ds2.1.1/lib/domains/Ylsrim/adm/
ds2.1.1/lib/domains/Ylsrim/armor/
ds2.1.1/lib/domains/Ylsrim/broken/
ds2.1.1/lib/domains/Ylsrim/fish/
ds2.1.1/lib/domains/Ylsrim/meal/
ds2.1.1/lib/domains/Ylsrim/npc/
ds2.1.1/lib/domains/Ylsrim/obj/
ds2.1.1/lib/domains/Ylsrim/virtual/
ds2.1.1/lib/domains/Ylsrim/weapon/
ds2.1.1/lib/domains/campus/adm/
ds2.1.1/lib/domains/campus/etc/
ds2.1.1/lib/domains/campus/meals/
ds2.1.1/lib/domains/campus/npc/
ds2.1.1/lib/domains/campus/txt/ai/charles/
ds2.1.1/lib/domains/campus/txt/ai/charles/bak2/
ds2.1.1/lib/domains/campus/txt/ai/charles/bak2/bak1/
ds2.1.1/lib/domains/campus/txt/ai/charly/
ds2.1.1/lib/domains/campus/txt/ai/charly/bak/
ds2.1.1/lib/domains/campus/txt/jenny/
ds2.1.1/lib/domains/default/creator/
ds2.1.1/lib/domains/default/doors/
ds2.1.1/lib/domains/default/etc/
ds2.1.1/lib/domains/default/weap/
ds2.1.1/lib/domains/town/doors/
ds2.1.1/lib/domains/town/txt/
ds2.1.1/lib/domains/town/txt/shame/
ds2.1.1/lib/domains/town/virtual/
ds2.1.1/lib/lib/comp/
ds2.1.1/lib/lib/lvs/
ds2.1.1/lib/lib/user/
ds2.1.1/lib/lib/virtual/
ds2.1.1/lib/log/
ds2.1.1/lib/obj/book_source/
ds2.1.1/lib/obj/include/
ds2.1.1/lib/realms/template/
ds2.1.1/lib/realms/template/area/armor/
ds2.1.1/lib/realms/template/area/npc/
ds2.1.1/lib/realms/template/area/obj/
ds2.1.1/lib/realms/template/area/room/
ds2.1.1/lib/realms/template/area/weap/
ds2.1.1/lib/realms/template/bak/
ds2.1.1/lib/realms/template/cmds/
ds2.1.1/lib/save/kills/o/
ds2.1.1/lib/secure/cfg/
ds2.1.1/lib/secure/cfg/classes/
ds2.1.1/lib/secure/cfg/races/SCCS/
ds2.1.1/lib/secure/cmds/creators/include/
ds2.1.1/lib/secure/cmds/players/
ds2.1.1/lib/secure/cmds/players/include/
ds2.1.1/lib/secure/daemon/include/
ds2.1.1/lib/secure/lib/
ds2.1.1/lib/secure/lib/include/
ds2.1.1/lib/secure/lib/net/
ds2.1.1/lib/secure/lib/net/include/
ds2.1.1/lib/secure/lib/std/
ds2.1.1/lib/secure/modules/
ds2.1.1/lib/secure/npc/
ds2.1.1/lib/secure/obj/include/
ds2.1.1/lib/secure/room/
ds2.1.1/lib/secure/save/
ds2.1.1/lib/secure/save/boards/
ds2.1.1/lib/secure/verbs/creators/
ds2.1.1/lib/shadows/
ds2.1.1/lib/spells/
ds2.1.1/lib/verbs/admins/include/
ds2.1.1/lib/verbs/common/
ds2.1.1/lib/verbs/common/include/
ds2.1.1/lib/verbs/creators/
ds2.1.1/lib/verbs/creators/include/
ds2.1.1/lib/verbs/players/include/SCCS/
ds2.1.1/lib/verbs/rooms/
ds2.1.1/lib/verbs/rooms/include/
ds2.1.1/lib/www/errors/
ds2.1.1/lib/www/images/
ds2.1.1/v22.2b14/
ds2.1.1/v22.2b14/ChangeLog.old/
ds2.1.1/v22.2b14/Win32/
ds2.1.1/v22.2b14/compat/
ds2.1.1/v22.2b14/compat/simuls/
ds2.1.1/v22.2b14/include/
ds2.1.1/v22.2b14/testsuite/
ds2.1.1/v22.2b14/testsuite/clone/
ds2.1.1/v22.2b14/testsuite/command/
ds2.1.1/v22.2b14/testsuite/data/
ds2.1.1/v22.2b14/testsuite/etc/
ds2.1.1/v22.2b14/testsuite/include/
ds2.1.1/v22.2b14/testsuite/inherit/
ds2.1.1/v22.2b14/testsuite/inherit/master/
ds2.1.1/v22.2b14/testsuite/log/
ds2.1.1/v22.2b14/testsuite/single/
ds2.1.1/v22.2b14/testsuite/single/tests/compiler/
ds2.1.1/v22.2b14/testsuite/single/tests/efuns/
ds2.1.1/v22.2b14/testsuite/single/tests/operators/
ds2.1.1/v22.2b14/testsuite/u/
ds2.1.1/v22.2b14/tmp/
ds2.1.1/win32/
#include <lib.h>
#include <rooms.h>
#include "ex.h"

//  The #include "ex.h" is used in each of these files to remember
//    the defines for EXPATH and other variables we have defined
//    that all of these files use.  It would be tedious to have to
//    put the #define EXPATH in every file, so we put it into one
//    and include it as a reference for each file that needs it.
//    Consider it a library card.  The books that are in the library
//    (the #define's) are referenced every time you see EXPATH.

inherit LIB_ROOM;

//   I'm defining a global variable here called once to be used later
//     in the file.  A global variable is something that can be used
//      by any function in this room.  There are also local variables
//     that can be defined only in the variable using it.

int once;

//   I'm also defing a function lever_pulled() that will be called later.
mixed lever_pulled();

void create()
{
    ::create();
    SetAmbientLight(30);
    SetShort( "Lever Pull" );
    SetLong("This is an example room for a simple add_action which changes "+
      "a description.  There's a lever to pull."
    );

    SetExits( ([
	"north" : EXPATH + "exroom2",
	"south" : EXPATH + "entrance",
      ]));

    //   Here, take a look at how I set the lever item.  It is different
    //     that you saw in the entrance room.  What I am doing here is
    //     calling a functional.  When the player types 'look lever', it
    //     will call the functional (: lever_pulled :) that we defined above.
    //     I'll explain later in this file.

    SetItems( ([
	"lever" : ((: lever_pulled :))
      ]) );

}

//  In the init() function, I am setting our global variable 'once' to 0.  This
//    is used to reset the lever back when the room resets or the mud reboots.
//    so the next player who comes in to pull the lever, they can.
//    In the init() function, we also define the actions that can be done in the
//    room.  In this case, we need a pull action to 'pull lever'.  Whenever a player
//    types pull, it will call the function aa_pull().

void init()
{
    ::init();
    add_action("aa_pull","pull");
    once = 0;
}

//   This is the function that is called when a player types pull as mentioned above.
//      First, we need to check and see if they are pulling the correct thing.  the
//      string str is defining a local variable that will be used in this function.
//      Next, we have if( str != "lever").  That is saying if I type 'pull finger',
//      it will write 'Pull what?'.  The \n symbol means a carriage return or 'enter'
//      to go to the next line.

mixed aa_pull(string str)
{
    if ( str != "lever")
    {
	write( "Pull what?\n" );
	return 1;
    }

    //   Here we are going to check if the lever has been pulled.  If it has, 
    //     it's going to tell the player that and exit the aa_pull() function.
    //     this is done by the return 1; that you see here.

    if( once ==1 )
    {
	write( "The lever's already pulled." );
	return 1;
    }

    //  If the lever has not been pulled, this part starts.  As you'll notice, we
    //    set once = 1 to indicate that the lever has been pulled.

    write("You pull the lever!\n");
    say(this_player()->GetName() + " pulls the lever!\n");
    once=1;
    return 1;
}

//   I told you I'd explain what the functional (: lever_pulled :) was for.
//     Below, it checks to see if the lever has been pulled.  if( !once )
//     says, if once is equal to 0 (not pulled) it returns and says the lever
//     has not been pulled.  If once is not equal to 0, then it means that it
//     has been pulled and returns a different message.

mixed lever_pulled()
{
    if( !once )
	return "The lever is pushed into the wall.  Perhaps you could pull it.";
    return "The lever has already been pulled.  You're too late!";
}