[Package Index | Mudlib Index | Effect Index]

File /obj/watch.c

An inheritable watch object. This can be used to create pocketwatches or wristwatches. They can provide alarms and speak or show the time and day.

See also:
/obj/clock.

Written by ceres

Example 1

inherit "/obj/watch";

void setup() {
  set_name("watch");
  set_main_plural("gold watches");
  set_short("gold watch");
  add_adjective("gold");
  set_long("This is a mechanical gold watch.  The time reads ");
  set_weight(3);
  set_type("bracelet");
  add_property( "shop type", "jewellers" );
  add_property("no recycling", 1);
  set_cond(350);
  set_max_cond(350);
  set_damage_chance(4);
  set_value(14000);
  set_has_alarms(1);
  set_alarm_mess("Beep, beep, beep, Your alarm has gone off!\n");
}

Example 2

inherit "/obj/watch";

setup() {
  set_name("watch");
  set_main_plural("watches");
  set_long("This is one of those wrist watches that is powered by "
           "a chubby-looking imp. This watch basically has fifteen "
           "functions, but as far you are concerned the imp performs "
           "only two functions. One function to tell the time and the "
           "function to apologise for its inefficiency in its other "
           "thirteen functions.\n");
  set_weight( 1 );
  set_type("bracelet");
  add_property("shop type", "jewellers");
  add_property("no recycling", 1);
  set_cond(300);
  set_max_cond(300);
  set_damage_chance(5);
  set_value( 6000 );
  set_pocketwatch(1);
  set_watch_speaker("From inside the watch the chubby-looking imp");

}

Inherits

This class inherits the following classes /std/basic/close_lock.c, /std/basic/wearable.c and /obj/clock.c

Includes

This class includes the following files /include/chime.h and /include/am_time.h

Method index

Public Functions

These are functions that everyone can access.

check_for_alarms
void check_for_alarms()
set_alarm_mess
void set_alarm_mess(string mess)

Sets the message to be displayed when an alarm goes off.

Parameters:
mess - The message to be displayed. The following can be used and will be replaced when your message is displayed: $poss_short$ - the watch's possessive short (useful if worn and if the alarm isn't silent). $short$ - the watch's query_short. $time$ - the current time in the form returned by query_time_string. $alarm$ - the alarm string as set by the player, this can only be used if the watch is a spoken watch.

Example:
 set_watch_speaker( "From inside the watch, a fat blue imp" );
 set_alarm_mess( "It is $time$, this is your $alarm$ alarm!\n" );

 set_silent_alarm( 1 );
 set_alarm_mess( "Your $short$ buzzes almost imperceptibly as an alarm "
   "goes off.\n" );

set_has_alarms
void set_has_alarms(int i)

Determines if this watch can do alarms or not.

Parameters:
i - 1 for yes, 0 for no.

See also:
set_alarm_mess set_silent_alarm .c


set_pocketwatch
void set_pocketwatch(int i)

Makes the watch into a pocket watch ie. one that can only be read when it is open.

Parameters:
i - 1 for yes, 0 for no.


set_silent_alarm
void set_silent_alarm(int silent)

Sets whether this watch's alarm is silent. You still need to set_has_alarms and set_alarm_mess, the message will only be shown to the player wearing the watch, and so the watch must be wearable for the silent alarm to work.

Parameters:
silent - 1 if this watch's alarm is silent.

Example:
  set_has_alarms( 1 );
  set_alarm_mess( "You feel a tiny pin prick on your wrist, indicating "
    "that your $short$'s alarm is going off.\n" );
  set_silent_alarm( 1 );

set_watch_speaker
void set_watch_speaker(string mess)

Set the message to prefix the spoken time for a speaking watch (typically imp or demon powered).

Parameters:
mess - The message to prefix the time.