PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: blackwings on 28 February, 2005, 05:17:28

Title: Timebot converted to LUA 5 please !!!
Post by: blackwings on 28 February, 2005, 05:17:28
if it wasn't for the file handling and the unusual clock system, I would have converted the script myself = --Little changed by nErboS

bot = "#News"
name1 = "News"
name2 = "Announcements"


sec = 60
 
fMsgAll = "MsgAll.txt"
sMsgAll = ""

fMsgAll2 = "MsgAll2.txt"
sMsgAll2 = ""

tClock = {
["tMsgAll"] = clock() + 1*sec, -- Time to show in minutes
["tMsgAll2"] = clock() + 1*sec, -- Time to show in minutes
}

function Main()
frmHub:RegBot(bot)
sMsgAll = Readtext(fMsgAll)
sMsgAll2 = Readtext(fMsgAll2)
StartTimer()
end

function OnTimer()
if (tClock["tMsgAll"] <= clock() and sMsgAll~= "") then
tClock["tMsgAll"] = clock() + 150*sec
SendPmToAll(bot, sMsgAll)
end
if (tClock["tMsgAll2"] <= clock() and sMsgAll2~= "") then
tClock["tMsgAll2"] = clock() + 220*sec
SendPmToAll(name2, sMsgAll2)
end
end

function Readtext(file)
local sTmp = ""
if (readfrom(file) ~= nil) then
readfrom(file)
while 1 do
local sLine = read()
if (sLine == nil) then
break
else
sTmp = sTmp..sLine.."\r\n"
end
end
readfrom()
end
return sTmp
end
Title:
Post by: Jelf on 07 March, 2005, 09:26:33
lol@math.minutes

Soz had to laugh, bloody convertor, I spend more time removing those than changing anything else.