Difference between revisions of "Manual:DIL Manual/logcrime()"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = 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 (<code>set_witness@justice</code>) 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 == | |
| − | + | {| class="wikitable" | |
| − | + | ! 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 <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_PROTECTEDflag:
killing or robbing ordinary monsters is no crime.
CRIME_MURDERandCRIME_PKagainst 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.