PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: Madman on 03 April, 2006, 06:46:42

Title: Wordy
Post by: Madman on 03 April, 2006, 06:46:42

-- Wordy 1.0
-- Another pointless script brought to you by Madman

-- Now Children, what can we learn by this?
-- The danger of reading IRC quotes in the night @ bash.org //Madman

Word2Count = "devil"

function Main()
SetTimer(1000*60*60*24)
StartTimer()
wCount = 0
end

function ChatArrival(curUser, data)
local data = string.sub(data, 1, -2)
local s,e,data = string.find(data, "%b<>%s+(.*)")
local data,c = string.gsub(data , "(%w+)", function(word) return Count(word) end)
end

function Count(text)
local Word = string.lower(text)
if Word == Word2Count then
wCount = wCount+1
end
end

function OnTimer()
SendToAll("Wordy", "The word " ..Word2Count.. " was mentioned " ..wCount.. " time(s) in the last 24 hours")
wCount = 0
end
Title: Re: Wordy
Post by: Troubadour on 04 April, 2006, 14:19:37
nice one m8