-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTursi_Contimes_1.muf
62 lines (56 loc) · 1.82 KB
/
Tursi_Contimes_1.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
( Con-Connect.MUF. Part 1/3 of Tursi's Contimes clone )
( This code belongs on the _connect prop on room #0 )
( On connect, we want to log the current time as a prop, and 'x' )
( as the value. On disconnect, we will fill in the 'x' with minutes )
( connected. Here we will also clean out ancient and incomplete )
( props [perhaps due to crashes] )
( v1.1 - 10 June 01 - updated to not delete preferences )
( v1.2 - 15 Mar 02 - Only update when we're the only connection )
: main (s -- )
( Make sure this isn't a duplicate connection )
me @ descriptors
1 = not if
begin depth while pop repeat
exit
then
pop
( For simplicity in testing, we can be called in any way )
( First scan all the props that already exist. Delete all props )
( which are either more than 9 weeks old, or which contain 'x' )
( as their data, which means they were never filled in for some )
( reason. )
me @ "/@Contimes/" nextprop (propname)
begin dup "" strcmp while ( propname )
dup me @ swap getpropstr ( propname value )
"x" stringcmp not if ( propname )
dup me @ swap nextprop ( propname nextprop )
swap me @ swap remove_prop ( nextprop )
continue
else
dup "/" explode ( propname s1 s2... n )
begin dup 1 > while
swap pop 1 - ( propname s1 s2... n )
repeat
pop ( propname timestr )
atoi ( propname time )
dup 0 = not if
systime ( propname time systime )
swap - ( propname diff )
6048000 > if ( propname ) ( 6048000 = 10 weeks in seconds )
dup me @ swap nextprop ( propname nextprop )
swap me @ swap remove_prop ( nextprop )
continue
then
else
pop
then
then
me @ swap nextprop ( nextprop )
repeat
( Now we add the current information )
pop ( )
me @ ( #player )
systime intostr "/@Contimes/" swap strcat
"x" 0 ( #player prop 'x' 0 )
addprop ( )
;