forked from fuzzball-muck/fuzzball-muf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd-lookat.muf
139 lines (119 loc) · 3.43 KB
/
cmd-lookat.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/sub off
@prog cmd-lookat
1 9999 d
1 i
( cmd-lookat Copyright 9/11/91 by Garth Minette )
( foxen@netcom.com )
$def VERSION "MUFlookat v1.30 by Foxen"
$def UPDATED "Updated 2/7/94"
(version 1.00 9/11/91 Foxen)
(version 1.20 6/05/93 Foxen)
(version 1.30 2/07/94 Foxen)
$include $lib/props
: tell (string -- )
me @ swap notify
;
: split
swap over over swap
instr dup not if
pop swap pop ""
else
1 - strcut rot
strlen strcut
swap pop
then
;
$def strip-leadspaces striplead
$def strip-trailspaces striptail
$def stripspaces striplead striptail
: single-space (s -- s') (strips all multiple spaces down to a single space)
dup " " instr not if exit then
" " " " subst single-space
;
( help stuff )
: show-help-list
dup not if pop exit then
dup 1 + rotate me @ swap notify
1 - show-help-list
;
: show-help
VERSION " " strcat UPDATED strcat " Page1" strcat
"----------------------------------------------------------------------------"
"Syntax: lookat <player>'s <object>"
" or: lookat <player> <object>"
" Lets you look at an object that a player is carrying, and see its @desc."
" "
"You can set these properties on objects:"
" _remote_desc:<desc> Shown instead of the objects @desc. If this (or"
" the @desc if this doesn't exist) uses a program"
" like @6800, it will handle it properly."
" _remote_look?:yes Allows lookat'ing for that object. On a player,"
" allows looking at anything they carry unless the"
" object is set _remote_look?:no"
"----------------------------------------------------------------------------"
14 show-help-list
;
: main
dup "#help" stringcmp not if pop show-help exit then
dup " " instr not if
"Syntax: lookat <player>'s <object>"
tell pop exit
then
" " split stripspaces swap stripspaces
dup strlen 2 > if
dup dup strlen 2 - strcut
dup "'s" stringcmp not if
pop match
dup ok? not if
pop dup match
then
else strcat match
then
else dup match
then
dup not if
pop "I don't see \"" swap strcat
"\" here." strcat tell pop exit
then
dup #-2 dbcmp if
"I don't know which player you mean."
tell pop pop pop exit
then
swap pop swap rmatch
dup not if
"I don't see them carrying that."
tell pop exit
then
dup #-2 dbcmp if
"I don't know which object you mean."
tell pop exit
then
dup "_remote_look?" .envprop "no" stringcmp not
over "dark" flag? or if
"You can't see that clearly."
tell pop exit
then
dup "_remote_desc" "(_remote_desc)" 1 parseprop
dup not if pop dup "_/de" "(@Desc)" 1 parseprop then
dup not if pop "You see nothing special." then
dup "@" 1 strncmp not if
1 strcut swap pop
" " split over number?
3 pick "$" 1 strncmp not or if
swap dup "$" 1 strncmp not
if match else atoi dbref then
dup program? if
rot trigger ! call
else pop tell pop
then
else
" " swap strcat strcat
"@" swap strcat tell pop
then
else tell pop
then
;
.
c
q
/sub on