PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: jsjen on 15 April, 2004, 14:08:49

Title: chatroom bot
Post by: jsjen on 15 April, 2004, 14:08:49
We have a chatroom, is it possible to have a chat bot in there to answer newbie questions and just general chat when they say a word?.

Also can we show the last 20 lines of chat when someone logs in??


Thanks Jason

currently use this for chatroom

-- Chat-Room
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only
-- Simple Mod by SaintSinner thanks to phatty and plop and NL for the hints.
-- Simple Modify by WickeD to ChatRoom for User/Reg/Vip/Moderator/Op/Admin/Master.




function Main()
ChatRoom = "ChatRoom"
frmHub:RegBot(ChatRoom)
end
Levels= { [-1]=0,[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0}
------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == ChatRoom then
if Levels[user.iProfile] then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
elseif Levels[user.iProfile] == nil then
user:SendPM(ChatRoom, "That chat is for, User/Reg/Vip/Moderator/Op/Admin/Master. Your message has not been sent.")

end
end
end
end


function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if Levels[user.iProfile] then
usr:SendData("$To: "..usr.sName.." From: "..ChatRoom.." $<"..user.sName.."> " ..msg)


end
end
end
end
end
end


Title:
Post by: nErBoS on 17 April, 2004, 14:53:08
Hi,

It?s possible to do but the script would only respond to exactly pharses, or words, but if you do a search in words the script could be always be answering even when is not need.

In my opinion why do not make a file with F.A.Q. then users could se a file by a command, would be much easear and last heavy to your line.

Best regards, nErBoS
Title:
Post by: jsjen on 19 April, 2004, 12:44:02
can we get the chatroom bot to send a pm to people who log in to show them last 20 lines of chat?

I have a script running for the main chat but cause it lags so much somedays people use chatroom.

one question why does main chat lag some times? and chatroom doesnt?
Title:
Post by: plop on 19 April, 2004, 22:31:56
QuoteOriginally posted by jsjen
can we get the chatroom bot to send a pm to people who log in to show them last 20 lines of chat?

I have a script running for the main chat but cause it lags so much somedays people use chatroom.

one question why does main chat lag some times? and chatroom doesnt?
sounds like or a bug on the scripts you are running.
if you pm 2 a bot/chatroom it doesn't get checked by the other scripts you are running and so use less resources.

can you give some system specs + the names of the scripts you are running?

plop
Title:
Post by: jsjen on 19 April, 2004, 23:14:09
mm specs.

machine p4 2.4, 500meg ram,on 256 dsl connection.

hub running ptokaX 0.326

bots in hub are

chatroom.lua   C: 80   T: 85
historian.lua   C: 78   T: 91
leacher.lua   C: 77   T: 111
UserHelperBot.lua   C: 56   T: 86
removeuser.lua   C: 102   T: 143
RoboCopv7.0a.lua   C: 645   T: 697
sharegrowth.lua   C: 86   T: 109

Do any of these bots do the same job?
Title:
Post by: plop on 20 April, 2004, 00:09:11
ment the real names of the scripts, not the filenames.
forgot 2 ask the amount of users you have.

leacher.lua C: 77 T: 111  -- leech blocker i guess.

maby try removing some of the scripts and add them 1 by 1, then you might find which script is causing the lag.

plop
Title:
Post by: jsjen on 20 April, 2004, 00:52:53
We change the names of our bots to suit the hub. Did you want the origional names?

Yes it is a leech blocker.

We have maybe 40 people at any one time, I know really small hub. But the complain about the 5-10 second lag, so I got the chatroom bot and it didnt lag.

I removed all bots and it seemed a little better.

Thanks for your help.
Title:
Post by: plop on 20 April, 2004, 01:52:51
QuoteOriginally posted by jsjen
I removed all bots and it seemed a little better.
wait a sec, is the database from ptokax enabled??
if so try flushing the database or even disable it (hub restart needed).

plop
Title:
Post by: jsjen on 26 April, 2004, 14:29:18
that seems to work, but occasionally I get a few seconds lag which I dont usually get with tha hub on my pc.

Thanks for your help
Title:
Post by: jsjen on 31 May, 2004, 14:29:24
I was wondering if I could still ask for this.

I wish the chatroom to have a chat history that would show last chats when a registered user enteres the hub

I hope this would be possible

J