LOCATOR.C
LIB3/D/HOME/CITY/ITEMS/MISC/LOCATOR.C · 2.2 KB
From the archive nm4dos.zip
Download the archive « Back to the archive contents
/*
** Player/monster locator device, given as a 'taster'
** of high-tech equipment to new players in the home
** domain city.
**
** Newstyle, 21/11/93
*/
inherit "/std/object";
void setup()
{
set_name("box");
set_short("mysterious metal box");
add_adjective( ({"mysterious", "metal"}) );
set_long("Studying the mysterious metal box more "
+"closely, you discover a switch on one "
+"side of it that when touched causes a small "
+"panel to light up. Beneath this panel are a "
+"number of buttons marked with strange letters. "
+"From what little you can make of them, you deduce "
+"that this is a device capable of 'locate'ing "
+"living creatures.\n");
set_weight(4);
set_value(10000);
}
void init()
{
::init();
add_action("do_locate", "locate");
add_action("my_help", "help", 1);
}
int my_help(string str)
{
if(str != "box" && str != "metal box" &&
str != "mysterious box" && str != "mysterious metal box" )
return 0;
write("The mysterious metal box seems to be a device "
+"to locate living creatures. You could try to use it with "
+"'locate <name>'.\n");
return 1;
}
int do_locate(string str)
{
object who;
say(this_player()->query_cap_name()+
" fiddles about with "+
this_player()->query_possessive()+
" mysterious metal box.\n");
if(!str)
{
notify_fail("The box bleeps quietly to itself before "
+"its screen displays the message : 'locate "
+"what?'\n");
return 0;
}
str = (string)this_player()->expand_nickname(str);
str = lower_case(str);
who = find_living(str);
if(!who || !environment(who))
{
notify_fail("Several lights flash briefly on the "
+"mysterious metal box, then it's screen "
+"gives you the message : 'Cannot find "
+"specified being'\n");
return 0;
}
write("The mysterious metal box hums slightly, then "
+"displays :\n 'Being "+who->query_cap_name()
+" located in "
+environment(who)->query_short()
+".'\n");
return 1;
}