Advertisement
Kulverstukas

Put english words in a sentance

Oct 28th, 2010
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.48 KB | None | 0 0
  1. //=================================================
  2. (* show random english words *)
  3. procedure RandomEnglishProc;
  4.  var EnglishWord : array[1..10] of integer;
  5.      Dictionary : TStringList;
  6.      i,k,z : integer;
  7.      j : string;
  8. begin
  9. //==========
  10.  if Form1.RandomEnglish.Checked = True then
  11.   begin
  12.    i := 0;
  13.    k := 0;
  14.    j := '';
  15.  if FileExists(ChosenDictionary) then
  16.   begin
  17.    Dictionary := TStringList.Create;
  18.    Dictionary.LoadFromFile(ChosenDictionary);
  19. //==========
  20.   for z := 1 to 5 do
  21.    if AnsiStartsStr(Form1.Nickname.Text+endchar[z]+' words',SpokenText) then
  22.     begin
  23.      i := Random(6) + 1; // generate the number of words up to 6 and make sure it is always more then 1 word
  24.       for k := 1 to i do
  25.        begin
  26.         EnglishWord[k] := Random(Dictionary.Count)+1;
  27.         j := j + Dictionary[EnglishWord[k]]+' ';
  28.        end;
  29.      Form1.Telnet.SendMessage('PRIVMSG '+Form1.Channel.Text+' :'+j+#10#13);
  30.      Form1.Memo1.Lines.Add('['+TimeToStr(now)+'] '+Form1.Nickname.Text+': '+j);
  31.      FunCounter.RandomCount := FunCounter.RandomCount + 1;
  32.      Form4.Label14.Caption := 'Random sentances: '+IntToStr(FunCounter.RandomCount);
  33.     end
  34.    else Exit;
  35. //==========
  36.   end
  37.  else ShowMessage('File '+ExtractFileName(ChosenDictionary)+' does not exist in '+ExtractFilePath(ChosenDictionary)+' or is renamed.'+#10#13+
  38.                   'It must be in the same folder and named so. It is Case Insensitive');
  39.  end;
  40. end;
  41. //=================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement