Difference between revisions of "Manual:DIL Manual/logcrime()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bplogcrime"></span>
+
= logcrime() =
−
logcrime( c : unitptr, v : unitptr, t : integer )
+
'''Procedure.''' Reports a crime to the justice system: who did it, to whom, and what.
−
    c : The criminal (main suspect)
 
−
    v : The victim
 
−
    t : The crime type (CRIME_XXX)
 
  
−
      Registers a crime committed against 'v' by 'c'. Use the
+
logcrime(criminal : unitptr, victim : unitptr, crime : integer)
−
    CRIME_XXX values from values.h and/or vme.h as the 't' argument.
 
−
    The logcrime routine automatically registers group members
 
−
    of the criminal, etc. In stuff like steal, remember to make
 
−
    the criminal visible if he fails his attempts.
 
  
−
---~---~---~---~---~---~---~---~---
+
Starts the justice system's witness program (<code>set_witness@justice</code>) on the victim and
−
<span id="bplogcrime"></span>
+
on every character around the victim who can see the criminal. Those witnesses then remember the
−
logcrime( c : unitptr, v : unitptr, t : integer )
+
crime, and guards and the town's justice act on it as justice.zon sets out. The skills in
−
    c : The criminal (main suspect)
+
skills.zon call it when a theft is noticed.
−
    v : The victim
 
−
    t : The crime type (CRIME_XXX)
 
  
−
      Registers a crime committed against 'v' by 'c'. Use the
+
== Parameters ==
−
    CRIME_XXX values from values.h and/or vme.h as the 't' argument.
+
{| class="wikitable"
−
    The logcrime routine automatically registers group members
+
! Name !! Type !! Meaning
−
    of the criminal, etc. In stuff like steal, remember to make
+
|-
−
    the criminal visible if he fails his attempts.
+
| criminal || unitptr || The main suspect. Must be a character.
 +
|-
 +
| victim || unitptr || Who the crime was done to. Must be a character.
 +
|-
 +
| crime || integer || The crime, a <code>CRIME_</code> constant from <code>vme/include/vme.h</code>: <code>CRIME_STEALING</code> (3), <code>CRIME_MURDER</code> (8) or <code>CRIME_PK</code> (64).
 +
|}
  
−
---~---~---~---~---~---~---~---~---
+
== Notes ==
 +
* Nothing happens when either one is null or not a character.
 +
* Nothing happens when the victim is an NPC without the <code>CHAR_PROTECTED</code> flag:
 +
  killing or robbing ordinary monsters is no crime.
 +
* <code>CRIME_MURDER</code> and <code>CRIME_PK</code> against a victim with the justice
 +
  system's <code>CHAR_LEGAL_TARGET</code> flag are ignored.
 +
* Only those who can see the criminal witness it. A thief who failed while hidden or invisible
 +
  should be made visible first if the crime is to be seen.
 +
 
 +
== Example ==
 +
<pre>
 +
dilbegin caught_stealing(vict : unitptr);
 +
code
 +
{
 +
  act("$3n catches you trying to steal!", A_SOMEONE, self, null, vict, TO_CHAR);
 +
  act("You catch $1n trying to steal from you!", A_SOMEONE, self, null, vict, TO_VICT);
 +
  logcrime(self, vict, CRIME_STEALING);
 +
  quit;
 +
}
 +
dilend
 +
</pre>
 +
A failed theft that the victim notices becomes a crime, as in the steal skill of skills.zon.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/crimes|crimes]]
 +
* [[Manual:DIL Manual/charflags|charflags]]
 +
* [[Manual:DIL Manual/getinteger()|getinteger()]]

Latest revision as of 23:21, 14 November 2026

logcrime()

Procedure. Reports a crime to the justice system: who did it, to whom, and what.

logcrime(criminal : unitptr, victim : unitptr, crime : integer)

Starts the justice system's witness program (set_witness@justice) on the victim and on every character around the victim who can see the criminal. Those witnesses then remember the crime, and guards and the town's justice act on it as justice.zon sets out. The skills in skills.zon call it when a theft is noticed.

Parameters

Name Type Meaning
criminal unitptr The main suspect. Must be a character.
victim unitptr Who the crime was done to. Must be a character.
crime integer The crime, a CRIME_ constant from vme/include/vme.h: CRIME_STEALING (3), CRIME_MURDER (8) or CRIME_PK (64).

Notes

  • Nothing happens when either one is null or not a character.
  • Nothing happens when the victim is an NPC without the CHAR_PROTECTED flag:
 killing or robbing ordinary monsters is no crime.
  • CRIME_MURDER and CRIME_PK against a victim with the justice
 system's CHAR_LEGAL_TARGET flag are ignored.
  • Only those who can see the criminal witness it. A thief who failed while hidden or invisible
 should be made visible first if the crime is to be seen.

Example

dilbegin caught_stealing(vict : unitptr);
code
{
   act("$3n catches you trying to steal!", A_SOMEONE, self, null, vict, TO_CHAR);
   act("You catch $1n trying to steal from you!", A_SOMEONE, self, null, vict, TO_VICT);
   logcrime(self, vict, CRIME_STEALING);
   quit;
}
dilend

A failed theft that the victim notices becomes a crime, as in the steal skill of skills.zon.

See also