Date: 2015/12/17 22:12:04 UTC-08:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
ActivityLogResetTask:
type: task
script:
- define date <util.date.time.duration.sub[d@<util.date.time.hour>h].sub[d@<util.date.time.minute>m].sub[d@<util.date.time.second>s]>
- if <yaml.list.contains[my_log_%date%].not> {
- foreach <yaml.list.filter[starts_with{my_log_]]> {
- yaml savefile:/Logs/<def[value].after[my_log_].as_duration.time.replace[<&sp>].with[_]>.yml id:%value%
- yaml unload id:%value%
}
- if <server.has_file[/Logs/<def[date].time.replace[<&sp>].with[_]>.yml]>
- yaml load:/Logs/<def[date].time.replace[<&sp>].with[_]>.yml id:my_log_%date%
} else {
- yaml create id:my_log_%date%
}
ActivityLogManualSave:
type: task
script:
- define date <util.date.time.duration.sub[d@<util.date.time.hour>h].sub[d@<util.date.time.minute>m].sub[d@<util.date.time.second>s]>
- if <yaml.contains[my_log_%date%]> {
- yaml savefile:/Logs/<def[value].after[my_log_].as_duration.time.replace[<&sp>].with[_]>.yml id:%value%
}
ActivityLogSaveCommand:
type: command
name: savelog
script:
- run ActivityLogManualSave instantly
- narrate "Saved log."
- determine fulfilled
ActivityLogReset:
type: world
events:
on server start:
- wait 1t
- run ActivityLogResetTask instantly
on system time hourly:
- run ActivityLogResetTask instantly
on system time minutely:
- if <context.minute.mod[10]> != 0 queue clear
- foreach <yaml.list.filter[starts_with{my_log_]]> {
- yaml savefile:/Logs/<def[value].after[my_log_].as_duration.time.replace[<&sp>].with[_]>.yml id:%value%
}
ActivityLogger:
type: world
events:
on player joins:
- define date <util.date.time.duration.sub[d@<util.date.time.hour>h].sub[d@<util.date.time.minute>m].sub[d@util.date.time.second>s]>
- if <yaml.list.contains[my_log_%date%]> {
- yaml id:my_log_%date% set "<util.date.time.hour><&co><util.date.time.minute><&dot><util.date.time.second>: <player.name> joined."
- flag player login_time:<util.date.time.duration>
}
on player quits:
- define date <util.date.time.duration.sub[d@<util.date.time.hour>h].sub[d@<util.date.time.minute>m].sub[d@util.date.time.second>s]>
- if <yaml.list.contains[my_log_%date%]> {
- yaml id:my_log_%date% set "<util.date.time.hour><&co><util.date.time.minute><&dot><util.date.time.second>: <player.name> quit (<util.date.time.duration.sub[<player.flag[login_time]>].formatted>)."
- flag player login_time:!
}