home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 April / CHIP_CD_2005-04.iso / software / netv / NVinst.exe / $INSTDIR / Scripts / Terminal / chat.nvs next >
Encoding:
Text File  |  2005-02-22  |  798 b   |  45 lines

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