PtokaX forum

Development Section => Your Developing Problems => Topic started by: kepp on 06 January, 2004, 22:18:26

Title: Check if something is equal to every sec ?
Post by: kepp on 06 January, 2004, 22:18:26
i use a timer, and its interval is 1 second, Each second it's cheking

if something == something2 then
...
end

But how much will that take on my computer or my hub to check something like that out every second!??
Title:
Post by: NightLitch on 06 January, 2004, 22:28:18
depending what you gonna check or trigger...
Title:
Post by: kepp on 06 January, 2004, 22:36:52
Allright..

hmm :S      Just an example

time2 = "14:13:30"

function Main()
   StartTimer(1000)
   SetTimer()
end

function OnTimer()
time = date("%H:%M:%S")
   if time == time2 then
...
end
Title:
Post by: NightLitch on 06 January, 2004, 22:55:26
looks like it should work but what you gonna trigger...

That will only go around...

Put a text message there and it will just loop ex:

SendToAll("Display text")

Dispay text will just reapting it self in main-chat...

all depends on the function you gonna trigger I think...

it can not do a too huge function the it gonna crash...

it will take resources...

put up the hole function and show us...

*EDIT*

missed a part... that will only trigger on that time/date

so you could set instead of sec in minutes
Title:
Post by: kepp on 06 January, 2004, 22:58:44
Well, yet i don't know what task it's gonna do, that's why im asking if it would take much recorces,

hm... it will loop yea... but in that example i can end it with StopTimer()

But thanks, Depends on how huge and how much the task is with other words?
Title:
Post by: NightLitch on 06 January, 2004, 23:00:18
this will be shown every day at given time:

time2 = "14:13:30"

function Main()
   StartTimer(60000)  -- 1 Min right ???
   SetTimer()
end

function OnTimer()
local time = date("%H:%M:%S")
   if time == time2 then
     SendToAll("Given time reached...")
   end
end
Title:
Post by: NightLitch on 06 January, 2004, 23:01:48
the more data to passm the more memory demanding...

Stop me if am Wrong so I know... anybody that is... Chilla, Tezlo etc.
Title:
Post by: kepp on 06 January, 2004, 23:04:13
yea... but like i said, that was just an example..

Would be perfect to perform tasks while you're gone ;)
Title:
Post by: NightLitch on 06 January, 2004, 23:07:37
Quotetasks while you're gone

humm.. how should take this... hehe

When Am gone... hmm ;-)