i got this script that i could do with converting if any could please i tryed but failed to work.
function Main()
frmHub:RegBot(botname)
end
function DataArrival(curUser, data)
status=string.sub(data,1,string.len(data)-1)
-- parse the command
s,e,cmd = string.find( status, "%b<>%s+(%S+)" )
if (cmd=="+quiet") then
trigall=0
SendToAll(botname, "Hmf, If you want me to be quiet you only have to ask Asshole :(( ")
return 1
elseif (cmd=="+talk") then
trigall=1
SendToAll(botname, "You are not worthy nor my Master, but as i'm a script i have no choice :-)")
return 1
end
if( string.sub(data, 1, 1) == "<" ) then
-- get the msg only using regular expression
s,e,msg = string.find(data, "%b<>([%a ]+)")
-- look in the table
if trigall==1 then
for key, value in trigs do
for key2, value2 in value do
if( string.find( string.lower(msg), key) ) then
else break
end
if( string.find( string.lower(msg), "!me") ) then
t="**"..curUser.sName
data=string.gsub (msg, "!me", t, 1 )
end
SendToAll( data ) -- send the original data
SetTimer(1800)
StartTimer()
answer, x = string.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
end
Try this (not tested):
-- converted to lua 5 by jiten
function Main()
frmHub:RegBot(botname)
end
function ChatArrival(curUser, data)
status=string.sub(data,1,string.len(data)-1)
-- parse the command
s,e,cmd = string.find( status, "%b<>%s+(%S+)" )
if (cmd=="+quiet") then
trigall=0
SendToAll(botname, "Hmf, If you want me to be quiet you only have to ask Asshole :(( ")
return 1
elseif (cmd=="+talk") then
trigall=1
SendToAll(botname, "You are not worthy nor my Master, but as i'm a script i have no choice :-)")
return 1
end
-- get the msg only using regular expression
s,e,msg = string.find(data, "%b<>([%a ]+)")
-- look in the table
if trigall==1 then
for key, value in trigs do
for key2, value2 in value do
if( string.find( string.lower(msg), key) ) then
else break
end
if( string.find( string.lower(msg), "!me") ) then
t="**"..curUser.sName
data=string.gsub (msg, "!me", t, 1 )
end
SendToAll( data ) -- send the original data
SetTimer(1800)
StartTimer()
answer, x = string.string.gsub(value[math.random(1,table.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
Cheers
sorry bro but an error
Syntax ...gs\Damo\Desktop\Copy of 0.3.3.0.b16\scripts\adda.lua:447: attempt to index field `string' (a nil value)
QuoteOriginally posted by damo
sorry bro but an error
Syntax ...gs\Damo\Desktop\Copy of 0.3.3.0.b16\scripts\adda.lua:447: attempt to index field `string' (a nil value)
Erm, there's no 447th line in the script I posted.
Btw, the script u gave me is very incomplete, so it may not work. Looks like wiseguy....
Cheers
Isnt there an extra sting in there.....
answer, x = string.string.gsub (value[math.random(1,table.getn(value))], "%b[]", curUser.sName)
Im guessinthat it should be string.gsub
QuoteOriginally posted by [UK]Madman
Isnt there an extra sting in there.....
answer, x = string.string.gsub (value[math.random(1,table.getn(value))], "%b[]", curUser.sName)
Im guessinthat it should be string.gsub
Indeed ;)
thx guys is working fine now thanks for the help must have missed one on the converting
QuoteOriginally posted by damo
thx guys is working fine now thanks for the help must have missed one on the converting
yw :]