PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: blackwings on 12 May, 2004, 20:38:16

Title: chat room for anyone, no invite needed
Post by: blackwings on 12 May, 2004, 20:38:16
Hi, I wonder if anyone could make a script that is like the op chat, but everyone can chat in it and they don't need to get invited to chat there?

~blackwings
Title:
Post by: [NL]ZeroX on 12 May, 2004, 21:15:18
i think its imposible because:
if you send a message to that chat, everyone in the hub gets that message

but i'm sure not everyone want to chat in that chatroom
so there's need an invite (mayB an addme) command for entering that chatroom
Title:
Post by: blackwings on 12 May, 2004, 21:41:33
what I wanted it to do, isn't it lika the OP chat, but you allow all profiles to chat in it?
Title:
Post by: TiMeTrAVelleR on 12 May, 2004, 22:02:55
If  everyone   must  get in  why  dont  you use  the main chat  than ???
Title:
Post by: plop on 12 May, 2004, 22:09:54
QuoteOriginally posted by [NL]ZeroX
i think its imposible because:
if you send a message to that chat, everyone in the hub gets that message

but i'm sure not everyone want to chat in that chatroom
so there's need an invite (mayB an addme) command for entering that chatroom
it is posible but not a good idea.
i had a room like that running in my hub for a couple day's.
it linked 2/3 hub's 2gether in a seperate chat window.
just it anoyed the hell out of everybody.
best 2 have the user decide by himself wheter he wants 2 join that chat or not.

plop
Title:
Post by: Corayzon on 13 May, 2004, 09:12:49
i wrote this chat room bot ages ago...could proberbly be fixed up a shitload now...but dont have time...so ere ya go....

list of commands

main commnads
+startchat
+joinchat
+chatrooms

chatroom commands
+userlist
+exit
+kill

--// BotName
sBot = "-ChatRoom-Bot-"

tChatRoom = {}
iChatRoom = {}
tRoomList = {}

--///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--// Main function
--///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function Main()
frmHub:EnableFullData(1)
frmHub:RegBot(sBot)
end

--///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--// Data arrival from client on server
--///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function DataArrival(user, data)

data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")

-- Chat Room Functions
------------------------------------------
if cmd == "+startchat" then
user:SendPM(user.sName, "***Starting Chat Room v0.01 ...")
iChatRoom[user.sName] = "qChatName"
user:SendPM(user.sName, "***Please enter your ChatRoom Name: ")
return 1

elseif cmd == "+joinchat" then
_,_,cmd,hubname = strfind(data, "%b<>%s+(%S+)%s+(%S+)")
if iChatRoom[hubname] ~= nil then
local host = iChatRoom[hubname]
local hub = iChatRoom[host]
tChatRoom[host]["userlist"][user.sName] = user.sName
tChatRoom[host]["count"] = tChatRoom[host]["count"] + 1
SendPmToNick(user.sName, hub, "***You have connected to "..hubname)
SendPmToNick(hub, user.sName, "***"..user.sName.." has connected to the chatroom")
else
user:SendData(sBot, "***Unable to connected to chatroom "..hubname)
end

elseif cmd == "+chatrooms" then
local sOut = "\r\n\r\n\tChat Room List\r\n\r\n"
if tRoomList ~= nil then
for roomname, e in tRoomList do
sOut=sOut.."\t\t"..roomname.."\t"..tChatRoom[iChatRoom[roomname]]["count"]
end
user:SendData(sBot, sOut)
end

end

-- ChatRoom chat
if tChatRoom ~= nil then
for haha, room in tChatRoom do
if strfind(data, "$To: "..room["hubname"]) then
if room["userlist"][user.sName] == user.sName then

if cmd == "+userlist" then

local sOut = "\r\n\r\n\tU s e r   L i s t\r\n\r\n"
for users, e in room["userlist"] do
sOut=sOut.."\t\t"..users.."\r\n"
end
SendPmToNick(user.sName, room["hubname"], sOut)

elseif cmd == "+exit" then
room["userlist"][user.sName] = nil
room["count"] = room["count"] - 1
SendPmToNick(user.sName, room["hubname"], "***You have disconnected from "..hubname)
SendPmToNick(room["hubname"], user.sName, "***"..user.sName.." has disconnected to the chatroom")


elseif cmd == "+kill" then
if room["host"] == user.sName then

iChatRoom[room["hubname"]] = nil
iChatRoom[room["hubname"]] = nil
tRoomList[room["hubname"]] = nil
frmHub:UnregBot(room["hubname"])
room = nil
return 1
end
else
for users, e in room["userlist"] do

_,_,string = strfind(data, "%b<>%s+(.+)")
if users ~= user.sName then
SendPmToNick(users, room["hubname"], "["..user.sName.."] "..string)
return 1
end
end
end
end
end
end
end

-- ChatRoom initailization
if cmd ~= nil then
if iChatRoom[user.sName] ~= nil then
if strfind(data, "$To: "..user.sName) then
if iChatRoom[user.sName] == "qChatName" then

_,_,hubname = strfind(data, "%b<>%s+(.+)")
tChatRoom[user.sName] = {}
frmHub:RegBot(hubname)
tChatRoom[user.sName]["host"] = user.sName
tChatRoom[user.sName]["userlist"] = {}
tChatRoom[user.sName]["userlist"][user.sName] = user.sName
tChatRoom[user.sName]["hubname"] = hubname
tChatRoom[user.sName]["count"] = 1
iChatRoom[user.sName] = hubname
iChatRoom[hubname] = user.sName
tRoomList[hubname] = hubname
SendPmToNick(user.sName, hubname, "***"..hubname.." has started")
SendPmToNick(user.sName, hubname, "***You have connected to "..hubname)
return 1

--elseif tChatRoom[user.sName]["state"] == [
end
end
end
end
end
Title:
Post by: blackwings on 13 May, 2004, 10:45:57
Why not use this code and also allow these profiles = Operators, VIP, Reg, User (with other words, all other default ptokax profiles)

--Requested by ?????k??
--Made by nErBoS

sBot = "Master-Chat"

info_chat = "$MyINFO $ALL "..sBot.."  Master-Chat  $ $Cable"..strchar( 1 ).."$$0$|"

function OpConnected(user, data)
if (user.iProfile == 0) then
user:SendData( info_chat )
end
end

function DataArrival(user, data)

if (strsub(data,1,12) == "$GetNickList") then
if (user.iProfile == 0) then
user:SendData( info_chat )
end
end

if (strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
if (user.iProfile == 0) then
local aux,usr
local s,e,talk = strfind(data, "$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(.+)")
for aux, usr in GetUsersByProfile("Master") do
if (GetItemByName(usr) ~= nil and usr ~= user.sName) then
SendToNick(usr, "$To: "..usr.." From: "..sBot.." $<"..user.sName.."> "..talk)
end
end
end
end
end

Title:
Post by: Corayzon on 14 May, 2004, 11:32:55
this is because this was a request for a masters chat from ?????k?? ;)
Title:
Post by: blackwings on 14 May, 2004, 13:53:12
QuoteOriginally posted by Corayzon
this is because this was a request for a masters chat from ?????k?? ;)

That wasn't any real answer to my problem :P Is it really so hard just to add all profiles to the code I posted ealier? which if it's done, everyone will be able to chat there.
Title:
Post by: plop on 14 May, 2004, 17:15:06
QuoteOriginally posted by blackwings
QuoteOriginally posted by Corayzon
this is because this was a request for a masters chat from ?????k?? ;)

That wasn't any real answer to my problem :P Is it really so hard just to add all profiles to the code I posted ealier? which if it's done, everyone will be able to chat there.
here you have a really lame chat room script.
so lame i didn't have the guts 2 try it.
-- really lame chat room bot
-- by plop

Bot = "Chat_room"

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if(strsub(data, 1, 4) == "$To:") then
      local s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if whoTo == Bot then
         data=strsub(data,1,strlen(data)-1)
         local s,e,txt = strfind(data, "%$(%b<>.+)")
         if txt then
            SendPmToAll(Bot, txt.."|")
         end
      end
   end
end
plop
Title:
Post by: Corayzon on 14 May, 2004, 18:47:24
hmmm
Title:
Post by: plop on 14 May, 2004, 19:19:57
copyed 1 line 2 much. lol
was actualy a room for vips only.
but edited my post and it's now open 2 all levels.

plop
Title:
Post by: blackwings on 16 June, 2004, 21:13:41
The chat room do as it should, but when I send messages with DC++ 0.401, I get =
Syntax Error: attempt to index local `nick' (a nil value)

But I don't get any error when I send messages with pDC++ 0.306 1.19b.


Another thing, is it possible to in the chat room to remove the botname before the usernames, or atleast be able to config your-self what it shold say?

Instead of this =
<*Chat Bot> Chatting etc....

it should be like this =
Chatting etc....
            or
<*CB> Chatting etc....


Is it also possible that in your own chat window, that you dont get a double message of your message, here is a example on how it is now =

Chatting....
<*Chat Bot> Chatting....

Instead you shall just see =

<*Chat Bot> Chatting....

I know that these similar examples are confusing, but I tried my best :P Anyway, I hope this is possible and that someone will help me.
Title:
Post by: plop on 16 June, 2004, 23:25:44
both requests done.
---------------------------------------
-- V 1
-- really lame chat room bot
----
-- V 2
-- doesn't repeat 2 the sender
-- doesn't show botname on the pm's
---------------------------------------
-- by plop        [URL]http://www.plop.nl[/URL] --
---------------------------------------

Bot = "Chat_room"

tUsers = {}

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if tUsers[user.sName] == nil then
      tUsers[user.sName] = 1
   end
   if(strsub(data, 1, 4) == "$To:") then
      local s,e,whoTo = strfind(data,"$To:%s+(%S+)")
      if whoTo == Bot then
         data=strsub(data,1,strlen(data)-1)
         local s,e,txt = strfind(data, "%$(%b<>.+)")
         local usr
         if txt then
            for a,b in tUsers do
               if a ~= user.sName then
                  usr = GetItemByName(a)
                  if usr then
                     usr:SendData("$To: "..usr.sName.." From: "..Bot.." $"..txt.."|")
                  else
                     tUsers[a] = nil
                  end
               end
            end
         end
      end
   end
end

function OpConnected(user)
   if tUsers[user.sName] == nil then
      tUsers[user.sName] = 1
   end
end

NewUserConnected = OpConnected

function OpDisconnected(user)
   if tUsers[user.sName] then
      tUsers[user.sName] = nil
   end
end

UserDisconnected = OpDisconnected

the error you posted can't be from this chat script.
the vallue nick isn't used anywhere.

plop
Title:
Post by: blackwings on 17 June, 2004, 00:11:16
QuoteOriginally posted by plop
the error you posted can't be from this chat script.
the vallue nick isn't used anywhere.

plop

That's strange, can it be channelbot 0.9g or Bad word combination script(the one with gag function, made by Nerbos)?
Title:
Post by: bastya_elvtars on 17 June, 2004, 00:20:25
i think tis sould work as:

1) a user opens a room

(eg. !openchat )

2) he/she invites peeps

OR

2) roombot notifiens peeps already there when a user enters/leaves
Title:
Post by: blackwings on 17 June, 2004, 00:24:37
QuoteOriginally posted by bastya_elvtars
i think tis sould work as:

1) a user opens a room

(eg. !openchat )

2) he/she invites peeps

OR

2) roombot notifiens peeps already there when a user enters/leaves

that's sounds too complicated :P I think it nice as it is:)(but I haven't tested the new version yet :P)

EDIT: eh, well the function that it could give a user that enters, a messages that tells if there are other people there or not, is nice. But I don't know if it's possible
Title:
Post by: plop on 17 June, 2004, 03:10:52
QuoteOriginally posted by bastya_elvtars
i think tis sould work as:

1) a user opens a room

(eg. !openchat )

2) he/she invites peeps

OR

2) roombot notifiens peeps already there when a user enters/leaves
i believe tezlo's chatroom bot works like that.

plop
Title:
Post by: [FRDH]freestyler on 20 July, 2004, 11:39:25
is there no script that see only ops and users[not all users only the users wo are in the room]and that as a user in the chatroom is that there is a message with
' the user freestyler is entering the chatroom'
and not al users see what he is asking only he and the OPS/masters/owners






=======================================
FRDH (http://www.frdh.nl.tt) //www.frdh.nl.tt
dchub://frdh.no-ip.info:410                  :)
dchub://frdh2.no-ip.info:412
=======================================
Title:
Post by: plop on 20 July, 2004, 14:59:04
QuoteOriginally posted by [FRDH]freestyler
is there no script that see only ops and users[not all users only the users wo are in the room]and that as a user in the chatroom is that there is a message with
' the user freestyler is entering the chatroom'
and not al users see what he is asking only he and the OPS/masters/owners
that sounds a bit like an open opchat.
am i right??

plop