01-16-2014, 02:01 AM
Countdown
|
01-16-2014, 02:06 AM
Not sure if this is the best method (or if it works) but:
function CountDown(Param) cRoot:Get():BroadcastChat(Param[1]) end) for I=1, 10 do -- Countdown. AddSchedule(CountDown, {I}, I * 20)) -- 20 ticks is one second right? then 1 * 20 is 20 ticks is one second etc. end
01-16-2014, 02:26 AM
(This post was last modified: 01-16-2014, 02:27 AM by daniel0916.)
it works but it is not
9 8 7 it is: 1 2 3 And it comes this error: Code: [17:25:11] Stack trace: The line is: if ScheduleTable[I][3] < 0 then (01-16-2014, 02:26 AM)daniel0916 Wrote: it works but it is notThen change for I=1, 10 do -- Countdown. AddSchedule(CountDown, {I}, I * 20)) -- 20 ticks is one second right? then 1 * 20 is 20 ticks is one second etc. endto local COUNT_TO = 10 for I=COUNT_TO, 1, -1 do -- Countdown AddSchedule(CountDown, {I}, (COUNT_TO - I) * 20)) end Quote:And it comes this error: When do you get the error? When it has finished counting down?
01-16-2014, 02:35 AM
01-16-2014, 02:38 AM
And you do still get the countdown message(9, 8, 7 etc)? Do you have anything else in the function that gets called?
01-16-2014, 02:43 AM
Could you post all your code somewhere? or send it to me using an PM. Ofcourse if you don't want to just don't do it, but I don't think I can see what's going on without seeing the code around everything.
EDIT: Wait!! I've might found the problem. I'll have to rewrite the ScheduleTicking though. Just a sec.
01-16-2014, 02:51 AM
(This post was last modified: 01-16-2014, 02:52 AM by daniel0916.)
(01-16-2014, 02:45 AM)STR_Warrior Wrote: Could you post all your code somewhere? or send it to me using an PM. Ofcourse if you don't want to just don't do it, but I don't think I can see what's going on without seeing the code around everything. (Do you know a git page where i can upload my code private? It should be safe.) Okey, thanks.
Use this code for the OnScheduleTick function:
function OnScheduleTick(Time) for Idx, ScheduleTask in pairs(ScheduleTable) do ScheduleTable[Idx][3] = ScheduleTable[Idx][3] - 1 -- Countdown if ScheduleTask[3] < 1 then ScheduleTask[1](ScheduleTask[2]) ScheduleTable[Idx] = nil end end end If you want to post it on github privately you have to pay for it. Thanks given by: daniel0916
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 4 Guest(s)