summaryrefslogtreecommitdiff
path: root/npc/commands
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2016-08-18 13:08:31 -0400
committergumi <mekolat@users.noreply.github.com>2016-09-01 12:09:03 -0400
commit3aaf8002319cdebd93f2292e6d18cb727c532550 (patch)
tree7261af4d9449fab78b82e8bec00af2f45981d820 /npc/commands
parent96036014cdb83abf6033af4570bac7e5ef9b6689 (diff)
downloadserverdata-3aaf8002319cdebd93f2292e6d18cb727c532550.tar.gz
serverdata-3aaf8002319cdebd93f2292e6d18cb727c532550.tar.bz2
serverdata-3aaf8002319cdebd93f2292e6d18cb727c532550.tar.xz
serverdata-3aaf8002319cdebd93f2292e6d18cb727c532550.zip
add FuzzyTime functions (human-readable time)
Diffstat (limited to 'npc/commands')
-rw-r--r--npc/commands/scheduled-broadcasts.txt21
1 files changed, 14 insertions, 7 deletions
diff --git a/npc/commands/scheduled-broadcasts.txt b/npc/commands/scheduled-broadcasts.txt
index e8c16d6e..b520f0b0 100644
--- a/npc/commands/scheduled-broadcasts.txt
+++ b/npc/commands/scheduled-broadcasts.txt
@@ -114,6 +114,7 @@ function script StoneBoard {
$@SCHED_Opt[1] = .@int;
$@SCHED_Opt[2] = 0;
$@SCHED_Opt[3] = .@max;
+ $@SCHED_Opt[4] = 0;
$@SCHED_Msg$ = .@msg$;
if (.@int)
{
@@ -146,8 +147,9 @@ function script StoneBoard {
mes l("Sent on login: @@", ($@SCHED_Opt[0] ? l("yes") : l("no")));
if ($@SCHED_Opt[1])
{
+ .@next = max(1, ((3600000 * ($@SCHED_Opt[1] - $@SCHED_Opt[4])) - getnpctimer(0)));
mes l("Interval: every @@ hour(s)", $@SCHED_Opt[1]);
- //mes l("Next broadcast: "); // FIXME: (needs a HumanTime function)
+ mes l("Next broadcast: @@", FuzzyTimeFromMs(.@next));
}
else
{
@@ -183,14 +185,19 @@ function script StoneBoard {
end;
OnTimer3600000:
- stopnpctimer;
- ++$@SCHED_Opt[2];
- if ($@SCHED_Msg$ != "")
+ ++$@SCHED_Opt[4];
+ if ($@SCHED_Opt[4] == ($@SCHED_Opt[1] - 1))
{
- announce $@SCHED_Msg$, bc_all;
- if ($@SCHED_Opt[2] < $@SCHED_Opt[3] && $@SCHED_Opt[3] > 0)
+ stopnpctimer;
+ ++$@SCHED_Opt[2];
+ if ($@SCHED_Msg$ != "")
{
- initnpctimer;
+ announce $@SCHED_Msg$, bc_all;
+ $@SCHED_Opt[4] = 0;
+ if ($@SCHED_Opt[2] < $@SCHED_Opt[3] && $@SCHED_Opt[3] > 0)
+ {
+ initnpctimer;
+ }
}
}
end;