"Upgrading" time script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

"Upgrading" time script

Started by enema, 29 October, 2004, 09:50:19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

enema

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?

plop

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
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 <----<<

BoJlk

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

enema

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 :)

??????Hawk??????

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

enema

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.. :)

??????Hawk??????

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

enema

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

SMF spam blocked by CleanTalk