Hi!
I'm looking for a way to notify users not to speak to the hubbot e.g. when they recieve a pop-up window from login or when they are warned.
I'm having a lot of n00b-users in my hub... and i sometimes see from the CMD screen in ptokax that they are replying/talking to the bot... :rolleyes:
Anyone knows how? ?(
Tnx! :)
This shud work....
sBot = "Name Bot Here"
function Main()
frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
end
function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)
s,e,sTo= strfind(data, "$TO:%s+(%S+)") -- find out who the pm is to
if not GetItemByName(sTo) then -- this checks to see if the target of the PM is actually a proper user
Curuser:SendPM(sBot, "Are you MAD?!? Your talking to an automated bot!!")
end
end
Thanx for quick reply [UK]Madman,
There seems to be some problem tho:
Syntax error: bad argument #1 to `strfind' (string expected, got nil)
stack traceback:
1: function `strfind' [C]
2: function `DataArrival' at line 10 [file `..._0.330_15.25 (+RC9.0c)\scripts\talkingtobot.lua']
I'm sorry, i'm a complete n00b with lua... don't know the error...
Quote---
sBot = "[?Cerberus?]"
function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
end
function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)
s,e,sTo= strfind(sData, "$TO:%s+(%S+)") -- find out who the pm is to
if not GetItemByName(sTo) then -- this checks to see if the target of the PM is actually a proper user
Curuser:SendPM(sBot, "Are you MAD?!? Your talking to yourself as "..sTo.." is only a bot!!")
end
end
---
Apologies, first post ammended, I mistakenly used sData unstead of data for the strfind function.
Yes... it is better, but still a problem:
Syntax error: attempt to concat global `sTo' (a nil value)
stack traceback:
1: function `DataArrival' at line 12 [file `..._0.330_15.25 (+RC9.0c)\scripts\talkingtobot.lua']
QuotesBot = "[?Cerberus?]"
-- function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
-- end
function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)
s,e,sTo= strfind(data, "$TO:%s+(%S+)") -- find out who the pm is to
if not GetItemByName(sTo) then -- this checks to see if the target of the PM is actually a proper user
Curuser:SendPM(sBot, "Are you MAD?!? Your talking to yourself as "..sTo.." is only a bot!!")
end
end
Edited again, might get it right in a min ! lol
Yes! thanx [UK]Madman!
it now works... however (i know i am a pain in the behind)...
I get the message too when i talk in OpChat & VipChat...
is it possible to set the script so that it only gives the reply when spoken to the sBot?
Tnx again :)
OOppsss, forgot about that, knew it seemed to easy!! I borrowed the code from another bot im writing that warns users there getting a bots filelist .. forgot you talk to OpChat and VipChat!!
replace
if not GetItemByName(sTo) then
with
if sTo == sBot then
hmmm... No errors, but now it gives no reply at all anymore :( :
QuotesBot = "[?Cerberus?]"
-- function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
-- end
function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)
s,e,sTo= strfind(data, "$TO:%s+(%S+)") -- find out who the pm is to
if sTo == sBot then
Curuser:SendPM(sBot, "Are you MAD?!? Your talking to an automated bot!!")
end
end
Does [UK]Madman or someone else have a solution to this?
Home from work and this is now tested and working fine :o)
sBot = "Bot Name"
-- function Main()
-- frmHub:RegBot(sBot) -- delete this if your using same name as another bot!
-- end
function DataArrival(Curuser,data)
data = strsub(data,1,strlen(data)-1)
s,e,sTo= strfind(data, "$To:%s+(%S+)") -- find out who the pm is to
if sTo == sBot then
Curuser:SendPM(sBot, "Are you MAD?!? Your trying to talk to "..sTo.." whos only a bot!!")
end
end
Was stupid mistake in the patern matching!
Thanx a load [UK]Madman!
Works pretty well this way!
:D
U made me very happy :) tnx again! :D
Got there in the end . lol
Glad it works ok :o)