-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyaro-contime.muf
66 lines (57 loc) · 1.37 KB
/
yaro-contime.muf
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
64
@program yaro-contime.muf
1 9999 del
i
$include $lib/yaro
: get_oldest ( d -- i )
var longest
descriptors array_make foreach nip
descrcon contime dup longest @ > if longest ! else pop then
repeat
longest @
;
: format_name ( i s -- s )
var tvalue
var tunit
tunit !
tvalue !
tvalue @ if
tvalue @ intostr " " strcat tunit @ strcat
tvalue @ 1 > if
"s" strcat
then
", " strcat
else
""
then
;
: pretty_time ( i -- s )
time_explode 6 reverse
"moon" format_name -6 rotate
"week" format_name -6 rotate
"day" format_name -6 rotate
"hour" format_name -6 rotate
"minute" format_name -6 rotate
"second" format_name -6 rotate
6 reverse strcat strcat strcat strcat strcat
", " rsplit pop
;
: main
dup if
pmatch dup ok? if
dup get_oldest dup if
pretty_time swap name "^INFO_COLOR^" swap strcat
" has been online for " strcat swap strcat "." strcat tell
else
pop "^INFO_COLOR^" swap name strcat " is not currently connected." strcat tell
then
else
"^ERROR_COLOR^I do not know that player." tell
then
else
pop me @ get_oldest pretty_time
"^INFO_COLOR^You have been online for " swap strcat "." strcat tell
then
;
.
c
q