View Single Post
05-26-09, 11:38 AM   #10
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by playsatan View Post
also i like your idea of starting the next message where the last one had a space. how hard you that be to implement ?
That's what that function is supposed to do. I haven't actually looked at the code for the addon yet, but the idea is to replace the SendChatMessage call with a call to that function instead. If SendChatMessage should whisper a player, send their name as the second argument.

Also, it should actually be this...still haven't tested it though
Code:
local function SendSplitMessages(message, player) --player is optional, name of the player to whisper -- assumes Guild chat if you don't send it anything
   message = strtrim(message)
   local msg, chan = strsplit(" ",message), player and "WHISPER" or "GUILD"
   for i=2, select(#, strsplit(" ",message)) do
       local new = select(i, strsplit(" ",message))
       if not new then
          SendChatMessage(msg, chan, nil, player)
          return
       end
       if strlen(msg) + strlen(new) > 254 then
          SendChatMessage(msg, chan, nil, player)
          msg = ""
       end
       msg = msg .. " " .. new
   end
   if msg and msg ~= "" and msg ~= " " then
       SendChatMessage(msg, chan, nil, player)
   end
end
  Reply With Quote