-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcmd-edit.muf
132 lines (127 loc) · 3.96 KB
/
cmd-edit.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
@program cmd-edit
1 99999 d
1 i
( cmd-edit
( This is a program that will let you replace errors in a message )
( or property so that you can fix up typo's without having to )
( retype the entire thing. )
( )
( Usage: edit <object>=<prop> or )
( edit <object>=@<mesg> )
( )
( CHANGES: Added a 'checkperms' routine to prevent non-wiz users )
( from changing @wizard or ~restricted props -- Jessy 7/00 )
( )
$author Tygryss
$doccmd @list __PROG__=!@1-12
$version 1.02
: checkperms ( s -- )
dup "@" stringpfx
over "/@" instr
3 pick "~" stringpfx
4 rotate "/~" instr or or or
me @ "W" flag? not and if
"Permission denied." tell pid kill
then
;
: replace-text ( str -- str )
"Please enter the text it should be changed to." tell
"##edit> " swap strcat tell read
;
: error
"Name: Edit v1.02 Written by Tygryss Last updated 3/31/92" tell
"Desc: Lets you use the tinyfugue /grab feature to edit a message" tell
" or property. Requires tinyfugue 1.5.0 or later with this" tell
" trigger defined: /def -fg -p100 -t\"##edit> *\" = /grab %-1" tell
" " tell
"Syntax: edit <object>=<propname> or" tell
" edit <object>=@<mesgtype>" tell
" " tell
"<mesgtype> can be name/desc/succ/osucc/fail/ofail/drop/odrop" tell
;
: change-main
"me" match me !
"=" split strip
dup not if error exit then
swap strip
dup not if error exit then
swap dup "@" 1 strncmp if ( property? )
swap match
dup #-1 dbcmp if
"I don't see that here."
tell exit
then
dup #-2 dbcmp if
"I don't know which one you mean!"
tell exit
then
dup #-3 dbcmp if
"I don't know what you mean!"
tell exit
then
dup owner me @ dbcmp not
me @ "w" flag? not and if
"Permission denied."
tell exit
then
swap over over
dup checkperms
getpropstr
replace-text
dup not if
pop remove_prop
else
0 addprop
then
"Property changed." tell
else ( ; for message? )
1 strcut swap pop
swap match
dup #-1 dbcmp if
"I don't see that here."
tell exit
then
dup #-2 dbcmp if
"I don't know which one you mean!"
tell exit
then
dup #-3 dbcmp if
"I don't know what you mean!"
tell exit
then
dup owner me @ dbcmp not
me @ "w" flag? not and if
"Permission denied."
tell exit
then
swap dup "name" stringcmp not if
over player? if "Cannot change a player's name." tell pop exit then
pop dup name replace-text setname
else dup "desc" stringcmp not if
pop dup desc replace-text setdesc
else dup "succ" stringcmp not if
pop dup succ replace-text setsucc
else dup "osucc" stringcmp not if
pop dup osucc replace-text setosucc
else dup "fail" stringcmp not if
pop dup fail replace-text setfail
else dup "ofail" stringcmp not if
pop dup ofail replace-text setofail
else dup "drop" stringcmp not if
pop dup drop replace-text setdrop
else dup "odrop" stringcmp not if
pop dup odrop replace-text setodrop
else pop error
then then then then then then then then
"Message changed." tell
then
;
.
c
q
@register #me cmd-edit=tmp/prog1
@set $tmp/prog1=3
@set $tmp/prog1=W
@action edit=#0=tmp/exit1
@link $tmp/exit1=$tmp/prog1
@register #me =tmp