PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Leun on 19 September, 2005, 19:07:08

Title: Speak in name of bot
Post by: Leun on 19 September, 2005, 19:07:08
I wanne try change this script (http://board.univ-angers.fr/thread.php?threadid=4391&boardid=26&sid=e9e32e127df0fafee20998b3dac5cb3a) , into a script were user can speak in name of bot.
So I thought I get this script, remove the users and script is finnished.


So if a user typed      !bot asdfa
then in main: asdfa

But I do something wrong...
Can someone help me.

This is what I got:
-- pm-to by ??????Hawk??????
-- simple pm to bot
-- 28-01-2005
--## Converted in LUA 5 by 6Marilyn6Manson6 at 06/05/2005
-- Command   !bot    


bot = "PM-to"
function Main()
frmHub:RegBot(bot)
end

function ChatArrival(user, data)

data = string.sub(data, 1, (string.len(data)-1))
local s,e,command,msg = string.find(data, "%b<>%s+(%S+)%s*(.*)")
if command == "!bot"  then
if msg ~= nil then
user:SendData(Bot, ""..bot.." "..msg)
return 1
else
user.SendData(bot,"Command is !bot [user] [text]")
return 1
end
        end
end
 
Title:
Post by: Madman on 19 September, 2005, 23:52:09
-- pm-to by ?˜”??•Hawk•??”˜?
-- simple pm to bot
-- 28-01-2005
--## Converted in LUA 5 by 6Marilyn6Manson6 at 06/05/2005
-- Command   !bot    

bot = "PM-to"
function Main()
frmHub:RegBot(bot)
end

function ChatArrival(user, data)
data = string.sub(data, 1, (string.len(data)-1))
local s,e,command,msg = string.find(data, "%b<>%s+(%S+)%s*(.*)")
if command == "!bot" then
if msg ~= nil then
user:SendData(bot, msg)
return 1
else
user:SendData(bot,"Command is !bot [text]")
return 1
end
end
end
Title: thnx Madman
Post by: Leun on 20 September, 2005, 10:19:37
Thnx Madman,

That was easier as I thought  :D
Next time I will look better.