PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Metaphase on 27 September, 2004, 00:36:52

Title: MultiHub Chat Script Problems...
Post by: Metaphase on 27 September, 2004, 00:36:52
Hi all.

The Hub network for which I am a hub owner in have decided to implement a multihub chat script. We have decided to go with a BCDC script in order to join all of our main chats. The problem we are having is as follows...

The script acts as a relay sending the chat to the other hubs. If somebody in Hub1 types a message, the text in Hub2 is preceeded by the Bots nick. The nick seems to be the same in all hubs even if we change it in each hub. We wish to have different nicks for the client in each hub so that we are able to assertain where the user is talking from. In Hub2 it would come up as User message. Now if a user in Hub2 was to type a message it would also come up as User message   and not   User message.

I hope I am making sense. Here is a copy of the script we are using...

Quote--// vim:ts=4:sw=4:noet
--//
--// the second argument decides in which order the scripts are run
--// use numbers when you need order, else you can just use a _unique_ identifier

CHATS = { ["-=UCDC-OC=-"]=1 }
BOTS = { ["-=UCDC-Sec=-"]=1 }
CHANGE= { ["-=UCDC-OC=-"] = "-=UCDC-OC=-", ["-=UCDC-OC=-"]="-=UCDC-OC=-" }

dcpp:setListener( "chat", "mchat",
   function( hub, user, text )
      local othernick = user:getNick()
      if BOTS[othernick] == nil then
         local s,e,fromhub = string.find(hub:getHubName(), "(%()%d")
         fromhub=string.sub(hub:getHubName(),1,s-2)
         fromhub = string.gsub(fromhub, "Hub1", "TGA")
         for k,v in dcpp._hubs do
            if v:getId() ~= hub:getId() then
               v:sendChat("<"..othernick.."> "..text)
            end
         end
      end
   end
)

dcpp:setListener( "pm", "mchat",
   function( hub, user, text )
      local othernick = user:getNick()
      local s,e,fromhub = string.find(hub:getHubName(), "(%()%d")
      fromhub=string.sub(hub:getHubName(),1,s-2)
      DC():PrintDebug(text)--.."         "..msg)
      if CHATS[othernick] then
         fromhub = string.gsub(fromhub, "Hub2", "TGA")
         for k,v in dcpp._hubs do
            if v:getId() ~= hub:getId() then
               local to = v:getUser(othernick)
               to:sendPrivMsgFmt("<"..fromhub.."> "..text)
            end
         end
      end
   end                                                         
)

DC():PrintDebug( "  ** Loaded chat.lua **" )

If you can see what the problem is could you please let us know. Also, this is going to have to be run over 5 hubs in total so this script needs some work. If you can recommend a better script that doesn't require the BCDC Client please let me know...

Many thanks.
Title:
Post by: ??????Hawk?????? on 27 September, 2004, 01:37:46
hi m8.

theres  a few  different chat links  try searching the forum..  

or you could use the link feature in Xsthetic Netserver.

d/l from my sig
Title:
Post by: HaArD on 27 September, 2004, 13:28:16
There are other choices... checking links in signatures is a good idea ???Hawk???