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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(XML import)
 
Line 1: Line 1:
 +
<span id="bfunitdir"></span>
 +
 +
'''Function:'''  <i><!--CODE-->stringlist unitdir( match : string ) ;</i><!--ENDCODE-->
 +
 +
<!--TERM-->  '''match'''
 +
<!--DEFINITION-->        The wild card file you want to match or '*' for all.
 +
<!--TERM-->  '''return'''
 +
<!--DEFINITION-->        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.
 +
 +
<!--TERM-->  '''&ast;'''
 +
<!--DEFINITION-->        Match any character or group of characters
 +
<!--TERM-->  '''&quest;'''
 +
<!--DEFINITION-->        Match one of any character
 +
<!--TERM-->  '''[...]'''
 +
<!--DEFINITION-->        Match one of a set of characters
 +
 +
'''Example:'''
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 +
"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
  
 +
---~---~---~---~---~---~---~---~---
  
 +
</i><!--ENDCODE-->
 +
'''Example DIL:'''
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 +
dilbegin aware reload_corpse();
 +
var
 +
        corpselist:stringlist;
 +
        u:unitptr;
 +
        ln:integer;
 +
        i:integer;
 +
        x:extraptr;
 +
code
 +
dilend
 +
 +
---~---~---~---~---~---~---~---~---
 +
 +
</i><!--ENDCODE-->
 +
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.
 +
 +
 +
---~---~---~---~---~---~---~---~---
 
<span id="bfunitdir"></span>
 
<span id="bfunitdir"></span>
  
Line 45: Line 99:
 
         x:extraptr;
 
         x:extraptr;
 
  code
 
  code
{
+
dilend
        corpselist:=unitdir("corpse*");
 
        ln:=length(corpselist);
 
        i:=0;
 
        while (i&lt;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
 
  
 
  ---~---~---~---~---~---~---~---~---
 
  ---~---~---~---~---~---~---~---~---

Latest revision as of 22:37, 4 December 2025

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.
  &ast;
         Match any character or group of characters
  &quest;
         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

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.


---~---~---~---~---~---~---~---~---

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.
  &ast;
         Match any character or group of characters
  &quest;
         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

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.


---~---~---~---~---~---~---~---~---