Manual:DIL Manual unitdir() - Seifert69/DikuMUD3 GitHub Wiki
Function: stringlist unitdir( match : string ) ;
match
The wild card file you want to match or '*' for all.
return
a Stringlist with all the filenames that match the 'match' argument.
The 'match' argument uses the same wild cards as the Linux 'ls' command so the following will work.
*
Match any character or group of characters
?
Match one of any character
[...]
Match one of a set of characters
Example: ---~---~---~---~---~---~---~---~---
"corpse*" matches: corpse.10938 corpse.whistler corpseofwhistler ... "corpse?" matches corpse1 corpses corpse5 ... "[abc]*" matches ability about cost back ... "[a-z]*" about zoo man father ... "start[nm]end" matches startnend startmend
---~---~---~---~---~---~---~---~---
Example DIL: ---~---~---~---~---~---~---~---~---
dilbegin aware reload_corpse();
var
corpselist:stringlist;
u:unitptr;
ln:integer;
i:integer;
x:extraptr;
code
{
corpselist:=unitdir("corpse*");
ln:=length(corpselist);
i:=0;
while (i<ln)
{
u:=restore(corpselist.[i],null);
x:=CORPSE_EXTRA in u.extra;
if (u!=null)
if (x!=null)
link (u,findroom(x.descr));
else
link (u,findroom("temple@udgaard"));
i:=i+1;
}
quit; } dilend
---~---~---~---~---~---~---~---~---
The previous DIL example is the DIL used in restoring corpses to the game in case of a crash. For more information you can see how the death DIL'S work by reading through the file death.zon in the vme2.0/zone. directory.
---~---~---~---~---~---~---~---~---