Difference between revisions of "Manual:DIL Manual/Ending Notes"
(XML import) |
(rewritten against the compiler and interpreter; examples compile) |
||
| Line 1: | Line 1: | ||
| − | + | == Where to go next == | |
| − | + | The chapters cover the language; each keyword has its own page in the [[Manual:DIL Manual (Full Listing)|Full Listing]]. To go further: | |
| − | |||
| − | |||
| − | + | === Read working programs === | |
| + | The public zones in <code>vme/zone/</code> of the [https://github.com/Seifert69/DikuMUD3 DikuMUD3 repository] are full of DIL that runs in the game. Search them for the function you need. <code>function.zon</code> holds common helpers (<code>wander_zones</code>, <code>rescue</code>, <code>max</code> and many more), <code>quests.zon</code> the quest functions every quest should use, and <code>commands.zon</code>, <code>baseget.zon</code>, <code>basemove.zon</code> and <code>baselook.zon</code> the player commands written in DIL. [[Manual:DIL Examples|DIL Examples]] has a few short ones explained. | ||
| − | </ | + | === Try a program quickly === |
| − | < | + | * Compile with <code>-m</code> to rebuild only the zones that changed: <code>cd vme/zone; ../bin/vmc -m -d ../etc/ -I../include/ *.zon</code>. <code>-s</code> checks the syntax without writing anything. The server reads zones only when it starts, so restart it afterwards. |
| − | + | * <code>vme -w</code> runs the server time-warped: it doesn't sleep between ticks, so heartbeats, <code>pause</code> and the mud clock pass as fast as the computer allows. On a running game, a god's <code>wtimewarp <seconds></code> does the same for that many seconds of game time. A program with a 90-second heartbeat can then be tried in moments. | |
| − | + | * [[Manual:DIL Manual/log()|log()]] writes a line to <code>vme/bin/vme.log</code>, which is the quickest way to see what a program does. The same log has the errors of running programs: "had endless loop", "Type error in ...", "Template ... not found", "Cannot resolve external reference". It starts empty at every boot, so keep a copy before restarting if you need it. | |
| − | + | * In the game, a god's <code>wstat <unit> functions</code> lists the programs a unit runs, in their order, and <code>wstat world dil</code> how much time and how many instructions each template has used. | |
| − | + | === The DIL test zone === | |
| + | <code>vme/zone/test.zon</code> holds tests of DIL itself, run automatically. With <code>vme/etc/zonelist.test</code> as the zone list, a "lab director" program copies each test template onto a room in turn, from <code>T0nn</code> (the number <code>TEST_MAXIMUM</code>) down to <code>T001</code>; each test does its work, logs its result with <code>logtest()</code>, and sends <code>"done"</code> back with <code>sendtoalldil()</code>. When all have run, the server stops, with exit code 0 if every test passed. <code>vme/bin/intergration_test.sh</code> runs them time-warped. A new test is one more template <code>T0nn</code> and a higher <code>TEST_MAXIMUM</code>. <code>DIL_UNIT_TESTING.md</code> in the repository's top folder explains how to run them. | ||
| − | </ | + | === The zone manual === |
| + | DIL lives in zone files. The [[Manual:Zone Manual|Zone Manual]] explains the rest of them: rooms, objects, NPCs, resets, and the macros in <code>vme/include</code>; its [[Manual:Zone Manual/The DIL Section|DIL section]] chapter is about where DIL goes in a zone. | ||
| + | |||
| + | === When the manual is wrong === | ||
| + | The pages of this manual were checked against the compiler and the server. Where a page and the code still disagree, the code is right: the keywords are in <code>vme/src/vmc/diltok.h</code>, the grammar in <code>vme/src/vmc/dilpar.y</code>, the functions in <code>vme/src/dilexp.cpp</code>, the procedures and statements in <code>vme/src/dilinst.cpp</code>, and the fields in <code>vme/src/dilfld.cpp</code>. Please report such mistakes, and bugs in DIL itself, on GitHub. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual|DIL Manual]] | ||
| + | * [[Manual:DIL Manual/Making a Program|Making a Program]] | ||
| + | * [[Manual:DIL Examples|DIL Examples]] | ||
Latest revision as of 23:54, 14 November 2026
Contents
Where to go next
The chapters cover the language; each keyword has its own page in the Full Listing. To go further:
Read working programs
The public zones in vme/zone/ of the DikuMUD3 repository are full of DIL that runs in the game. Search them for the function you need. function.zon holds common helpers (wander_zones, rescue, max and many more), quests.zon the quest functions every quest should use, and commands.zon, baseget.zon, basemove.zon and baselook.zon the player commands written in DIL. DIL Examples has a few short ones explained.
Try a program quickly
- Compile with
-mto rebuild only the zones that changed:cd vme/zone; ../bin/vmc -m -d ../etc/ -I../include/ *.zon.-schecks the syntax without writing anything. The server reads zones only when it starts, so restart it afterwards. vme -wruns the server time-warped: it doesn't sleep between ticks, so heartbeats,pauseand the mud clock pass as fast as the computer allows. On a running game, a god'swtimewarp <seconds>does the same for that many seconds of game time. A program with a 90-second heartbeat can then be tried in moments.- log() writes a line to
vme/bin/vme.log, which is the quickest way to see what a program does. The same log has the errors of running programs: "had endless loop", "Type error in ...", "Template ... not found", "Cannot resolve external reference". It starts empty at every boot, so keep a copy before restarting if you need it. - In the game, a god's
wstat <unit> functionslists the programs a unit runs, in their order, andwstat world dilhow much time and how many instructions each template has used.
The DIL test zone
vme/zone/test.zon holds tests of DIL itself, run automatically. With vme/etc/zonelist.test as the zone list, a "lab director" program copies each test template onto a room in turn, from T0nn (the number TEST_MAXIMUM) down to T001; each test does its work, logs its result with logtest(), and sends "done" back with sendtoalldil(). When all have run, the server stops, with exit code 0 if every test passed. vme/bin/intergration_test.sh runs them time-warped. A new test is one more template T0nn and a higher TEST_MAXIMUM. DIL_UNIT_TESTING.md in the repository's top folder explains how to run them.
The zone manual
DIL lives in zone files. The Zone Manual explains the rest of them: rooms, objects, NPCs, resets, and the macros in vme/include; its DIL section chapter is about where DIL goes in a zone.
When the manual is wrong
The pages of this manual were checked against the compiler and the server. Where a page and the code still disagree, the code is right: the keywords are in vme/src/vmc/diltok.h, the grammar in vme/src/vmc/dilpar.y, the functions in vme/src/dilexp.cpp, the procedures and statements in vme/src/dilinst.cpp, and the fields in vme/src/dilfld.cpp. Please report such mistakes, and bugs in DIL itself, on GitHub.