Difference between revisions of "Manual:DIL Manual/Built-In Variables"
Jump to navigation
Jump to search
(XML import) |
(manual index generated from the checked keyword pages) |
||
| Line 1: | Line 1: | ||
| − | < | + | Built-in variables are set by the server for every program; a program uses them without declaring them. Most of them can only be read. Click a name for the full page. |
| − | + | ||
| − | + | == The program and its event == | |
| − | + | Set for the running program; <code>activator</code>, <code>medium</code>, <code>target</code>, <code>power</code>, <code>argument</code> and the command strings describe the event that woke it. | |
| + | {| class="wikitable" | ||
| + | ! Variable !! Access !! What it holds | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/self|self]] : unitptr</code> || read-only || The unit the program runs on. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/activator|activator]] : unitptr</code> || read-only || The unit that caused the event that woke the program. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/medium|medium]] : unitptr</code> || read-only || The unit used in the event that woke the program, when the event has one; otherwise null. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/target|target]] : unitptr</code> || read-only || The unit an action in the event was aimed at, when the event has one; otherwise null. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/power|power]] : integer</code> || read/write || A number that comes with SFB_PRE and SFB_DONE events. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/argument|argument]] : string</code> || read-only || The text that came with the event that woke the program. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/cmdstr|cmdstr]] : string</code> || read-only || The full name of the command in the event that woke the program, as commands.def names it, even when the player typed an abbreviation. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/excmdstr|excmdstr]] : string</code> || read-only || The first word of the line the player typed, in lower case, not expanded. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/excmdstr case|excmdstr_case]] : string</code> || read-only || The first word of the line the player typed, exactly as typed: <code>Mellon</code> stays <code>"Mellon"</code>. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/heartbeat|heartbeat]] : integer</code> || read/write || How often the program's tick comes, in quarter seconds: <code>PULSE_SEC</code> (4, vme.h) is one second. | ||
| + | |} | ||
| + | |||
| + | == Time and weather == | ||
| + | {| class="wikitable" | ||
| + | ! Variable !! Access !! What it holds | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/realtime|realtime]] : integer</code> || read-only || The real time, in seconds since 1 January 1970 UTC: what <code>time(NULL)</code> gives in C. | ||
| + | |- | ||
| + | | [[Manual:DIL Manual/mud(day,month,..)|mudhour, mudday, mudmonth, mudyear]] (all four) || read-only || The game's clock and calendar. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/mudhour|mudhour]] : integer</code> || read-only || The hour of the mud day, 0 to 23: 0 is midnight, 12 noon. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/mudday|mudday]] : integer</code> || read-only || The day of the mud month, 0 to 13. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/mudmonth|mudmonth]] : integer</code> || read-only || The month of the mud year, 0 to 8. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/mudyear|mudyear]] : integer</code> || read-only || The mud year: the number of mud years since 11 August 1990, about 1261 in November 2026. | ||
| + | |- | ||
| + | | <code>[[Manual:DIL Manual/weather|weather]] : integer</code> || read-only || The sky over the zone the program's unit is in. | ||
| + | |} | ||
| + | |||
| + | <code>[[Manual:DIL Manual/null|null]]</code> is not a variable but the empty value: see [[Manual:DIL Manual/Data Types|Data Types]]. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual/Messages|Messages]], for the events that set <code>activator</code> and the others | ||
| + | * [[Manual:DIL Manual/Built-In Functions|Built-In Functions]] | ||
| + | * [[Manual:DIL Manual/Fields|Fields]] | ||
Latest revision as of 23:40, 14 November 2026
Built-in variables are set by the server for every program; a program uses them without declaring them. Most of them can only be read. Click a name for the full page.
The program and its event
Set for the running program; activator, medium, target, power, argument and the command strings describe the event that woke it.
| Variable | Access | What it holds |
|---|---|---|
self : unitptr |
read-only | The unit the program runs on. |
activator : unitptr |
read-only | The unit that caused the event that woke the program. |
medium : unitptr |
read-only | The unit used in the event that woke the program, when the event has one; otherwise null. |
target : unitptr |
read-only | The unit an action in the event was aimed at, when the event has one; otherwise null. |
power : integer |
read/write | A number that comes with SFB_PRE and SFB_DONE events. |
argument : string |
read-only | The text that came with the event that woke the program. |
cmdstr : string |
read-only | The full name of the command in the event that woke the program, as commands.def names it, even when the player typed an abbreviation. |
excmdstr : string |
read-only | The first word of the line the player typed, in lower case, not expanded. |
excmdstr_case : string |
read-only | The first word of the line the player typed, exactly as typed: Mellon stays "Mellon".
|
heartbeat : integer |
read/write | How often the program's tick comes, in quarter seconds: PULSE_SEC (4, vme.h) is one second.
|
Time and weather
| Variable | Access | What it holds |
|---|---|---|
realtime : integer |
read-only | The real time, in seconds since 1 January 1970 UTC: what time(NULL) gives in C.
|
| mudhour, mudday, mudmonth, mudyear (all four) | read-only | The game's clock and calendar. |
mudhour : integer |
read-only | The hour of the mud day, 0 to 23: 0 is midnight, 12 noon. |
mudday : integer |
read-only | The day of the mud month, 0 to 13. |
mudmonth : integer |
read-only | The month of the mud year, 0 to 8. |
mudyear : integer |
read-only | The mud year: the number of mud years since 11 August 1990, about 1261 in November 2026. |
weather : integer |
read-only | The sky over the zone the program's unit is in. |
null is not a variable but the empty value: see Data Types.
See also
- Messages, for the events that set
activatorand the others - Built-In Functions
- Fields