- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleDiff note for paste #23904
TypeDiff
Date2015/12/17 22:21:46 UTC-08:00
ByGuest
Other
Paste
 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_]]> { 
+            - 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% 
+                }
             }
-        }
-        - 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.fl
ag[login_time]>].formatted>)."
                 - flag player login_time:!
             }
 
 



RawRaw



Pastes made: 76945