Author Topic: "Upgrading" time script  (Read 2250 times)

0 Members and 1 Guest are viewing this topic.

Offline enema

  • Lord
  • ***
  • Posts: 276
  • Karma: +1/-0
"Upgrading" time script
« on: 29 October, 2004, 09:50:19 »
Hi!!

I wanted to add somekind of functions to this time bot
 
Code: [Select]
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 -
Code: [Select]
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?
8)  mitava.no-ip.org   8)

PtokaX forum

"Upgrading" time script
« on: 29 October, 2004, 09:50:19 »

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #1 on: 30 October, 2004, 00:33:08 »
give this a try.
Code: [Select]
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
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Offline BoJlk

  • Lord
  • ***
  • Posts: 335
  • Karma: +2/-0
(No subject)
« Reply #2 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

Offline enema

  • Lord
  • ***
  • Posts: 276
  • Karma: +1/-0
(No subject)
« Reply #3 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 :)
8)  mitava.no-ip.org   8)

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #4 on: 30 October, 2004, 13:02:00 »
heya m8  ..


you might want to take a look at :-

Origional TimeBot

And Maby My ascii clock:-

Ascii clock / How To


My Xsthetic Netserver has Both Features Built in..

Read about it here

Download from my Sig

Offline enema

  • Lord
  • ***
  • Posts: 276
  • Karma: +1/-0
(No subject)
« Reply #5 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.. :)
8)  mitava.no-ip.org   8)

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #6 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

Offline enema

  • Lord
  • ***
  • Posts: 276
  • Karma: +1/-0
(No subject)
« Reply #7 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
Code: [Select]
--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
8)  mitava.no-ip.org   8)

PtokaX forum

(No subject)
« Reply #7 on: 30 October, 2004, 17:06:12 »