forked from fuzzball-muck/fuzzball-muf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd-lsprop.muf
75 lines (66 loc) · 1.55 KB
/
cmd-lsprop.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
65
66
67
68
69
70
71
72
73
74
75
@prog cmd-lsprop
1 99999 d
1 i
( cmd-lsprop - display all props on an object, or in subdirectories on
an object, that match the given wildcard expression.
)
$include $lib/match
$include $lib/strings
lvar propcount
: showprop (d s -- )
over over getpropstr dup if
": (string) " swap strcat
else
pop over over getpropval dup if
": (integer) " swap intostr strcat
else
pop ": (no value)"
then
then
3 pick 3 pick propdir? if "/" else "" then
3 pick swap strcat swap strcat
me @ swap notify
propcount @ 1 + propcount !
;
: listprops (s d s -- ) (smatchstr objref startprop)
begin
begin
over swap nextprop
dup if
(if player isn't wizard, skip @props)
dup "/@" instr if
me @ "wizard" flag? not if continue then
then
then
1 until
dup while (exit if we're done with this propdir.)
(search contents of sub-propdirs for matches)
over over propdir? if
3 pick 3 pick 3 pick "/" strcat
listprops
then
(if prop doesn't match, ignore it)
over over propdir? if "/" else "" then
over swap strcat 4 pick smatch not if continue then
showprop
repeat
pop pop pop
;
: plist (s -- )
0 propcount !
"=" .split strip swap strip
.match_controlled dup not if pop exit then
swap "*" strcat
dup "/" 1 strncmp if "/" swap strcat then
swap "/" listprops
propcount @ intostr " properties listed." strcat
me @ swap notify
;
.
c
q
@set cmd-lsprop=w
#ifdef NEW
@action lsprop;lsp=#0=tmp/exit1
@link $tmp/exit1=cmd-lsprop
#endif