PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: pHaTTy on 27 November, 2003, 20:12:20

Title: Maximum MiniMultiTimer
Post by: pHaTTy on 27 November, 2003, 20:12:20
Hi there,

whilst i was writing gekko i decided to show you how i use so many timers ;)

here we go, only a little version :)


--Maximum MiniMulti Timer by Phatty
--Can make as many as you want
--I am using it for Gekko with now 8 timers
--This clever little multitimer can be ajusted to do anything, just try ;)

TimeLogger = 0

function Main()
SetTimer(3*60000)
StartTimer()
end

function OnTimer()
TimeLogger = TimeLogger + 1
CheckTimerX()
SendToAll("Big huge test 1")
end

function CheckTimerX()
if TimeLogger == 2 then
TimeLogger = 0
SendToAll("The big test2")
end
end

l8rr

-phatty
Title:
Post by: kepp on 27 November, 2003, 22:24:00
Very nice... :)

Those 2 timers, will it show the 2 texts at the same time?
Title:
Post by: pHaTTy on 27 November, 2003, 23:09:11
yes but that can easily be changed ;)
Title:
Post by: kepp on 27 November, 2003, 23:25:20
How ?
Title:
Post by: pHaTTy on 28 November, 2003, 00:35:41
ok this one you will see the second msg every 2 of the first



--Maximum MiniMulti Timer by Phatty
--Can make as many as you want
--I am using it for Gekko with now 8 timers
--This clever little multitimer can be ajusted to do anything, just try ;)

TimeLogger = 0
TimerLogger = 0

function Main()
SetTimer(1*60000)
StartTimer()
end

function OnTimer()
if TimerLogger == 0 then
TimeLogger = TimeLogger + 1
TimerLogger = 1
SendToAll("Big huge test 1")
elseif TimerLogger == 2 then
CheckTimerX()
TimerLogger = 0
end
end

function CheckTimerX()
if TimeLogger == 3 then
TimeLogger = 0
SendToAll("The big test2")
end
end

Title:
Post by: [NL]trucker on 01 December, 2003, 10:03:30
Phatty

how will i add this to the timer it is a advert and a hubinfo.lua

here it is
part1:

Dear users welcome at :
   
               ???? FUNNYHUB [NL] ????

====================================================================
 If you need any help with dc or anything go here and check this out: http://wind.prohosting.com/svideos/extfaq/software.html#directconn
here you will find help over dc video,s and a whole lot of other stuff.
====================================================================

part 2:

-- Uptime by extracted from retrobot By Skrollster
-- Retrobot is made by Tezlo
-- Hiding of command from MainChat is added by JenZen?
-- fixed by phatty


BotName = "hubinfo"

sek = 1000
min = sek*60
hour = min*60
days = hour*24

time = 60*min

function Main()
   SetTimer(time)
   StartTimer()
end


function DataArrival(user, data)
   data=strsub(data,1,strlen(data)-1)
   _,_,cmd=strfind(data, "%b<>%s+(%S+)")
   if(cmd == "uptime") then
      local sec = clock()
      local days = floor(sec/86400)
      local hrs = floor((sec-(days*86400))/3600)
      local min = floor((sec-(days*86400)-(hrs*3600))/60)
      sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
      user:SendData("uptime", "*** "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec.")
      return 1
   end
end


function OnTimer()
   local sec = clock()
   local days = floor(sec/86400)
   local hrs = floor((sec-(days*86400))/3600)
   local min = floor((sec-(days*86400)-(hrs*3600))/60)
   sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
   SendToAll(BotName,"?=============="..frmHub:GetHubName().."=================| ?|")
   SendToAll(BotName,"::HubOwner:[NL]trucker")
   SendToAll(BotName,"::Hub Masters: TeQuilla-hollandse.ko ")
   SendToAll(BotName,"::Hub Address: funnyhub.no-ip.info")
   SendToAll(BotName,"::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !!")
   SendToAll(BotName,"::Dutch Located : Dus NLers Welkom !!")
   SendToAll(BotName,"::WebSite=www.magmar.tk")
   SendToAll(BotName,"::Hub-eMail:magmarnetworks@tiscali.nl")
   SendToAll(BotName,"::Max Users=125")
   SendToAll(BotName,"::Min Share=4GB")
        SendToAll(BotName,"::Uptime = "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec. = ?")    
   SendToAll(BotName,"?============="..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected==================")
end





part 3:


 Dear users welcome at :
   
               ???? FUNNYHUB [NL] ????

====================================================================
 If you need any help with dc or anything go here and check this out: http://wind.prohosting.com/svideos/extfaq/software.html#directconn
here you will find help over dc video,s and a whole lot of other stuff.
====================================================================

could you make this please ?

i,m a total noob as goes for programming such stuff

it would be nice if this goes on a 40-80-160 min timer :-)))

tia peter.
Title:
Post by: pHaTTy on 01 December, 2003, 10:05:01
okay here we go phew :))


--Maximum MiniMulti Timer by Phatty
-----------------------------------
--Can make as many as you want
--I am using it for Gekko with now 8 timers
--This clever little multitimer can be ajusted to do anything, just try ;)
--Adjusted for [NL]Trucker, for a (40 - 80 - 160)
--3x Timer
-----------------------------------


TimeLogger = 0
TimerLogger = 0

function Main()
SetTimer(40*60000)
StartTimer()
BotName = "MaximumTimer"
end

function OnTimer()
if TimerLogger == 0 then
TimeLogger = TimeLogger + 1
TimerLogger = 1
SendToAll(BotName,"Dear users welcome at :")    
SendToAll(BotName,"??? FUNNYHUB [NL] ???")
SendToAll(BotName,"====================================================================")
SendToAll(BotName,"If you need any help with dc or anything go here and check this out: [URL]http://wind.prohosting.com/svideos/extfaq/software.html#directconn[/URL]")
SendToAll(BotName,"here you will find help over dc video,s and a whole lot of other stuff.")
SendToAll(BotName,"====================================================================")
return 1
elseif TimerLogger == 2 then
CheckTimerX()
TimerLogger = 3
elseif TimerLogger == 3 then
TimerLogger = 0
SendToAll(BotName,"====================================================================")
SendToAll(BotName,"type in main:")
SendToAll(BotName,"?stats to see the top chatters in this hub.")
SendToAll(BotName,"+regme -To reg yourself so your nick is protected.")
SendToAll(BotName,"/fav to add this hub to your favorites.")
SendToAll(BotName,"+help to see all the commands availlable to you.")
SendToAll(BotName,"====================================================================")
return 1
end
end

function CheckTimerX()
if TimeLogger == 3 then
TimeLogger = 0
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
SendToAll(BotName,"?=============="..frmHub:GetHubName().."=================| ?|")
SendToAll(BotName,"::HubOwner:[NL]trucker")
SendToAll(BotName,"::Hub Masters: TeQuilla-hollandse.ko ")
SendToAll(BotName,"::Hub Address: funnyhub.no-ip.info")
SendToAll(BotName,"::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !!")
SendToAll(BotName,"::Dutch Located : Dus NLers Welkom !!")
SendToAll(BotName,"::WebSite=www.magmar.tk")
SendToAll(BotName,"::Hub-eMail:magmarnetworks@tiscali.nl")
SendToAll(BotName,"::Max Users=125")
SendToAll(BotName,"::Min Share=4GB")
        SendToAll(BotName,"::Uptime = "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec. = ?")
SendToAll(BotName,"?============="..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected==================")
return 1
end
end


function DataArrival(user, data)
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec.")
return 1
end
end


enjoy ;)

-maximum
Title:
Post by: [NL]trucker on 01 December, 2003, 10:16:53
thnx for the quick respons phatty


will give it a go .

will report any faults back here. hehhehehehehe
Title:
Post by: pHaTTy on 01 December, 2003, 10:40:47
heheh well np m8 and hope there aint any he he he


;)
Title:
Post by: pHaTTy on 02 December, 2003, 19:06:01
ooops sorry here


--Maximum MiniMulti Timer by Phatty
-----------------------------------
--Can make as many as you want
--I am using it for Gekko with now 8 timers
--This clever little multitimer can be ajusted to do anything, just try ;)
--Adjusted for [NL]Trucker, for a (40 - 80 - 120)
--3x Timer
--Ooops fixed ;)
-----------------------------------


TimeLogger = 0
TimerLogger = 0

function Main()
SetTimer(40*60000)
StartTimer()
BotName = "MaximumTimer"
end

function OnTimer()
if TimerLogger == 0 then
TimeLogger = TimeLogger + 1
TimerLogger = 1
SendToAll(BotName,"Dear users welcome at :")    
SendToAll(BotName,"??? FUNNYHUB [NL] ???")
SendToAll(BotName,"=============================================================")
SendToAll(BotName,"If you need any help with dc or anything go here and check this out: [URL]http://wind.prohosting.com/svideos/extfa...html#directconn[/URL]")
SendToAll(BotName,"here you will find help over dc video,s and a whole lot of other stuff.")
SendToAll(BotName,"=============================================================")
return 1
elseif TimerLogger == 1 then
TimerLogger = 2
return 1
elseif TimerLogger == 2 then
CheckTimerX()
TimerLogger = 3
elseif TimerLogger == 3 then
TimerLogger = 0
SendToAll(BotName,"============================================================")
SendToAll(BotName,"type in main:")
SendToAll(BotName,"?stats to see the top chatters in this hub.")
SendToAll(BotName,"+regme -To reg yourself so your nick is protected.")
SendToAll(BotName,"/fav to add this hub to your favorites.")
SendToAll(BotName,"+help to see all the commands availlable to you.")
SendToAll(BotName,"============================================================")
return 1
end
end

function CheckTimerX()
if TimeLogger == 3 then
TimeLogger = 0
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
SendToAll(BotName,"?=============="..frmHub:GetHubName().."=================| ?|")
SendToAll(BotName,"::HubOwner:[NL]trucker")
SendToAll(BotName,"::Hub Masters: TeQuilla-hollandse.ko ")
SendToAll(BotName,"::Hub Address: funnyhub.no-ip.info")
SendToAll(BotName,"::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !!")
SendToAll(BotName,"::Dutch Located : Dus NLers Welkom !!")
SendToAll(BotName,"::WebSite=www.magmar.tk")
SendToAll(BotName,"::Hub-eMail:magmarnetworks@tiscali.nl")
SendToAll(BotName,"::Max Users=125")
SendToAll(BotName,"::Min Share=4GB")
        SendToAll(BotName,"::Uptime = "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec. = ?")
SendToAll(BotName,"?============="..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected==================")
return 1
end
end


function DataArrival(user, data)
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec.")
return 1
end
end


hope this works correctly :)
Title:
Post by: [NL]trucker on 02 December, 2003, 21:52:19
lol phatty

you just beat me to it i was gonna post a bug cause i only saw the first piece of the messages:-))

hope this fixed it   thanks
Title:
Post by: pHaTTy on 02 December, 2003, 22:19:31
your welcome m8 and yep it shud  *i hope* lool
Title:
Post by: [NL]trucker on 04 December, 2003, 00:09:19
Phatty (:-


this timer is only showing the two messages but not the hubinfo.

i dont know what is wrong with it but could you  please try and fix it?
Title:
Post by: [NL]trucker on 04 December, 2003, 01:08:50
lols

after 11 hours it shows me for the first time the hubinfo


[00:32:34]  ?
[00:32:34] ::HubOwner:[NL]trucker
[00:32:34] ::Hub Masters: TeQuilla-hollandse.ko
[00:32:34] ::Hub Address: funnyhub.no-ip.info
[00:32:34] ::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !!
[00:32:34] ::Dutch Located : Dus NLers Welkom !!
[00:32:34] ::WebSite=www.magmar.tk
[00:32:34] ::Hub-eMail:magmarnetworks@tiscali.nl
[00:32:34] ::Max Users=125
[00:32:34] ::Min Share=4GB
[00:32:34] ::Uptime = 0 days, 11 hrs. 31 min. and 23 sec. = ?


but think it is a bit out of time now it was supposed to show after 80 min. :-))))
Title:
Post by: [NL]trucker on 09 December, 2003, 20:36:05
Phatty?

are you still looking into this?

i really like it but i sure want it to show all three messages. :-))
Title:
Post by: pHaTTy on 09 December, 2003, 21:14:50
lol oops sorry


--Maximum MiniMulti Timer by Phatty
-----------------------------------
--Can make as many as you want
--I am using it for Gekko with now 8 timers
--This clever little multitimer can be ajusted to do anything, just try ;)
--Adjusted for [NL]Trucker, for a (40 - 80 - 120)
--3x Timer
--Ooops fixed ;)
--Fixed time logging
-----------------------------------


TimeLogger = 0
TimerLogger = 0

function Main()
SetTimer(40*60000)
StartTimer()
BotName = "MaximumTimer"
end

function OnTimer()
if TimerLogger == 0 then
TimeLogger = TimeLogger + 1
TimerLogger = 1
SendToAll(BotName,"Dear users welcome at :")    
SendToAll(BotName,"??? FUNNYHUB [NL] ???")
SendToAll(BotName,"=============================================================")
SendToAll(BotName,"If you need any help with dc or anything go here and check this out: [URL]http://wind.prohosting.com/svideos/extfa...html#directconn[/URL]")
SendToAll(BotName,"here you will find help over dc video,s and a whole lot of other stuff.")
SendToAll(BotName,"=============================================================")
return 1
elseif TimerLogger == 1 then
TimerLogger = 2
TimeLogger = TimeLogger + 1
return 1
elseif TimerLogger == 2 then
CheckTimerX()
TimerLogger = 3
elseif TimerLogger == 3 then
TimerLogger = 0
TimeLogger = 0
SendToAll(BotName,"============================================================")
SendToAll(BotName,"type in main:")
SendToAll(BotName,"?stats to see the top chatters in this hub.")
SendToAll(BotName,"+regme -To reg yourself so your nick is protected.")
SendToAll(BotName,"/fav to add this hub to your favorites.")
SendToAll(BotName,"+help to see all the commands availlable to you.")
SendToAll(BotName,"============================================================")
return 1
end
end

function CheckTimerX()
if TimeLogger == 2 then
TimeLogger = 0
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
SendToAll(BotName,"?=============="..frmHub:GetHubName().."=================| ?|")
SendToAll(BotName,"::HubOwner:[NL]trucker")
SendToAll(BotName,"::Hub Masters: TeQuilla-hollandse.ko ")
SendToAll(BotName,"::Hub Address: funnyhub.no-ip.info")
SendToAll(BotName,"::HubNetwork: = ?????? Magmar ?????? Network Dutch Division !!")
SendToAll(BotName,"::Dutch Located : Dus NLers Welkom !!")
SendToAll(BotName,"::WebSite=www.magmar.tk")
SendToAll(BotName,"::Hub-eMail:magmarnetworks@tiscali.nl")
SendToAll(BotName,"::Max Users=125")
SendToAll(BotName,"::Min Share=4GB")
        SendToAll(BotName,"::Uptime = "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec. = ?")
SendToAll(BotName,"?============="..frmHub:GetUsersCount().." of  "..frmHub:GetMaxUsers().." Users Connected==================")
return 1
end
end


function DataArrival(user, data)
data=strsub(data,1,strlen(data)-1)
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hrs. "..min.." min. and "..sec.." sec.")
return 1
end
end


l8rr,,

-phatty ;)
Title:
Post by: [NL]trucker on 09 December, 2003, 21:21:03
thanks phatty gonna try it .
Title:
Post by: kepp on 15 February, 2004, 17:11:46
Been looking a little bit on the code, and seems to work just great.

though, wouln't it be easier to let's say we want a timer on 40 - 80 - 120

to set only one Option ?

Why use two values and copmlicate it? or is it something i've missed or didn't thinkl about? :S

TimeLogger = 0
TimerLogger = 0


MultiTime = 0

function Main()
   SetTimer(40*60000)
   StartTimer()
end

function OnTimer()
   if MultiTime == 0 then
      SendToAll("Timer 1")
      MultiTime = MultiTime + 1

   elseif MultiTime == 1 then
      SendToAll("Timer 2")
      MultiTime = MultiTime + 1

   elseif MultiTime == 2 then
      SendToAll("Timer 3")
      MultiTime = 0
   end
end
Title:
Post by: pHaTTy on 15 February, 2004, 18:17:46
hmm wel yeah but i like beoing complicated lol, and it also depends on how u use the functions, calling methods etc, so i prefere, like gekko used to have about 8 timers at the time, and i didnt want to have loads of text in the timer, so i split it up, it done some weird things, so i added some extra checks like so and it worked fine ;)