forked from fuzzball-muck/fuzzball-muf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd-@view.muf
60 lines (60 loc) · 1.61 KB
/
cmd-@view.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
@prog cmd-@view
1 99999 d
1 i
: show-docs ( d -- )
"_docs" getpropstr dup if
dup "Command to view: " swap strcat me @ swap notify
"Run this command? (y/n)" .confirm if
me @ swap force
else
me @ "Command cancelled." notify pop
then
else
me @ "No documents available for that program, sorry." notify
pop
then
;
: show-defs-iter ( d s -- d s' )
over over getpropstr
over " = " strcat swap strcat 6 strcut swap pop
me @ swap notify
over swap nextprop
;
: show-defs ( d -- )
dup "_defs/" nextprop dup if
"Read definitions? (y/n)" .confirm if
begin
show-defs-iter
dup not until
pop pop
else
pop pop
then
else
pop
then
;
: @view
dup not if
me @ "Usage: @view program (#dbref or $name)" notify pop exit
then
match
dup program? not if
pop me @ "That isn't a program!" notify exit
then
dup show-docs
show-defs
;
.
c
q
@register #me cmd-@view=tmp/prog1
@set $tmp/prog1=W
@set $tmp/prog1=/_/de:A scroll containing a spell called cmd-@view
@action @view=#0=tmp/exit1
@link $tmp/exit1=$tmp/prog1
@set $tmp/exit1=/_/de:@$desc %list[desc]
@set $tmp/exit1=/desc#:3
@set $tmp/exit1=/desc#/1:Usage: @view program
@set $tmp/exit1=/desc#/2:Either #dbref (i.e. #10) or $name (i.e. $lib/lmgr)
@set $tmp/exit1=/desc#/3:Purpose: if a _docs string exists on the program, will display it (should be a string like "@list $lib/string=1-10") and ask if it should run it. If so, then it will be as if you typed this command.