User Tools

Site Tools


coding:lessbasicroom
#include <mudlib.h>
#include <ansi.h>
#pragma strong_types
 
inherit ROOM;
 
void reset (int arg)
{
  ::reset (arg);
  if (arg) return;
 
  set_light (1);
  set_indoor (1);
  set_planet ("chapterhouse");
  
  set_short ("A Simple Room");
  set_long ("  This is a simple room on the planet Chapterhouse.  It has been created to show you\n\
the basics of room creation here on Dune.  We can see that we are indoors,\n\
thanks to the lamp in the corner of the room providing us with a little light!\n\
Someone has sneakily attached a lever to the floor.\n");
  
  add_item ("lamp", "A fancy little desk lamp.");
  add_item ("lever", "A small lever with a knob on the end that you could pull.");
  
  add_exit ("out", "/d/Space/stryder/planets/chap_station");
}
 
void init ()
{
  ::init ();
  add_action ("pull", "pull");
}
 
int pull (string str)
{
  if (!str || str != "lever")
    return notify_fail ("What are you trying to pull?\n");
 
  write ("You pull the lever.  You feel healthier.\n");
  say (sprintf ("%s pulls the lever.  %s looks healthier.\n",
                 capitalize (this_player ()->query_real_name ()),
                 capitalize (this_player ()->query_pronoun ())));
 
  this_player ()->heal_self (50);
  return 1;
}

This less basic example expands on the Basic Room, adding a lever and the ability to pull it. See the detailed description here.

coding/lessbasicroom.txt · Last modified: 2010/05/04 20:58 by orbital