[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /std/basic/trap.c</h2>
This is a basic trap system for adding traps to container type objects (or
anything that uses /std/basic/close_lock.

To setup the trap use setup_trap(). Functions are available to find out
information about a trap on an object.

If you wish to create a more advanced trap you can use the set_lock_trap and
set_open_trap functions in /std/basic/close_lock.
<p><b>See also:</b><br><a href="std.basic.close_lock.c.shtml">/std/basic/close_lock.c</a> and setup_trap
.c<p>Written by ceres<h2>Includes</h2>
This class includes the following files <a href="include.tasks.h.shtml">/include/tasks.h</a><h2>Method index</h2>
<dl><ul>
<li><a href="#query_trap_armed">query_trap_armed</a>()<br/>
Get whether the trap is armed or not.
<li><a href="#query_trap_data">query_trap_data</a>()<br/>
Get data on the basic lock trap.
<li><a href="#query_trap_description">query_trap_description</a>()<br/>
Get the trap description text.
<li><a href="#query_trap_difficulty">query_trap_difficulty</a>()<br/>
Find out the difficulty of this trap.
<li><a href="#query_trap_effect">query_trap_effect</a>()<br/>
Get the trap effects.
<li><a href="#query_trap_message">query_trap_message</a>()<br/>
Get the trap trigger messages

<li><a href="#query_trap_trigger">query_trap_trigger</a>()<br/>
Get the trigger condition for this trap.
<li><a href="#set_trap_armed">set_trap_armed</a>(int)<br/>
Set the trap as armed or disarmed.
<li><a href="#setup_trap">setup_trap</a>(int, string, string, mixed, mixed)<br/>
This sets up a basic trap on a lock.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="query_trap_armed">
query_trap_armed</a><pre>
int query_trap_armed()
</pre></br>
Get whether the trap is armed or not.


<ul><a name="query_trap_data">
query_trap_data</a><pre>
mixed * query_trap_data()
</pre></br>
Get data on the basic lock trap. Data is returned as a mixed array of
stuff. This is really only used for the autoload. :)

<br/><ul>
<li><b>Returns:</b>
<br/>mixed array of trap data.

</dl>

<ul><a name="query_trap_description">
query_trap_description</a><pre>
string query_trap_description()
</pre></br>
Get the trap description text.

<br/><ul>
<li><b>Returns:</b>
<br/>string description of the trap.

</dl>

<ul><a name="query_trap_difficulty">
query_trap_difficulty</a><pre>
int query_trap_difficulty()
</pre></br>
Find out the difficulty of this trap.

<br/><ul>
<li><b>Returns:</b>
<br/>int difficulty

</dl>

<ul><a name="query_trap_effect">
query_trap_effect</a><pre>
mixed query_trap_effect()
</pre></br>
Get the trap effects.

<br/><ul>
<li><b>Returns:</b>
<br/>mixed either an int (for the damage) or a mixed variable for
  the effect to add to the triggerer.

</dl>

<ul><a name="query_trap_message">
query_trap_message</a><pre>
mixed query_trap_message()
</pre></br>
Get the trap trigger messages

<br/><ul>
<li><b>Returns:</b>
<br/>mixed a string or array of messages

</dl>

<ul><a name="query_trap_trigger">
query_trap_trigger</a><pre>
string query_trap_trigger()
</pre></br>
Get the trigger condition for this trap.

<br/><ul>
<li><b>Returns:</b>
<br/>string the trigger condition.

</dl>

<ul><a name="set_trap_armed">
set_trap_armed</a><pre>
void set_trap_armed(int i)
</pre></br>
Set the trap as armed or disarmed.


<ul><a name="setup_trap">
setup_trap</a><pre>
void setup_trap(int difficulty,
                string trigger,
                string description,
                mixed message,
                mixed effect)
</pre></br>
This sets up a basic trap on a lock.  The trap will be triggered when
someone locks/unlocks/picks the lock (depending on trigger). If
triggered the message will be displayed and the effect will be added
to the player.

<br/><ul>
<li><b>Parameters:</b>
<br/>difficulty - skill bonus needed to avoid triggering the trap
<br/>trigger - "unlock", "pick, "open",  for which activities should
trigger the trap.
<br/>description - a description of the trap for someone who looks at
  it.
<br/>message - The message to be displayed to the player. If it's an array
the first index will be printed to the player the second
to the room.
<br/>effect - the effect to be added to the trigerer. If the effect is an
int the players hps will be reduced by that amount. If it is
a string that effect will be added to the player, if it's an
array the first index will be treated as the effect the rest
as parameters to the effect.

<li><b>Example:</b>
<br/><pre>setup_trap(300, "pick",
           "Hidden inside the lock is a small ampule which, if touched by "
           "an unwary tool would trigger a puff of poisonous gas.",
           ({"A small cloud of gas puffs out of the safe.\n",
               "A small cloud of gas puffs out of the safe.\n"}),
           ({"/std/effects/poisons/poison_gas", 600}));
</pre></dl>


[an error occurred while processing this directive]

