i need help whit this script.
i get this error. textPM.lua:64: bad argument #1 to 'len' (string expected, got nil)
-- texter bot by plop
-- thx 2 chilla for the faster routine for opening the files
-- shows text files from a folder named text.
-- doesn't mather what prefix it used.
-- if the file exist it shows.
--
-- Converted to LUA 5 by Mutor 2/28/05
--
Bot = "?[Bot]TexT?"
FDFolder = "textpm"
function Main()
frmHub:RegBot(Bot)
end
function ChatArrival(user, data)
data=string.sub(data,1,string.len(data)-1)
if( string.sub(data, 1, 1) == "<" ) then
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
cmd = string.sub(cmd, 2,string.len(cmd))
if io.open(FDFolder.."/"..cmd..".txt",r) ~= nil then
showtext(user, cmd)
return 1
end
end
end
function ToArrival(user, data)
if(string.sub(data, 1, 4)) == "$To:" and (string.sub(data, 6,string.len(Bot)+5))== Bot then
s,e,cmd = string.find(data,"^$To:%s+%S+%s+From:%s+%S+%s+%$%b<>%s+(%S+)|$")
cmd = string.sub(cmd, 2,string.len(cmd))
if io.open(FDFolder.."/"..cmd..".txt",r) ~= nil then
showtext(user, cmd)
return 1
end
end
end
function showtext(user, file)
local contents ="\r\n\r\n"
for line in io.lines(FDFolder.."/"..file..".txt") do
contents = contents..line.."\r\n"
end
user:SendPM(Bot, contents.."\r\n|")
end
function showtextold(user, cmd)
local lines="\r\n\r\n"
for line in io.lines(file) do
lines = lines..line.."\r\n"
end
user:SendData(Bot, lines.." |")
end
Thats because you did not create the FD Folder.
I have attached a complete version where you just need to create the needed textfiles (an example is included)
now i get this. scripts\texter.lua:32: bad argument #1 to 'len' (string expected, got nil)
and i just copy in your file
i find the error.
i have the wrong BOT in the script.
Thx for the fast replay