hedgewars/uChat.pas
changeset 13877 8c702a4839ec
parent 13872 65fe3933b19d
child 14300 79e07510b8e3
equal deleted inserted replaced
13876:aa321e51da14 13877:8c702a4839ec
   466 if (s[1] = '/') then
   466 if (s[1] = '/') then
   467     begin
   467     begin
   468     if (Length(s) <= 1) then
   468     if (Length(s) <= 1) then
   469         begin
   469         begin
   470         // empty chat command
   470         // empty chat command
   471         AddChatString(#0 + trcmd[sidCmdUnknown]);
   471         AddChatString(#0 + shortstring(trcmd[sidCmdUnknown]));
   472         exit;
   472         exit;
   473         end;
   473         end;
   474 
   474 
   475     // Ignore message-type commands with empty argument list
   475     // Ignore message-type commands with empty argument list
   476     if (copy(s, 2, 2) = 'me') and (Length(s) = 3) then
   476     if (copy(s, 2, 2) = 'me') and (Length(s) = 3) then
   548             begin
   548             begin
   549             liveLua:= (not liveLua);
   549             liveLua:= (not liveLua);
   550             if liveLua then
   550             if liveLua then
   551                 begin
   551                 begin
   552                 AddFileLog('[Lua] chat input string parsing enabled');
   552                 AddFileLog('[Lua] chat input string parsing enabled');
   553                 AddChatString(#3 + trmsg[sidLuaParsingOn]);
   553                 AddChatString(#3 + shortstring(trmsg[sidLuaParsingOn]));
   554                 end
   554                 end
   555             else
   555             else
   556                 begin
   556                 begin
   557                 AddFileLog('[Lua] chat input string parsing disabled');
   557                 AddFileLog('[Lua] chat input string parsing disabled');
   558                 AddChatString(#3 + trmsg[sidLuaParsingOff]);
   558                 AddChatString(#3 + shortstring(trmsg[sidLuaParsingOff]));
   559                 end;
   559                 end;
   560             UpdateInputLinePrefix();
   560             UpdateInputLinePrefix();
   561             end
   561             end
   562         else
   562         else
   563             AddChatString(#5 + trmsg[sidLuaParsingDenied]);
   563             AddChatString(#5 + shortstring(trmsg[sidLuaParsingDenied]));
   564         exit
   564         exit
   565         end;
   565         end;
   566 
   566 
   567     // Help commands
   567     // Help commands
   568     if (copy(s, 2, 11) = 'help taunts') then
   568     if (copy(s, 2, 11) = 'help taunts') then
   569         begin
   569         begin
   570         AddChatString(#3 + trcmd[sidCmdHeaderTaunts]);
   570         AddChatString(#3 + shortstring(trcmd[sidCmdHeaderTaunts]));
   571         AddChatString(#3 + trcmd[sidCmdSpeech]);
   571         AddChatString(#3 + shortstring(trcmd[sidCmdSpeech]));
   572         AddChatString(#3 + trcmd[sidCmdThink]);
   572         AddChatString(#3 + shortstring(trcmd[sidCmdThink]));
   573         AddChatString(#3 + trcmd[sidCmdYell]);
   573         AddChatString(#3 + shortstring(trcmd[sidCmdYell]));
   574         AddChatString(#3 + trcmd[sidCmdSpeechNumberHint]);
   574         AddChatString(#3 + shortstring(trcmd[sidCmdSpeechNumberHint]));
   575         AddChatString(#3 + trcmd[sidCmdHsa]);
   575         AddChatString(#3 + shortstring(trcmd[sidCmdHsa]));
   576         AddChatString(#3 + trcmd[sidCmdHta]);
   576         AddChatString(#3 + shortstring(trcmd[sidCmdHta]));
   577         AddChatString(#3 + trcmd[sidCmdHya]);
   577         AddChatString(#3 + shortstring(trcmd[sidCmdHya]));
   578         AddChatString(#3 + trcmd[sidCmdHurrah]);
   578         AddChatString(#3 + shortstring(trcmd[sidCmdHurrah]));
   579         AddChatString(#3 + trcmd[sidCmdIlovelotsoflemonade]);
   579         AddChatString(#3 + shortstring(trcmd[sidCmdIlovelotsoflemonade]));
   580         AddChatString(#3 + trcmd[sidCmdJuggle]);
   580         AddChatString(#3 + shortstring(trcmd[sidCmdJuggle]));
   581         AddChatString(#3 + trcmd[sidCmdRollup]);
   581         AddChatString(#3 + shortstring(trcmd[sidCmdRollup]));
   582         AddChatString(#3 + trcmd[sidCmdShrug]);
   582         AddChatString(#3 + shortstring(trcmd[sidCmdShrug]));
   583         AddChatString(#3 + trcmd[sidCmdWave]);
   583         AddChatString(#3 + shortstring(trcmd[sidCmdWave]));
   584         exit
   584         exit
   585         end;
   585         end;
   586 
   586 
   587     if (copy(s, 2, 4) = 'help') then
   587     if (copy(s, 2, 4) = 'help') then
   588         begin
   588         begin
   589         AddChatString(#3 + trcmd[sidCmdHeaderBasic]);
   589         AddChatString(#3 + shortstring(trcmd[sidCmdHeaderBasic]));
   590         if gameType = gmtNet then
   590         if gameType = gmtNet then
   591             AddChatString(#3 + trcmd[sidCmdPauseNet])
   591             AddChatString(#3 + shortstring(trcmd[sidCmdPauseNet]))
   592         else
   592         else
   593             AddChatString(#3 + trcmd[sidCmdPause]);
   593             AddChatString(#3 + shortstring(trcmd[sidCmdPause]));
   594         AddChatString(#3 + trcmd[sidCmdFullscreen]);
   594         AddChatString(#3 + shortstring(trcmd[sidCmdFullscreen]));
   595         AddChatString(#3 + trcmd[sidCmdQuit]);
   595         AddChatString(#3 + shortstring(trcmd[sidCmdQuit]));
   596         if gameType <> gmtNet then
   596         if gameType <> gmtNet then
   597             AddChatString(#3 + trcmd[sidLua]);
   597             AddChatString(#3 + shortstring(trcmd[sidLua]));
   598         // history and help commands needs to be close to the end because they are always visible
   598         // history and help commands needs to be close to the end because they are always visible
   599         // with a short chat history length.
   599         // with a short chat history length.
   600         AddChatString(#3 + trcmd[sidCmdTeam]);
   600         AddChatString(#3 + shortstring(trcmd[sidCmdTeam]));
   601         AddChatString(#3 + trcmd[sidCmdMe]);
   601         AddChatString(#3 + shortstring(trcmd[sidCmdMe]));
   602         AddChatString(#3 + trcmd[sidCmdTogglechat]);
   602         AddChatString(#3 + shortstring(trcmd[sidCmdTogglechat]));
   603         AddChatString(#3 + trcmd[sidCmdHistory]);
   603         AddChatString(#3 + shortstring(trcmd[sidCmdHistory]));
   604         AddChatString(#3 + trcmd[sidCmdHelp]);
   604         AddChatString(#3 + shortstring(trcmd[sidCmdHelp]));
   605         AddChatString(#3 + trcmd[sidCmdHelpTaunts]);
   605         AddChatString(#3 + shortstring(trcmd[sidCmdHelpTaunts]));
   606         exit
   606         exit
   607         end;
   607         end;
   608 
   608 
   609     // hedghog animations/taunts and engine commands
   609     // hedghog animations/taunts and engine commands
   610     if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
   610     if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
   625             end;
   625             end;
   626 
   626 
   627     if (gameType = gmtNet) then
   627     if (gameType = gmtNet) then
   628         SendConsoleCommand(s)
   628         SendConsoleCommand(s)
   629     else
   629     else
   630         AddChatString(#0 + trcmd[sidCmdUnknown]);
   630         AddChatString(#0 + shortstring(trcmd[sidCmdUnknown]));
   631     end
   631     end
   632 else
   632 else
   633     begin
   633     begin
   634     if liveLua then
   634     if liveLua then
   635         LuaParseString(s)
   635         LuaParseString(s)
  1135     SendIPC('s' + s);
  1135     SendIPC('s' + s);
  1136 
  1136 
  1137     if copy(s, 1, 4) = '/me ' then
  1137     if copy(s, 1, 4) = '/me ' then
  1138         s:= #2 + '* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
  1138         s:= #2 + '* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
  1139     else
  1139     else
  1140         s:= #1 + Format(trmsg[sidChat], UserNick, s);
  1140         s:= #1 + Format(shortstring(trmsg[sidChat]), UserNick, s);
  1141 
  1141 
  1142     AddChatString(s)
  1142     AddChatString(s)
  1143 end;
  1143 end;
  1144 
  1144 
  1145 procedure chTeamSay(var s: shortstring);
  1145 procedure chTeamSay(var s: shortstring);
  1146 begin
  1146 begin
  1147     SendIPC('b' + s);
  1147     SendIPC('b' + s);
  1148 
  1148 
  1149     s:= #4 + Format(trmsg[sidChatTeam], UserNick, s);
  1149     s:= #4 + Format(shortstring(trmsg[sidChatTeam]), UserNick, s);
  1150 
  1150 
  1151     AddChatString(s)
  1151     AddChatString(s)
  1152 end;
  1152 end;
  1153 
  1153 
  1154 procedure chHistory(var s: shortstring);
  1154 procedure chHistory(var s: shortstring);