Manual:DIL Manual/filesize()

From DikuMUD Wiki
Jump to navigation Jump to search


Function:  integer filesize ( filename :string);
  file
         The file name you want to check
  return
         a file size in bites 0 if no file



This function does exactly what it says it does it checks a files size.
Example DIL:

---~---~---~---~---~---~---~---~---
dilbegin notebook ();
code
{
        ns := filesize (self.name+"notebook");
        if ( ns >500000)
        {
                sendtext ("Your notebook is full.&n",self);
                quit;
        }
        else if ( ns > 250000)
        {
                sendtext ("Your notebook is more than half full.&n",self);
                quit;
        }
        else if (ns >125000)
        {
                sendtext ("Your Notebook is only 1/4 full.&n",self);
                quit;
        }
        else if (ns >0)
        {
                sendtext ("Your notebook is less than 1/4 full.&n",self);
                quit;
        }
        else
        {
                sendtext ("You don't have anything in your Notebook.&n",self);
                quit;
        }
}
dilend
---~---~---~---~---~---~---~---~---

The previous DIL example shows how you could use the 'filesize' instruction to
check the size of a player stored notebook.


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