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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(XML import)
 
Line 1: Line 1:
 +
<span id="bffilesize"></span>
  
 +
'''Function:'''  <i><!--CODE-->integer filesize ( filename :string);</i><!--ENDCODE-->
  
 +
<!--TERM-->  '''file'''
 +
<!--DEFINITION-->        The file name you want to check
 +
<!--TERM-->  '''return'''
 +
<!--DEFINITION-->        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:'''
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
 +
 +
dilbegin notebook ();
 +
code
 +
dilend
 +
 +
---~---~---~---~---~---~---~---~---
 +
 +
</i><!--ENDCODE-->
 +
The previous DIL example shows how you could use the 'filesize' instruction to
 +
check the size of a player stored notebook.
 +
 +
 +
---~---~---~---~---~---~---~---~---
 
<span id="bffilesize"></span>
 
<span id="bffilesize"></span>
  
Line 21: Line 49:
 
  dilbegin notebook ();
 
  dilbegin notebook ();
 
  code
 
  code
{
+
dilend
        ns := filesize (self.name+"notebook");
 
        if ( ns >500000)
 
        {
 
                sendtext ("Your notebook is full.&amp;n",self);
 
                quit;
 
        }
 
        else if ( ns > 250000)
 
        {
 
                sendtext ("Your notebook is more than half full.&amp;n",self);
 
                quit;
 
        }
 
        else if (ns >125000)
 
        {
 
                sendtext ("Your Notebook is only 1/4 full.&amp;n",self);
 
                quit;
 
        }
 
        else if (ns >0)
 
        {
 
                sendtext ("Your notebook is less than 1/4 full.&amp;n",self);
 
                quit;
 
        }
 
        else
 
        {
 
                sendtext ("You don't have anything in your Notebook.&amp;n",self);
 
                quit;
 
        }
 
 
 
}
 
dilend
 
  
 
  ---~---~---~---~---~---~---~---~---
 
  ---~---~---~---~---~---~---~---~---

Latest revision as of 22:38, 4 December 2025

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

dilend

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

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


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

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

dilend

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

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


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