PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: thunder-droopy on 11 August, 2006, 18:28:15

Title: need some help with this complete fun script.
Post by: thunder-droopy on 11 August, 2006, 18:28:15
hi peeps,

can anyone help me?
i use this complete fun script, but since i've instaleld leviathan 2.7 i get this error when i star up complete fun.
Syntax D:\ptokax hub 2\scripts\Complete fun.lua:576: attempt to call a table value
can anyone tel me what is wrong and how i solve this problem?
thnx already!
greetz droopy

this is the script code:
Bot = "Ravebabe"

trigall=1

trigw = {


fav={
"Yeah [CURUSER], bijna goed, probeer dit -----> /fav ",
"Hmm, ik denk dat je dit bedoelde [CURUSER] ?-----> /fav ",
"probeer dit [CURUSER]-------> /fav ",
"[CURUSER], dit zal beter gaan -----> /fav ",
"dat begrijpt ie niet [CURUSER] --> /fav <-- begrijpt ie wel. ?;-) "
},

etc etc etc....

yeah={
"yes",
"yep",
"uh huh",
"100%",
"party on dude!",
"eg wel",
"uh-hu",
"oh yes",
"op cker!",
"wat dachie dan",
"roger!",
"10-4 !",
"klopt!!",
"you rock!",
"sure",
"euh...jij zegt het [CURUSER]",
"tralalalala",
"exact!",
"kee dan!"
},

}


function Main()
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(Bot, " Hmf, Okidoki I will be quiet :(( ")
return 1
elseif (cmd=="+speak") then
trigall=1
SendToAll(Bot, " Okay, I will talk to you again :-)")
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 trigw 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[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( Bot , answer ) -- send bot's answer
StopTimer()
end
end--------------------------------------------------------------------------------
Title: Re: need some help with this complete fun script.
Post by: bastya_elvtars on 14 August, 2006, 15:23:55
In that line, there should be a for k,v in tbl do -like thingy. Now rewrite this to be like this: for k,v in pairs(tbl) do