home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 September / CHIP_CD_2004-09.iso / bonus / soft_rev / files / NVinst.exe / $INSTDIR / Scripts / Terminal / chat.nvs next >
Encoding:
Text File  |  2004-08-04  |  810 b   |  45 lines

  1. program Terminal_Chat;
  2. var evnt,i:integer;
  3.     s,s1,s2,s3:string;
  4.     ch:char;
  5.     v1,v2:integer;
  6. begin
  7. setbackcolor($000000);
  8. textcolor($FFFF00);
  9. setstatus('Client connected');
  10. writeln('Connected: '+nv_remoteip);
  11.  
  12. repeat
  13. evnt:=waitevent(v1,v2);
  14. if evnt=7 then
  15. begin
  16. textcolor($00FF00);
  17. s:=getbroadcast;
  18. send(s);
  19. end else
  20.  
  21. if evnt=1 then
  22. begin
  23. textcolor($00FF00);
  24. s:=recvln;
  25. writeln(s);
  26. sendbroadcast(s+chr(13)+chr(10));
  27. end else
  28.  
  29. if evnt=6 then
  30. begin
  31. s1:='';s2:='';
  32. i:=getinputtext(s1,s2);
  33.  
  34. if(v2<>0)then begin s3:=s1+s2; setinputtext(2,'');end
  35.          else begin s3:=s1; setinputtext(1,'');end;
  36. s3:='<'+nv_cname+'> '+s3;
  37. send(s3+chr(13)+chr(10));
  38. textcolor($00FFFF);
  39. writeln(s3);
  40. end;
  41.  
  42. until evnt=0;
  43. textcolor($FFFF00);
  44. writeln('Disconnected: '+nv_remoteip);
  45. end.