Hi, this is my first try to make a bot...I never made a script before =)
Just doing to this bot beacuse, to practise lua =)
What the script does...
write hi, and the bot answers...
The problem...
When somebody writes hi, nobody see that..
What i want is that it should look like this
[06:14]
hi
[06:15] Hi how are you?
But it only show =(
[06:15] Hi how are you?
So what should i change so everybody see the command hi?
And how do i make a or function, so it responds "Hi how are you?" on these words, Hi, Hello, and Hej
--// Test of TalkBot made of Madman
Bot = "TalkBot"
--// This function is fired at the serving start
function Main()
frmHub:RegBot(Bot)
end
--// This function is fired when a new user finishes the login
function NewUserConnected(curUser)
SendToAll(Bot, "The User "..curUser.sName.." has connected to the hub")
end
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == "hi" then
user:SendData(Bot,"Hi how are you?")
return 1
end
end
end
Hope you guys understand =)
Well now i am of to work...
And yeah.. dont post a whole, script, just post the changes, so i can learn as mush as possibole =)
Thanks
QuoteOriginally posted by madman
Hi, this is my first try to make a bot...I never made a script before =)
Just doing to this bot beacuse, to practise lua =)
What the script does...
write hi, and the bot answers...
The problem...
When somebody writes hi, nobody see that..
What i want is that it should look like this
[06:14] hi
[06:15] Hi how are you?
But it only show =(
[06:15] Hi how are you?
So what should i change so everybody see the command hi?
And how do i make a or function, so it responds "Hi how are you?" on these words, Hi, Hello, and Hej
--// Test of TalkBot made of Madman
Bot = "TalkBot"
--// This function is fired at the serving start
function Main()
frmHub:RegBot(Bot)
end
--// This function is fired when a new user finishes the login
function NewUserConnected(curUser)
SendToAll(Bot, "The User "..curUser.sName.." has connected to the hub")
end
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == "hi" then
user:SendData(Bot,"Hi how are you?")
return 1
end
end
end
Hope you guys understand =)
Well now i am of to work...
And yeah.. dont post a whole, script, just post the changes, so i can learn as mush as possibole =)
Thanks
Hey madMan
You see this line "user:SendData(Bot,"Hi how are you?")"
and compare it to "SendToAll(Bot, "The User "..curUser.sName.." has connected to the hub")
" which is right by the way!!
Thanks kepp, i changed to send to all, but that did not work, so i changed the return 1 to return 0, so now it works...
Now i just need to make some kind of an or function..
so it answer with the same answer, when a user writes hi, hello or hej...
But i have no idea to do that.. but hopefully i will find out =)
*edit*
whoo, i got it working =)
No or function... but it works :p
catch ya l8r =)