It's possible to create an alarm clock. Example, an user ,chat, and he doesn't want to forget an appointment. So the user can set the hour of the appointment and when it is the hour, the Bot sends him a message in mainchat.
Someone, can help me!!
as usual, haven't tested it, but it is atleast a start...
timerintervall = 1 -- Number of hours between timeractions
Bot
appointments = {}
function oneveryMin()
StopTimer()
local sHour,sSec,sMin = tonumber(date("%H")),tonumber(date("%S")),tonumber(date("%M")) --(sHour*60*60*1000)
if appointments[sHour..":"..sMin] then
for i=1, getn(appointments[sHour..":"..sMin]) do
SendPmToNick(appointments[sHour..":"..sMin].i.name, Bot, appointments[sHour..":"..sMin].i.message)
end
end
local sSec = tonumber(date("%S"))
SetTimer((60*1000)-(sSec*1000)+(1*1000))
StartTimer()
end
function OnTimer()
oneveryMin()
end
function Main()
local sSec = tonumber(date("%S"))
SetTimer((60*1000)-(sSec*1000)+(1*1000))
StartTimer()
end
function DataArrival(user, data)
local s,e,cmd = strfind(data, "%b<>(%S+).*|")
if (( strsub(data, 1, 1) == "<" ) or (strsub(data, 1, strlen(Bot) + 5) == "$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
if (strfind(strlower(data), strlower("+addTimer"))) then
local _,_,cmd,hour,minute,message = strfind(data, "%b<>(%S+)%s+(%d%d)%:(%d%d)%s+(.*)")
if hour and minute then
if not appointments[hour..":"..minute] then
appointments[hour..":"..minute] = { {name = user.sName,message = message} }
else
tinsert(appointments[hour..":"..minute], {name = user.sName,message = message})
end
end
end
end
end
this will only work as long as you don't restart the hub, you have to get it to save the data on the harddrive if you want to beable restart the hub
the bot give me an error..
last token read: `then' at line 34 in string
there is a ) missing, try to fix it, this way you will learn much faster..
hmm, heres the script, Here (http://board.univ-angers.fr/thread.php?threadid=4008&boardid=26&styleid=1&sid=f7fbdc503ed591d453315139bfd0c127)
QuoteOriginally posted by Dessamator
hmm, heres the script, Alarm bot (http://board.univ-angers.fr/thread.php?threadid=1609&boardid=11&sid=0afe01af3447d6bdd51af1163e9a3e56)
click here to go here .. ? :P ;)
I think he meant this (http://board.univ-angers.fr/thread.php?threadid=4008&boardid=26&styleid=1&sid=f7fbdc503ed591d453315139bfd0c127). :]
Best regards,
jiten
yaps, exactly, jiten