PtokaX forum

Development Section => Your Developing Problems => Topic started by: enema on 29 October, 2004, 09:50:19

Title: "Upgrading" time script
Post by: enema on 29 October, 2004, 09:50:19
Hi!!

I wanted to add somekind of functions to this time bot
 current = date("%H:%M")
min = 1000*60

--------------------------------------------------------
function Main()
frmHub:RegBot("---" ..current .."---")
SetTimer(min)
StartTimer()
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot("---" ..current .."---")
time = date("%H:%M")
current = time
frmHub:RegBot("---" ..current .."---")
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot("---" ..current .."---")
end
--------------------------------------------------------
...but I dont know how to do it... I want that function to look like this - Bot = "lunch"

if " ..current .." == "12:30"
then
SendToAll(Bot,"--Its time to have a lunch!! --")
end

as you can guess, my idea doesnt work and it needs a push from experts... this bot should send a message in chat when clock is 12:30. Can anyone help me?
Title:
Post by: plop on 30 October, 2004, 00:33:08
give this a try.
iMin = 1000*60
tTime = {
--["timestring"] = "show this string"
["12:30"] = "Its time to have a lunch!!",
["13:00"] = "It's time to burp!!",
["9:00"] = "You should be asleep!"
}

--------------------------------------------------------
function Main()
current = date("%H:%M")
if tTime[current] then
SendToAll( ("---" ..current .."---"), tTime[current] )
end
frmHub:RegBot("---" ..current .."---")
SetTimer(iMin)
StartTimer()
end
--------------------------------------------------------
function OnTimer()
frmHub:UnregBot("---" ..current .."---")
current = date("%H:%M")
if tTime[current] then
SendToAll( ("---" ..current .."---"), tTime[current] )
end
frmHub:RegBot("---" ..current .."---")
end
--------------------------------------------------------
function OnExit()
frmHub:UnregBot("---" ..current .."---")
end
--------------------------------------------------------

plop
Title:
Post by: BoJlk on 30 October, 2004, 02:41:29
This is a Great idea!
Thou the script is Bandwight Consuming.
Are those Messagess appearing in MainChat or in NickName
And can commands like:
(!message on/off or !showmsg main/pm etc') be added
Title:
Post by: enema on 30 October, 2004, 08:38:58
Thanks a LOT!!!! Of course, lunch thing was given a an example... acctually I want this script to do a little bit more... I hope I will finish it myself, but, if not, now I know where I can get some quality help :)
Title:
Post by: ??????Hawk?????? on 30 October, 2004, 13:02:00
heya m8  ..


you might want to take a look at :-

Origional TimeBot (http://board.univ-angers.fr/thread.php?threadid=1503&boardid=12&sid=6aa40fabc83390d57f2992a69220f767)

And Maby My ascii clock:-

Ascii clock / How To (http://board.univ-angers.fr/thread.php?threadid=2630&boardid=4&sid=6aa40fabc83390d57f2992a69220f767)


My Xsthetic Netserver has Both Features Built in..

Read about it here (http://board.univ-angers.fr/thread.php?threadid=2711&boardid=12&sid=6aa40fabc83390d57f2992a69220f767)

Download from my Sig
Title:
Post by: enema on 30 October, 2004, 14:55:55
thanks, hawk! Now I know who to thank for this awesome clock... but none of your offered stuff really does what I want this one to do.. :)
Title:
Post by: ??????Hawk?????? on 30 October, 2004, 16:58:18
hi m8  ...  

i like the idea of a timed reminder..

gonna work on a couple of new commands for Xsthetic you might be interested in..

Multi Alarm Clock / Reminder..
!alarm
Title:
Post by: enema on 30 October, 2004, 17:06:12
whoa... timed alarm? I would gladly use something like that.. well thing that I wanted to create is automatic min share changer, that changes min share 2 times a day, here it goes --Automatic min share changer (min share is changed acording to time)
--Made by enema with BIG thanks to plop and WooshMan
--date - 30.10.2004
---------------------------------------------------------------------------------------------------------------------
-- This will help you get through
-- a and c is number of units you want to change for first and second time in day. You can change them as you like
-- b and d is for units (0 = b, 1 = kb, 2 = mb, 3 = gb)
---------------------------------------------------------------------------------------------------------------------
-- EDITABLE PART ----------------------------------------------------------------------------------------------------

a = "10" -- Number of units when min share should change first time
b = "2" -- unit
c = "15" -- Number of units when min share should change secon time
d = "3" -- unit

current = date("%H:%M")
iMin = 1000*60
tTime1 = {
--["timestring"] = "show this string"
["17:54"] = "Min share is set to "..a.." MB!"
} --- editable time 1, Update those units too!!

tTime2 = {
--["timestring"] = "show this string"
["17:53"] = "Min share is set to "..c.." GB!!"
} --- editable time 2, Update those units too!!

--END OF THE EDITABLE PART-------------------------------------------------------------------------------------------
function Main()
current = date("%H:%M")
frmHub:RegBot("---" ..current .."---")
SetTimer(iMin)
StartTimer()
end

function OnTimer()
frmHub:UnregBot("---" ..current .."---")
current = date("%H:%M")
if tTime1[current] then
frmHub:SetMinShare(a, b)
SendToAll( ("---" ..current .."---"), tTime1[current] )
elseif tTime2[current] then
frmHub:SetMinShare(c, d)
SendToAll( ("---" ..current .."---"), tTime2[current] )
end
frmHub:RegBot("---" ..current .."---")
end

function OnExit()
frmHub:UnregBot("---" ..current .."---")
end