Manual:DIL Manual/delstr()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:21, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

delstr()

Function (integer). Deletes a string file.

delstr(filename : string)

Deletes a file written by savestr() and read by loadstr(): boards, clans and competitions use it to remove messages and lists.

Parameters

Name Type Meaning
filename string The file's name, as given to savestr(): letters, digits, _ and . only, at most 512 characters.

Returns

integer. As the server is now, FALSE (0) when the file was deleted and TRUE (1) when it wasn't (no such file); the opposite of what the name suggests. FALSE as well for a name with other characters. Don't rely on the value: no zone does, and it may be corrected. Use loadstr() first to see whether the file exists.

Notes

  • The file is in the strings folder of the zone's DIL file directory (the last column of the zone's line in vme/etc/zonelist), or of dil_file_dir in server.cfg when the zone has none.
  • Only zones with access level 10 or less (the fourth column of zonelist) may use it. In other zones the program stops and the zone log says "attempt to violate system access security (delstr)".
  • A name with other characters (a /, a space) is refused with a line in the zone log.
  • The result fails (it is neither true nor false) when the argument does, e.g. a field of a null unit.

Example

dilbegin clear_notes(pc : unitptr);
var
   fn : string;
   s : string;
   i : integer;
code
{
   fn := tolower(pc.name) + ".notes";
   i := loadstr(fn, s);
   if (i < 1)
   {
      sendtext("You have no notes.<br/>", pc);
      return;
   }
   i := delstr(fn);                // the result can't be trusted, see Returns
   sendtext("Your notes are deleted.<br/>", pc);
   return;
}
dilend

Deletes a player's notes file, after loadstr() has shown that there is one.

See also