home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / main / BBS / XDOOR300.ZIP / oneliner.ZIP / ONELINER.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-10-11  |  1.3 KB  |  63 lines

  1. { Oneliner Door Example for the Xtreme Doorkit       }
  2. { Feel free to hack this, or use it however you want }
  3.  
  4. Program OneLiner;
  5.  
  6. Uses XDoor, XFileIO;
  7.  
  8. Const
  9.        maxLines = 8;
  10.  
  11. Var
  12.        Input    : String[70];
  13.        TextF    : Text;
  14.  
  15.  
  16. Procedure getInput;
  17.  Begin
  18.   SetPosX(1);
  19.   coutln('|03e|11nter |03y|11our |03t|11ext|08:');
  20.   Input := inStr('',70,True);
  21.  End;
  22.  
  23. Procedure Save;
  24.  Begin
  25.   PosUp(2);
  26.   cout('|03s|11aving |08... ');
  27.   assign(TextF,'ONELINER.DAT');
  28.   openTxtW(TextF);
  29.   WriteLn(TextF,Input);
  30.   Close(TextF);
  31.   trimFile('ONELINER.DAT',maxLines);
  32.   logWrite(userhandle+' added text: '+input);
  33.   coutln('|15done!');
  34.  End;
  35.  
  36.  
  37. Procedure Startup;
  38.  Begin
  39.   logwrite(userhandle+' entered oneliner door');
  40.   if not FileExists('ONELINER.DAT') then create('ONELINER.DAT');
  41.   showFile('HEADER.ANS',False);   { Show Oneliner Header at top    }
  42.   showFile('ONELINER.DAT',True);  { Show oneliners                 }
  43.   showFile('BOTTOM.ANS',False);   { Show Oneliner Bottom at bottom }
  44.  End;
  45.  
  46.  
  47. Procedure Ask;
  48.  Begin
  49.   Cout('|03d|11o |03y|11ou |03w|11ish |03t|11o |03a|11dd |03a o|11neliner? ');
  50.   if not yesNo(false) then halt;  { exit door if they choose no }
  51.  End;
  52.  
  53.  
  54. Begin
  55.  doorName := '- Oneliners -';
  56.  cfgName  := 'ONELINER.CFG';
  57.  InitDoor;
  58.  Startup;
  59.  Ask;
  60.  getInput;
  61.  Save;
  62. End.
  63.