Anyone know how to get two seperate stand alone chatbots to react to each other? I used to be able to do it but only between the old chaos hubgod client and a nmdc vb chatbot. The elfgirls.lua random chatbot talks to itself in a way, so im thinking it should be possible th alter my lua chatbot so it "hears" another chatbot. any ideas? here is the chatbot im using minus the triggers:
botname = "gabby"
trigs ={}}
function Main()
frmHub:RegBot(botname)
end
function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
-- get the msg only using regular expression
s,e,msg = strfind(data, "%b<>%s+(.+)")
-- look in the table
for key, value in trigs do
for key2, value2 in value do
if( strfind( strlower(msg), key) ) then
else break
end
if( strfind( strlower(msg), "!me") ) then
t="**"..curUser.sName
data=gsub (msg, "!me", t, 1 )
end
SendToAll( data ) -- send the original data
SetTimer(3200)
StartTimer()
answer, x = gsub(value[random(1,getn(value))], "%b[]", curUser.sName)
return 1; -- tell the hub we have processed the data
end
end
end
end
function OnTimer()
SendToAll( botname, answer ) -- send bot's answer
StopTimer()
end
Hi,
You want a triggie Bot which reacts when another BOT do something ???
Best regards, nErBoS
yes so that when one bot triggers and speaks, the other bot can trigger off from the response.
OK..
Make tell what are the questions that you want the bot awnswer (give also the awanswers).
Best regards, nErBoS
well my triggger list has hundreds of triggers so you prolly dont wanna edit those. but it wont help much to do that anyway. I already tried setting up two bots, and setting second bot up with trigger phrases that where copy pasted from the first bots reponses. the bot will respond to the same trigger when a user says it but if another bot says it it will not trigger. this is the delima.
I believe its somthing in this piece of code that needs modifying but not sure:
function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
-- get the msg only using regular expression
s,e,msg = strfind(data, "%b<>%s+(.+)")
problem is that admin console on ptokax is sent b4 it processes the data, and same with the scripts, they are done b4 text is procoessed so,it only processings whats not on the internal, ie external (clients)
so,you could have a bot that w8s on something like a pm from another bot wth /talk whatever
and the bot can check if /talk then do the checks but it means sending to main and in pm to the other bot ;)
g'luck
Well were goes a wint...
I suposse you only want the triggie responde to phrases that the other bot send in main so you can do this....
In the DataArrival..
if strfind(data, Bot2) --Catch every times the bots send a messange in the main
then you do this
if strfind(data, "The Bot2 was gagged the user") then
SendToAll(Bot, "Don?t do that Bot2.")
I think that is this that you want.
Best regards, nErBoS
hmm no dont think scripts can catch script data, cause technically its not real info its just a simple string from script like Par text, what you say in main so
you wud have to do in dataarrival
from pm if strsub = "/talk " type of thing
Hi,
I have tryied and worked phatty, i think talk is data.
Best regards, nErBoS
Latest public release of PtokaX.
A SendToAll, SendPmToAll, etc sends directly to all users,bypassing the scripts (it makes sense to save processing time). Think of the chaos that would ensue if a SendToAll sent it back to scripts, including the one that sent the original message (oiy!).
You could output all messages to a text file. Then you have the other script parse the data at a specific time interval (250ms should be fine) and *respond* to that data with another SendToAll.
-NotRabidWombat
why not ptokax in combination with bcdc++.
both can do lua scripting.
plop
One simple way must be using two tables like this one,
this is just a long shot from me, haven't tested or nothing, have no hubsoft where I am now so, pls try, :-)
Bot1 = "Name"
Bot2 = "Name"
-- words in tables should be the same, but different message's
Table1 = {
["word1"] = "Line",
}
Table2 = {
["word1"] = "Line",
}
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
s,e,msg = strfind(data, "%b<> ([ -z]*)")
local check1, key1,answer1 = ReturnPhrase(user,Table1,msg)
if check1 then
SendToAll( data )
SendToAll( Bot1, answer1 )
end
if Table2[key1] then
local check2, key2, respons = ReturnPhrase(user,Table2,msg)
SendToAll( Bot2, respons )
end
return 1
end
end
function ReturnPhrase(user,table,msg)
for key, value in table do
if( strfind( strlower(msg), key) ) then
answer, x = gsub(value, "%b[]", user.sName)
return 1,key,answer
end
end
end