Generic Editor #50

Parent #3Owner #36Flags read, fertileSource QuestCore.db

Aliases: Generic Editor, gedit, edit

69 verbs · 38 properties · 3 children

Verbs

VerbSpecFlagsDefinerLines
sayany any anyrxd#508
emoteany any anyrxd#508
enterany none nonerd#5010
lis*t viewany any anyrd#5058
ins*ert n*ext p*revious .any none nonerd#5039
del*eteany any anyrd#5016
f*indany any anyrxd#5024
s*ubstany any anyrxd#5046
m*ove c*opyany any anyrd#5055
join*literalany any anyrd#5011
fillany any anyrd#5024
pub*lish perish unpub*lish depub*lishnone none nonerd#5011
w*hatnone none nonerxd#5010
abortnone none nonerd#509
done q*uit pausenone none nonerxd#5019
huh2this none thisrxd#5021
insertionthis none thisrxd#501
set_insertionthis none thisrxd#501
changed retain_session_on_exitthis none thisrxd#501
set_changedthis none thisrxd#501
originthis none thisrxd#501
set_originthis none thisrxd#501
readablethis none thisrxd#501
set_readablethis none thisrxd#501
textthis none thisrxd#502
loadthis none thisrxd#5013
working_onthis none thisrxd#502
okthis none thisrxd#508
loadedthis none thisrxd#501
list_linethis none thisrxd#506
insert_linethis none thisrxd#5035
append_linethis none thisrxd#5024
join_linesthis none thisrxd#5029
parse_numberthis none thisrxd#5025
parse_rangethis none thisrxd#5061
parse_insertthis none thisrxd#5030
parse_substthis none thisrxd#5015
invokethis none thisrxd#5044
suck_inthis none thisrxd#5021
new_sessionthis none thisrxd#5024
kill_sessionthis none thisrxd#509
reset_sessionthis none thisrxd#5010
kill_all_sessionsthis none thisrxd#5013
acceptablethis none thisrxd#501
enterfuncthis none thisrxd#5013
exitfuncthis none thisrxd#509
@flushthis any anyrxd#5033
@statepropany for/about thisrd#5024
@rmstatepropany out of/from inside/from thisrd#507
initializethis none thisrxd#504
init_for_corethis none thisrxd#5010
set_statepropsthis none thisrxd#5025
descriptionthis none thisrxd#5038
commands_infothis none thisrxd#508
match_objectthis none thisrxd#508
who_location_msgthis none thisrxd#504
nothing_loaded_msg no_text_msg change_msg no_change_msg no_littering_msg depart_msg return_msg previous_session_msgthis none thisrxd#501
announce announce_all announce_all_but tell_contentsthis none thisrxd#501
fill_string(noansi)this none thisrxd#5048
here_huhthis none thisrxd#5022
matchthis none thisrxd#501
get_roomthis none thisrxd#5013
invoke_local_editorthis none thisrxd#5017
_stateprop_lengththis none thisrxd#506
printnone none nonerd#507
acceptthis none thisrxd#501
y*ankany any anyrd#5082
do_flushthis none thisrxd#5014
fill_stringthis none thisrx#505

Properties

PropertyDefinerFlagsOwnerValue
readable#50r#36{}
times#50r#36{}
commands2#50rc#36
list of 2{{"say", "emote", "lis*t", "ins*ert", "n*ext,p*rev", "del*ete", "f*ind", "s*ubst", "m*ove,c*opy", "join*l", "fill"}, {"y*ank", "w*hat", "abort", "q*uit,done,pause"}}
help#50rc#36#44
no_text_msg#50rc#36"There are no lines of text."
commands#50rc#36
list of 16{{"say", "<text>"}, {"emote", "<text>"}, {"lis*t", "[<range>] [nonum]"}, {"ins*ert", "[<ins>] [\"<text>]"}, {"n*ext,p*rev", "[n] [\"<text>]"}, {"del*ete", "[<range>]"}, {"f*ind", "/<str>[/[c][<range>]]"}, {"s*ubst", "/<str1>/<str2>[/[g][c][<range>]]"}, {"m*ove,c*opy", "[<range>] to <ins>"}, {"join*l", "[<range>]"}, {"fill", "[<range>] [@<col>]"}, {"w*hat", ""}, {"abort", ""}, {"q*uit,done,pause", ""}, {"enter", ""}, {"y*ank", "from <text-source>"}}
invoke_task#50r#360
exit_on_abort#50rc#360
previous_session_msg#50rc#36""
stateprops#50r#36{{"texts", 0}, {"changes", 0}, {"inserting", 1}, {"readable", 0}}
depart_msg#50rc#36"%N heads off to the Generic Editing Room."
return_msg#50rc#36"%N comes back from the Generic Editing Room."
no_littering_msg#50rc#36"Keeping your [whatever] for later work. Since this the Generic Editor, you have to do your own :set_changed(0) so that we'll know to get rid of whatever it you're working on when you leave. Please don't litter... especially in the Generic Editor."
no_change_msg#50rc#36"There have been no changes since the last save."
change_msg#50rc#36"Text has been altered since the last save."
nothing_loaded_msg#50rc#36"You're not currently editing anything."
texts#50#36{}
active#50r#36{}
changes#50#36{}
inserting#50#36{}
original#50r#36{}
who_location_msg#3rc#36"%L [editing]"
free_home#3rc#36<clear>
victim_ejection_msg#3rc#36<clear>
ejection_msg#3rc#36<clear>
oejection_msg#3rc#36<clear>
residents#3rc#36<clear>
free_entry#3rc#361
entrances#3c#36{}
blessed_object#3rc#36#-1
blessed_task#3rc#361397392137
exits#3c#36<clear>
dark#3rc#36<clear>
ctype#3rc#36<clear>
key#1c#36<clear>
aliases#1rc#36{"Generic Editor", "gedit", "edit"}
description#1rc#36{}
object_size#1r#36{56919, -1090650497}

Ancestry

Ancestors (nearest first): #3 generic room#1 Root Class

Children: #47 Mail Room, #48 Note Editor, #49 Verb Editor

Call graph

calls n50_0 #50:say n50_28 #50:loaded n50_0->n50_28 n6_18 #6:tell n50_0->n6_18 n50_56 #50:nothing_loaded_msg n50_0->n50_56 n50_30 #50:insert_line n50_0->n50_30 n50_27 #50:ok n50_30->n50_27 n50_1 #50:emote n50_1->n50_28 n50_1->n6_18 n50_1->n50_56 n50_31 #50:append_line n50_1->n50_31 n50_31->n50_30 n50_31->n50_27 n50_2 #50:enter n50_2->n50_28 n50_2->n6_18 n50_2->n50_56 n50_2->n50_30 n56_3 #56:read_lines n50_2->n56_3 n6_10 #6:notify n50_2->n6_10 n50_3 #50:lis*t n50_3->n50_28 n50_3->n6_18 n50_3->n50_56 n20_7 #20:names_of n50_3->n20_7 n56_1 #56:player_match_result n50_3->n56_1 n20_20 #20:match_player n50_3->n20_20 n50_22 #50:readable n50_3->n50_22 n50_34 #50:parse_range n50_3->n50_34 n20_9 #20:trim n50_3->n20_9 n6_79 #6:tell_lines n50_3->n6_79 n50_29 #50:list_line n50_3->n50_29 n56_7 #56:running_out_of_time n50_3->n56_7 n50_34->n50_56 n50_34->n50_34 n20_5 #20:from_list n50_34->n20_5 n50_34->n50_27 n50_29->n6_18 n50_29->n50_27 n50_4 #50:ins*ert n50_4->n50_28 n50_4->n6_18 n50_4->n50_56 n50_4->n50_30 n50_4->n20_9 n50_4->n50_29 n50_35 #50:parse_insert n50_4->n50_35 n50_35->n50_27 n50_5 #50:del*ete n50_5->n50_28 n50_5->n6_18 n50_5->n50_56 n50_5->n50_34 n50_5->n6_79 n50_6 #50:f*ind n50_6->n50_28 n50_6->n6_18 n50_6->n50_56 n50_6->n50_29 n50_6->n50_35 n50_36 #50:parse_subst n50_6->n50_36 n50_7 #50:s*ubst n50_7->n50_28 n50_7->n6_18 n50_7->n50_56 n50_7->n50_34 n50_7->n50_29 n50_7->n50_36 n20_38 #20:explode n50_7->n20_38 n50_8 #50:m*ove n50_8->n50_28 n50_8->n6_18 n50_8->n50_56 n50_8->n50_34 n50_8->n50_35 n50_8->n20_5 n50_9 #50:join*literal n50_9->n50_28 n50_9->n6_18 n50_9->n50_56 n50_9->n50_34 n50_9->n50_29 n50_32 #50:join_lines n50_9->n50_32 n50_32->n50_27 n50_10 #50:fill n50_10->n50_28 n50_10->n6_18 n50_10->n50_56 n50_10->n50_34 n50_10->n50_29 n50_10->n50_32 n50_68 #50:fill_string n50_10->n50_68 n50_11 #50:pub*lish n50_11->n50_28 n50_11->n6_18 n50_11->n50_56 n50_23 #50:set_readable n50_11->n50_23 n50_23->n50_27 n50_12 #50:w*hat n50_12->n6_18 n50_12->n50_56 n50_12->n50_27 n50_26 #50:working_on n50_12->n50_26 n50_26->n50_27 n50_13 #50:abort n50_13->n6_18 n50_13->n50_26 n50_41 #50:reset_session n50_13->n50_41 n50_14 #50:done n50_13->n50_14 n50_41->n50_27 n50_14->n6_18 n50_14->n50_56 n6_73 #6:moveto n50_14->n6_73 n20_34 #20:pronoun_sub n50_14->n20_34 n50_15 #50:huh2 n59_39 #59:argstr n50_15->n59_39 n50_16 #50:insertion n50_16->n50_27 n50_17 #50:set_insertion n50_17->n50_27 n50_18 #50:changed n50_18->n50_27

Showing 48 of 110 verbs; 62 not shown.

Source

say

Spec any any anyFlags rxdOwner #36Definer #50

Referenced by

none

Source

1if ((caller != player) && (caller_perms() != player))
2return E_PERM;
3endif
4if (!(who = this:loaded(player)))
5player:tell(this:nothing_loaded_msg());
6else
7this:insert_line(who, argstr);
8endif

emote

Spec any any anyFlags rxdOwner #36Definer #50

Referenced by

none

Source

1if ((caller != player) && (caller_perms() != player))
2return E_PERM;
3endif
4if (!(who = this:loaded(player)))
5player:tell(this:nothing_loaded_msg());
6else
7this:append_line(who, argstr);
8endif

enter

Spec any none noneFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (!this:loaded(player))
2player:tell(this:nothing_loaded_msg());
3else
4lines = $command_utils:read_lines();
5if (typeof(lines) == ERR)
6player:notify(tostr(lines));
7return;
8endif
9this:insert_line(this:loaded(player), lines, 0);
10endif

lis*t view

Spec any any anyFlags rdOwner #36Definer #50

Referenced by

none

Source

1nonum = 0;
2if (verb == "view")
3if (!args)
4l = {};
5for i in [1..length(this.active)]
6if (this.readable[i])
7l = {@l, this.active[i]};
8endif
9endfor
10if (l)
11player:tell("Players having readable texts in this editor:  ", $string_utils:names_of(l));
12else
13player:tell("No one has published anything in this editor.");
14endif
15return;
16elseif ($command_utils:player_match_result(plyr = $string_utils:match_player(args[1]), args[1])[1])
17"...no such player";
18return;
19elseif ((!(who = this:loaded(plyr))) || (!this:readable(who)))
20player:tell(plyr.name, "(", plyr, ") has not published anything in this editor.");
21return;
22endif
23args = listdelete(args, 1);
24elseif (!(who = this:loaded(player)))
25player:tell(this:nothing_loaded_msg());
26return;
27endif
28len = length(this.texts[who]);
29ins = this.inserting[who];
30window = 8;
31if (len < (2 * window))
32default = {"1-$"};
33elseif (ins <= window)
34default = {tostr("1-", 2 * window)};
35else
36default = {tostr(window, "_-", window, "^"), tostr(2 * window, "$-$")};
37endif
38if (typeof(range = this:parse_range(who, default, @args)) != LIST)
39player:tell(tostr(range));
40elseif (range[3] && (!(nonum = "nonum" == $string_utils:trim(range[3]))))
41player:tell("Don't understand this:  ", range[3]);
42elseif (nonum)
43player:tell_lines(this.texts[who][range[1]..range[2]]);
44else
45for line in [range[1]..range[2]]
46this:list_line(who, line);
47if ($command_utils:running_out_of_time())
48suspend(0);
49if (!(who = this:loaded(player)))
50player:tell("ack!  something bad happened during a suspend...");
51return;
52endif
53endif
54endfor
55if ((ins > len) && (len == range[2]))
56player:tell("^^^^");
57endif
58endif

ins*ert n*ext p*revious .

Spec any none noneFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (i = index(argstr, "\""))
2text = argstr[i + 1..$];
3argstr = argstr[1..i - 1];
4else
5text = 0;
6endif
7spec = $string_utils:trim(argstr);
8if (index("next", verb) == 1)
9verb = "next";
10spec = "+" + (spec || "1");
11elseif (index("prev", verb) == 1)
12verb = "prev";
13spec = "-" + (spec || "1");
14else
15spec = spec || ".";
16endif
17if (!(who = this:loaded(player)))
18player:tell(this:nothing_loaded_msg());
19elseif (ERR == typeof(number = this:parse_insert(who, spec)))
20if (verb in {"next", "prev"})
21player:tell("Argument must be a number.");
22else
23player:tell("You must specify an integer or `$' for the last line.");
24endif
25elseif ((number > (max = length(this.texts[who]) + 1)) || (number < 1))
26player:tell("That would take you out of range (to line ", number, "?).");
27else
28this.inserting[who] = number;
29if (typeof(text) == STR)
30this:insert_line(who, text);
31else
32if (verb != "next")
33(number > 1) ? this:list_line(who, number - 1) | player:tell("____");
34endif
35if (verb != "prev")
36(number < max) ? this:list_line(who, number) | player:tell("^^^^");
37endif
38endif
39endif

del*ete

Spec any any anyFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (!(who = this:loaded(player)))
2player:tell(this:nothing_loaded_msg());
3elseif (typeof(range = this:parse_range(who, {"_", "1"}, @args)) != LIST)
4player:tell(range);
5elseif (range[3])
6player:tell("Junk at end of cmd:  ", range[3]);
7else
8player:tell_lines((text = this.texts[who])[from = range[1]..to = range[2]]);
9player:tell("---Line", (to > from) ? "s" | "", " deleted.  Insertion point is before line ", from, ".");
10this.texts[who] = {@text[1..from - 1], @text[to + 1..$]};
11if (!this.changes[who])
12this.changes[who] = 1;
13this.times[who] = time();
14endif
15this.inserting[who] = from;
16endif

f*ind

Spec any any anyFlags rxdOwner #36Definer #50

Referenced by

none

Source

1if (callers() && (caller != this))
2return E_PERM;
3endif
4if (!(who = this:loaded(player)))
5player:tell(this:nothing_loaded_msg());
6elseif (typeof(subst = this:parse_subst(argstr && (argstr[1] + argstr), "c", "Empty search string?")) != LIST)
7player:tell(tostr(subst));
8elseif (typeof(start = subst[4] ? this:parse_insert(who, subst[4]) | this.inserting[who]) == ERR)
9player:tell("Starting from where?", subst[4] ? ("  (can't parse " + subst[4]) + ")" | "");
10else
11search = subst[2];
12case = !index(subst[3], "c", 1);
13text = this.texts[who];
14tlen = length(text);
15while ((start <= tlen) && (!index(text[start], search, case)))
16start = start + 1;
17endwhile
18if (start > tlen)
19player:tell("`", search, "' not found.");
20else
21this.inserting[who] = start + 1;
22this:list_line(who, start);
23endif
24endif

s*ubst

Spec any any anyFlags rxdOwner #36Definer #50

Referenced by

none

Source

1if (callers() && (caller != this))
2return E_PERM;
3endif
4if (!(who = this:loaded(player)))
5player:tell(this:nothing_loaded_msg());
6elseif (typeof(subst = this:parse_subst(argstr)) != LIST)
7player:tell(tostr(subst));
8elseif (typeof(range = this:parse_range(who, {"_", "1"}, @$string_utils:explode(subst[4]))) != LIST)
9player:tell(range);
10elseif (range[3])
11player:tell("Junk at end of cmd:  ", range[3]);
12else
13fromstr = subst[1];
14tostr = subst[2];
15global = index(subst[3], "g", 1);
16case = !index(subst[3], "c", 1);
17munged = {};
18text = this.texts[who];
19changed = {};
20for line in [from = range[1]..to = range[2]]
21t = t0 = text[line];
22if (!fromstr)
23t = tostr + t;
24elseif (global)
25t = strsub(t, fromstr, tostr, case);
26elseif (i = index(t, fromstr, case))
27t = (t[1..i - 1] + tostr) + t[i + length(fromstr)..$];
28endif
29if (strcmp(t0, t))
30changed = {@changed, line};
31endif
32munged = {@munged, t};
33endfor
34if (!changed)
35player:tell("No changes in line", (from == to) ? tostr(" ", from) | tostr("s ", from, "-", to), ".");
36else
37this.texts[who] = {@text[1..from - 1], @munged, @text[to + 1..$]};
38if (!this.changes[who])
39this.changes[who] = 1;
40this.times[who] = time();
41endif
42for line in (changed)
43this:list_line(who, line);
44endfor
45endif
46endif

m*ove c*opy

Spec any any anyFlags rdOwner #36Definer #50

Referenced by

none

Source

1verb = (is_move = verb[1] == "m") ? "move" | "copy";
2if (!(who = this:loaded(player)))
3player:tell(this:nothing_loaded_msg());
4return;
5endif
6wargs = args;
7t = to_pos = 0;
8while (t = "to" in (wargs = wargs[t + 1..$]))
9to_pos = to_pos + t;
10endwhile
11range_args = args[1..to_pos - 1];
12if ((!to_pos) || (ERR == typeof(dest = this:parse_insert(who, $string_utils:from_list(wargs, " ")))))
13player:tell(verb, " to where? ");
14elseif ((dest < 1) || (dest > ((last = length(this.texts[who])) + 1)))
15player:tell("Destination (", dest, ") out of range.");
16elseif (("from" in range_args) || ("to" in range_args))
17player:tell("Don't use that kind of range specification with this command.");
18elseif (typeof(range = this:parse_range(who, {"_", "^"}, @args[1..to_pos - 1])) != LIST)
19player:tell(range);
20elseif (range[3])
21player:tell("Junk before `to':  ", range[3]);
22elseif ((is_move && (dest >= range[1])) && (dest <= (range[2] + 1)))
23player:tell("Destination lies inside range of lines to be moved.");
24else
25from = range[1];
26to = range[2];
27ins = this.inserting[who];
28text = this.texts[who];
29if (!is_move)
30this.texts[who] = {@text[1..dest - 1], @text[from..to], @text[dest..last]};
31if (ins >= dest)
32this.inserting[who] = ((ins + to) - from) + 1;
33endif
34else
35"oh shit... it's a move";
36if (dest < from)
37newtext = {@text[1..dest - 1], @text[from..to], @text[dest..from - 1], @text[to + 1..last]};
38if ((ins >= dest) && (ins <= to))
39ins = (ins > from) ? (ins - from) + dest | (((ins + to) - from) + 1);
40endif
41else
42newtext = {@text[1..from - 1], @text[to + 1..dest - 1], @text[from..to], @text[dest..last]};
43if ((ins > from) && (ins < dest))
44ins = (ins <= to) ? ((ins + dest) - to) - 1 | (((ins - to) + from) - 1);
45endif
46endif
47this.texts[who] = newtext;
48this.inserting[who] = ins;
49endif
50if (!this.changes[who])
51this.changes[who] = 1;
52this.times[who] = time();
53endif
54player:tell("Lines ", is_move ? "moved." | "copied.");
55endif

join*literal

Spec any any anyFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (!(who = this:loaded(player)))
2player:tell(this:nothing_loaded_msg());
3elseif (typeof(range = this:parse_range(who, {"_-^", "_", "^"}, @args)) != LIST)
4player:tell(range);
5elseif (range[3])
6player:tell("Junk at end of cmd:  ", range[3]);
7elseif (!(result = this:join_lines(who, @range[1..2], length(verb) <= 4)))
8player:tell((result == 0) ? "Need at least two lines to join." | result);
9else
10this:list_line(who, range[1]);
11endif

fill

Spec any any anyFlags rdOwner #36Definer #50

Referenced by

none

Source

1fill_column = 70;
2if (!(who = this:loaded(player)))
3player:tell(this:nothing_loaded_msg());
4elseif (typeof(range = this:parse_range(who, {"_", "1"}, @args)) != LIST)
5player:tell(range);
6elseif (range[3] && ((range[3][1] != "@") || ((fill_column = toint(range[3][2..$])) < 10)))
7player:tell("Usage:  fill [<range>] [@ column]   (where column >= 10).");
8else
9join = this:join_lines(who, @range[1..2], 1);
10newlines = this:fill_string((text = this.texts[who])[from = range[1]], fill_column);
11if (fill = ((nlen = length(newlines)) > 1) || (newlines[1] != text[from]))
12this.texts[who] = {@text[1..from - 1], @newlines, @text[from + 1..$]};
13if (((insert = this.inserting[who]) > from) && (nlen > 1))
14this.inserting[who] = (insert + nlen) - 1;
15endif
16endif
17if (fill || join)
18for line in [from..(from + nlen) - 1]
19this:list_line(who, line);
20endfor
21else
22player:tell("No changes.");
23endif
24endif

pub*lish perish unpub*lish depub*lish

Spec none none noneFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (!(who = this:loaded(player)))
2player:tell(this:nothing_loaded_msg());
3return;
4endif
5if (typeof(e = this:set_readable(who, index("publish", verb) == 1)) == ERR)
6player:tell(e);
7elseif (e)
8player:tell("Your text is now globally readable.");
9else
10player:tell("Your text is read protected.");
11endif

w*hat

Spec none none noneFlags rxdOwner #36Definer #50

Referenced by

Source

1if (!(this:ok(who = player in this.active) && (typeof(this.texts[who]) == LIST)))
2player:tell(this:nothing_loaded_msg());
3else
4player:tell("You are editing ", this:working_on(who), ".");
5player:tell("Your insertion point is ", (this.inserting[who] > length(this.texts[who])) ? "after the last line: next line will be #" | "before line ", this.inserting[who], ".");
6player:tell(this.changes[who] ? this:change_msg() | this:no_change_msg());
7if (this.readable[who])
8player:tell("Your text is globally readable.");
9endif
10endif

abort

Spec none none noneFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (!this.changes[who = player in this.active])
2player:tell("No changes to throw away.  Editor cleared.");
3else
4player:tell("Throwing away session for ", this:working_on(who), ".");
5endif
6this:reset_session(who);
7if (this.exit_on_abort)
8this:done();
9endif

done q*uit pause

Spec none none noneFlags rxdOwner #36Definer #50

Referenced by

Source

1if (!(caller in {this, player}))
2return E_PERM;
3elseif (!(who = player in this.active))
4player:tell("You are not actually in ", this.name, ".");
5return;
6elseif (!valid(origin = this.original[who]))
7player:tell("I don't know where you came here from.");
8else
9player:moveto(origin);
10if (player.location == this)
11player:tell("Hmmm... the place you came from doesn't want you back.");
12else
13if (msg = this:return_msg())
14player.location:announce($string_utils:pronoun_sub(msg));
15endif
16return;
17endif
18endif
19player:tell("You'll have to use 'home' or a teleporter.");

huh2

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

none

Source

1"This catches subst and find commands that don't fit into the usual model, e.g., s/.../.../ without the space after the s, and find commands without the verb `find'.  Still behaves in annoying ways (e.g., loses if the search string contains multiple whitespace), but better than before.";
2set_task_perms(caller_perms());
3if ((c = callers()) && ((c[1][1] != this) || (length(c) > 1)))
4return pass(@args);
5endif
6verb = args[1];
7v = 1;
8vmax = min(length(verb), 5);
9while ((v <= vmax) && (verb[v] == "subst"[v]))
10v = v + 1;
11endwhile
12argstr = $code_utils:argstr(verb, args[2]);
13if (((v > 1) && (v <= length(verb))) && (((vl = verb[v]) < "A") || (vl > "Z")))
14argstr = (verb[v..$] + (argstr && " ")) + argstr;
15return this:subst();
16elseif ("/" == verb[1])
17argstr = (verb + (argstr && " ")) + argstr;
18return this:find();
19else
20pass(@args);
21endif

insertion

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1return this:ok(who = args[1]) && this.inserting[who];

set_insertion

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1return this:ok(who = args[1]) && ((((ins = toint(args[2])) < 1) ? E_INVARG | ((ins <= (max = length(this.texts[who]) + 1)) || (ins = max))) && (this.inserting[who] = ins));

changed retain_session_on_exit

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return this:ok(who = args[1]) && this.changes[who];

set_changed

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return this:ok(who = args[1]) && (((unchanged = !args[2]) || (this.times[who] = time())) && (this.changes[who] = !unchanged));

origin

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1return this:ok(who = args[1]) && this.original[who];

set_origin

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1return this:ok(who = args[1]) && (((valid(origin = args[2]) && (origin != this)) || ((origin == $nothing) || E_INVARG)) && (this.original[who] = origin));

readable

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return (((who = args[1]) < 1) || (who > length(this.active))) ? E_RANGE | this.readable[who];

set_readable

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return this:ok(who = args[1]) && (this.readable[who] = !(!args[2]));

text

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1{?who = player in this.active} = args;
2return (this:readable(who) || this:ok(who)) && this.texts[who];

load

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1texts = args[2];
2if (!(fuckup = this:ok(who = args[1])))
3return fuckup;
4elseif (typeof(texts) == STR)
5texts = {texts};
6elseif ((typeof(texts) != LIST) || (length(texts) && (typeof(texts[1]) != STR)))
7return E_TYPE;
8endif
9this.texts[who] = texts;
10this.inserting[who] = length(texts) + 1;
11this.changes[who] = 0;
12this.readable[who] = 0;
13this.times[who] = time();

working_on

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1"Dummy routine.  The child editor should provide something informative";
2return this:ok(who = args[1]) && (("something [in " + this.name) + "]");

ok

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1who = args[1];
2if ((who < 1) || (who > length(this.active)))
3return E_RANGE;
4elseif ((length(c = callers()) < 2) ? player == this.active[who] | ((c[2][1] == this) || ($perm_utils:controls(c[2][3], this.active[who]) || (c[2][3] == $generic_editor.owner))))
5return 1;
6else
7return E_PERM;
8endif

loaded

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return ((who = args[1] in this.active) && (typeof(this.texts[who]) == LIST)) && who;

list_line

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1$ansi_utils:add_noansi();
2if (this:ok(who = args[1]))
3f = 1 + ((line = args[2]) in {(ins = this.inserting[who]) - 1, ins});
4player:tell($string_utils:right(line, 3, " _^"[f]), ":_^"[f], " ", this.texts[who][line]);
5endif
6$ansi_utils:remove_noansi();

insert_line

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1":insert_line([who,] line or list of lines [,quiet])";
2"  inserts the given text at the insertion point.";
3"  returns E_NONE if the session has no text loaded yet.";
4if (typeof(args[1]) != INT)
5args = {player in this.active, @args};
6endif
7{who, lines, ?quiet = this.active[who]:edit_option("quiet_insert")} = args;
8if (!(fuckup = this:ok(who)))
9return fuckup;
10elseif (typeof(text = this.texts[who]) != LIST)
11return E_NONE;
12else
13if (typeof(lines) != LIST)
14lines = {lines};
15endif
16p = this.active[who];
17insert = this.inserting[who];
18this.texts[who] = {@text[1..insert - 1], @lines, @text[insert..$]};
19this.inserting[who] = insert + length(lines);
20if (lines)
21if (!this.changes[who])
22this.changes[who] = 1;
23this.times[who] = time();
24endif
25if (!quiet)
26if (length(lines) != 1)
27p:tell("Lines ", insert, "-", (insert + length(lines)) - 1, " added.");
28else
29p:tell("Line ", insert, " added.");
30endif
31endif
32else
33p:tell("No lines added.");
34endif
35endif

append_line

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1":append_line([who,] string)";
2"  appends the given string to the line before the insertion point.";
3"  returns E_NONE if the session has no text loaded yet.";
4if (typeof(args[1]) != INT)
5args = {player in this.active, @args};
6endif
7{who, string} = args;
8if (!(fuckup = this:ok(who)))
9return fuckup;
10elseif ((append = this.inserting[who] - 1) < 1)
11return this:insert_line(who, {string});
12elseif (typeof(text = this.texts[who]) != LIST)
13return E_NONE;
14else
15this.texts[who][append] = text[append] + string;
16if (!this.changes[who])
17this.changes[who] = 1;
18this.times[who] = time();
19endif
20p = this.active[who];
21if (!p:edit_option("quiet_insert"))
22p:tell("Appended to line ", append, ".");
23endif
24endif

join_lines

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1{who, from, to, english} = args;
2if (!(fuckup = this:ok(who)))
3return fuckup;
4elseif (from >= to)
5return 0;
6else
7nline = "";
8for line in ((text = this.texts[who])[from..to])
9if (!english)
10nline = nline + line;
11else
12len = length(line) + 1;
13while ((len = len - 1) && (line[len] == " "))
14endwhile
15if (len > 0)
16nline = (nline + line) + (index(".:", line[len]) ? "  " | " ");
17endif
18endif
19endfor
20this.texts[who] = {@text[1..from - 1], nline, @text[to + 1..$]};
21if ((insert = this.inserting[who]) > from)
22this.inserting[who] = (insert <= to) ? from + 1 | ((insert - to) + from);
23endif
24if (!this.changes[who])
25this.changes[who] = 1;
26this.times[who] = time();
27endif
28return to - from;
29endif

parse_number

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1"parse_number(who,string,before)   interprets string as a line number.  In the event that string is `.', `before' tells us which line to use.  Return 0 if string is bogus.";
2{who, string, before} = args;
3if (!(fuckup = this:ok(who)))
4return fuckup;
5endif
6last = length(this.texts[who]);
7ins = this.inserting[who] - 1;
8after = !before;
9if (!string)
10return 0;
11elseif ("." == string)
12return ins + after;
13elseif (!(i = index("_^$", string[slen = length(string)])))
14return toint(string);
15else
16start = {ins + 1, ins, last + 1}[i];
17n = 1;
18if ((slen > 1) && (!(n = toint(string[1..slen - 1]))))
19return 0;
20elseif (i % 2)
21return start - n;
22else
23return start + n;
24endif
25endif

parse_range

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1"parse_range(who,default,@args) => {from to rest}";
2numargs = length(args);
3if (!(fuckup = this:ok(who = args[1])))
4return fuckup;
5elseif (!(last = length(this.texts[who])))
6return this:no_text_msg();
7endif
8default = args[2];
9r = 0;
10while (default && (LIST != typeof(r = this:parse_range(who, {}, default[1]))))
11default = listdelete(default, 1);
12endwhile
13if (typeof(r) == LIST)
14from = r[1];
15to = r[2];
16else
17from = to = 0;
18endif
19saw_from_to = 0;
20not_done = 1;
21a = 2;
22while (((a = a + 1) <= numargs) && not_done)
23if (args[a] == "from")
24if ((a == numargs) || (!(from = this:parse_number(who, args[a = a + 1], 0))))
25return "from ?";
26endif
27saw_from_to = 1;
28elseif (args[a] == "to")
29if ((a == numargs) || (!(to = this:parse_number(who, args[a = a + 1], 1))))
30return "to ?";
31endif
32saw_from_to = 1;
33elseif (saw_from_to)
34a = a - 1;
35not_done = 0;
36elseif (i = index(args[a], "-"))
37from = this:parse_number(who, args[a][1..i - 1], 0);
38to = this:parse_number(who, args[a][i + 1..$], 1);
39not_done = 0;
40elseif (f = this:parse_number(who, args[a], 0))
41from = f;
42if ((a == numargs) || (!(to = this:parse_number(who, args[a + 1], 1))))
43to = from;
44else
45a = a + 1;
46endif
47not_done = 0;
48else
49a = a - 1;
50not_done = 0;
51endif
52endwhile
53if (from < 1)
54return tostr("from ", from, "?  (out of range)");
55elseif (to > last)
56return tostr("to ", to, "?  (out of range)");
57elseif (from > to)
58return tostr("from ", from, " to ", to, "?  (backwards range)");
59else
60return {from, to, $string_utils:from_list(args[a..numargs], " ")};
61endif

parse_insert

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1"parse_ins(who,string)  interprets string as an insertion point, i.e., a position between lines and returns the number of the following line or 0 if bogus.";
2if (!(fuckup = this:ok(who = args[1])))
3return fuckup;
4endif
5{who, string} = args;
6last = length(this.texts[who]) + 1;
7ins = this.inserting[who];
8if (i = index("-+", string[1]))
9rest = string[2..$];
10return ((n = toint(rest)) || (rest == "0")) ? {ins - n, ins + n}[i] | E_INVARG;
11else
12if (!(j = index(string, "^") || index(string, "_")))
13offset = 0;
14else
15offset = (j == 1) || toint(string[1..j - 1]);
16if (!offset)
17return E_INVARG;
18elseif (string[j] == "^")
19offset = -offset;
20endif
21endif
22rest = string[j + 1..$];
23if (i = rest in {".", "$"})
24return offset + {ins, last}[i];
25elseif (!(n = toint(rest)))
26return E_INVARG;
27else
28return (offset + (j && (string[j] == "^"))) + n;
29endif
30endif

parse_subst

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1{cmd, ?recognized_flags = "gc", ?null_subst_msg = "Null substitution?"} = args;
2if (!cmd)
3return "/xxx/yyy[/[g][c]] [<range>] expected..";
4endif
5bchar = cmd[1];
6cmd = cmd[2..$];
7fromstr = cmd[1..(b2 = index(cmd + bchar, bchar, 1)) - 1];
8cmd = cmd[b2 + 1..$];
9tostr = cmd[1..(b2 = index(cmd + bchar, bchar, 1)) - 1];
10cmd = cmd[b2 + 1..$];
11cmdlen = length(cmd);
12b2 = 0;
13while (((b2 = b2 + 1) <= cmdlen) && index(recognized_flags, cmd[b2]))
14endwhile
15return ((fromstr == "") && (tostr == "")) ? null_subst_msg | {fromstr, tostr, cmd[1..b2 - 1], cmd[b2..$]};

invoke

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1":invoke(...)";
2"to find out what arguments this verb expects,";
3"see this editor's parse_invoke verb.";
4new = args[1];
5if ((!(caller in {this, player})) && (!$perm_utils:controls(caller_perms(), player)))
6"...non-editor/non-player verb trying to send someone to the editor...";
7return E_PERM;
8endif
9if ((who = this:loaded(player)) && this:changed(who))
10if (!new)
11if (this:suck_in(player))
12player:tell("You are working on ", this:working_on(who));
13endif
14return;
15elseif (player.location == this)
16player:tell("You are still working on ", this:working_on(who));
17if (msg = this:previous_session_msg())
18player:tell(msg);
19endif
20return;
21endif
22"... we're not in the editor and we're about to start something new,";
23"... but there's still this pending session...";
24player:tell("You were working on ", this:working_on(who));
25if (!$command_utils:yes_or_no("Do you wish to delete that session?"))
26if (this:suck_in(player))
27player:tell("Continuing with ", this:working_on(player in this.active));
28if (msg = this:previous_session_msg())
29player:tell(msg);
30endif
31endif
32return;
33endif
34"... note session number may have changed => don't trust `who'";
35this:kill_session(player in this.active);
36endif
37spec = this:parse_invoke(@args);
38if (typeof(spec) == LIST)
39if ((player:edit_option("local") && $object_utils:has_verb(this, "local_editing_info")) && (info = this:local_editing_info(@spec)))
40this:invoke_local_editor(@info);
41elseif (this:suck_in(player))
42this:init_session(player in this.active, @spec);
43endif
44endif

suck_in

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1"The correct way to move someone into the editor.";
2if (((loc = (who_obj = args[1]).location) != this) && (caller == this))
3this.invoke_task = task_id();
4who_obj:moveto(this);
5if (who_obj.location == this)
6try
7"...forked, just in case loc:announce is broken...";
8"changed to a try-endtry. Lets reduce tasks..Ho_Yan 12/20/96";
9if (valid(loc) && (msg = this:depart_msg()))
10loc:announce($string_utils:pronoun_sub(msg));
11endif
12except (ANY)
13"Just drop it and move on";
14endtry
15else
16who_obj:tell("For some reason, I can't move you.   (?)");
17this:exitfunc(who_obj);
18endif
19this.invoke_task = 0;
20endif
21return who_obj.location == this;

new_session

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

Source

1"WIZARDLY";
2{who_obj, from} = args;
3if ($object_utils:isa(from, $generic_editor))
4"... never put an editor in .original, ...";
5if (w = who_obj in from.active)
6from = from.original[w];
7else
8from = #-1;
9endif
10endif
11if (caller != this)
12return E_PERM;
13elseif (who = who_obj in this.active)
14"... edit in progress here...";
15if (valid(from))
16this.original[who] = from;
17endif
18return -1;
19else
20for p in ({{"active", who_obj}, {"original", valid(from) ? from | $nothing}, {"times", time()}, @this.stateprops})
21this.(p[1]) = {@this.(p[1]), p[2]};
22endfor
23return length(this.active);
24endif

kill_session

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

Source

1"WIZARDLY";
2if (!(fuckup = this:ok(who = args[1])))
3return fuckup;
4else
5for p in ({@this.stateprops, {"original"}, {"active"}, {"times"}})
6this.(p[1]) = listdelete(this.(p[1]), who);
7endfor
8return who;
9endif

reset_session

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

Source

1"WIZARDLY";
2if (!(fuckup = this:ok(who = args[1])))
3return fuckup;
4else
5for p in (this.stateprops)
6this.(p[1])[who] = p[2];
7endfor
8this.times[who] = time();
9return who;
10endif

kill_all_sessions

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

Source

1"WIZARDLY";
2if ((caller != this) && (!caller_perms().wizard))
3return E_PERM;
4else
5for victim in (this.contents)
6victim:tell("Sorry, ", this.name, " is going down.  Your editing session is hosed.");
7victim:moveto(((who = victim in this.active) && valid(origin = this.original[who])) ? origin | (valid(victim.home) ? victim.home | $player_start));
8endfor
9for p in ({@this.stateprops, {"original"}, {"active"}, {"times"}})
10this.(p[1]) = {};
11endfor
12return 1;
13endif

acceptable

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return is_player(who_obj = args[1]) && (who_obj.wizard || pass(@args));

enterfunc

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1who_obj = args[1];
2if (who_obj.wizard && (!(who_obj in this.active)))
3this:accept(who_obj);
4endif
5pass(@args);
6if (this.invoke_task == task_id())
7"Means we're about to load something, so be quiet.";
8this.invoke_task = 0;
9elseif (who = this:loaded(who_obj))
10who_obj:tell("You are working on ", this:working_on(who), ".");
11elseif (msg = this:nothing_loaded_msg())
12who_obj:tell(msg);
13endif

exitfunc

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1if (!(who = (who_obj = args[1]) in this.active))
2elseif (this:retain_session_on_exit(who))
3if (msg = this:no_littering_msg())
4who_obj:tell_lines(msg);
5endif
6else
7this:kill_session(who);
8endif
9pass(@args);

@flush

Spec this any anyFlags rxdOwner #36Definer #50

Referenced by

none

Source

1"@flush <editor>";
2"@flush <editor> at <month> <day>";
3"@flush <editor> at <weekday>";
4"The first form removes all sessions from the editor; the other two forms remove everything older than the given date.";
5if ((caller_perms() != #-1) && (caller_perms() != player))
6raise(E_PERM);
7elseif (!$perm_utils:controls(player, this))
8player:tell("Only the owner of the editor can do a ", verb, ".");
9return;
10endif
11if (!prepstr)
12player:tell("Trashing all sessions.");
13this:kill_all_sessions();
14elseif (prepstr != "at")
15player:tell("Usage:  ", verb, " ", dobjstr, " [at [mon day|weekday]]");
16else
17p = prepstr in args;
18if (t = $time_utils:from_day(iobjstr, -1))
19elseif (t = $time_utils:from_month(args[p + 1], -1))
20if (length(args) > (p + 1))
21if (!(n = toint(args[p + 2])))
22player:tell(args[p + 1], " WHAT?");
23return;
24endif
25t = t + ((n - 1) * 86400);
26endif
27else
28player:tell("couldn't parse date");
29return;
30endif
31this:do_flush(t, "noisy");
32endif
33player:tell("Done.");

@stateprop

Spec any for/about thisFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (!$perm_utils:controls(player, this))
2player:tell(E_PERM);
3return;
4endif
5if (i = index(dobjstr, "="))
6default = dobjstr[i + 1..$];
7prop = dobjstr[1..i - 1];
8if (argstr[1 + index(argstr, "=")] == "\"")
9elseif (default[1] == "#")
10default = toobj(default);
11elseif (index("0123456789", default[1]))
12default = toint(default);
13elseif (default == "{}")
14default = {};
15endif
16else
17default = 0;
18prop = dobjstr;
19endif
20if (typeof(result = this:set_stateprops(prop, default)) == ERR)
21player:tell((result == E_RANGE) ? tostr(".", prop, " needs to hold a list of the same length as .active (", length(this.active), ").") | ((result != E_NACC) ? result | (prop + " is already a property on an ancestral editor.")));
22else
23player:tell("Property added.");
24endif

@rmstateprop

Spec any out of/from inside/from thisFlags rdOwner #36Definer #50

Referenced by

none

Source

1if (!$perm_utils:controls(player, this))
2player:tell(E_PERM);
3elseif (typeof(result = this:set_stateprops(dobjstr)) == ERR)
4player:tell((result != E_NACC) ? result | (dobjstr + " is already a property on an ancestral editor."));
5else
6player:tell("Property removed.");
7endif

initialize

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1if ($perm_utils:controls(caller_perms(), this))
2pass(@args);
3this:kill_all_sessions();
4endif

init_for_core

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

none

Source

1if (caller_perms().wizard)
2pass();
3this:kill_all_sessions();
4if (this == $generic_editor)
5this.help = $editor_help;
6endif
7if ($object_utils:defines_verb(this, "is_not_banned"))
8delete_verb(this, "is_not_banned");
9endif
10endif

set_stateprops

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1remove = length(args) < 2;
2if ((caller != this) && (!$perm_utils:controls(caller_perms(), this)))
3return E_PERM;
4elseif (!(length(args) in {1, 2}))
5return E_ARGS;
6elseif (typeof(prop = args[1]) != STR)
7return E_TYPE;
8elseif (i = $list_utils:iassoc(prop, this.stateprops))
9if (!remove)
10this.stateprops[i] = {prop, args[2]};
11elseif ($object_utils:has_property(parent(this), prop))
12return E_NACC;
13else
14this.stateprops = listdelete(this.stateprops, i);
15endif
16elseif (remove)
17elseif (prop in `properties(this) ! ANY => {}')
18if (this:_stateprop_length(prop) != length(this.active))
19return E_RANGE;
20endif
21this.stateprops = {{prop, args[2]}, @this.stateprops};
22else
23return $object_utils:has_property(this, prop) ? E_NACC | E_PROPNF;
24endif
25return 0;

description

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1is_look_self = 1;
2for c in (callers())
3if (is_look_self && (c[2] in {"enterfunc", "confunc"}))
4return {"", "Do a 'look' to get the list of commands, or 'help' for assistance.", "", @this.description};
5elseif ((c[2] != "look_self") && (c[2] != "pass"))
6is_look_self = 0;
7endif
8endfor
9d = {"Commands:", ""};
10col = {{}, {}};
11for c in [1..2]
12for cmd in (this.commands2[c])
13cmd = this:commands_info(cmd);
14col[c] = {cmdargs = $string_utils:left(cmd[1] + " ", 12) + cmd[2], @col[c]};
15endfor
16endfor
17i1 = length(col[1]);
18i2 = length(col[2]);
19right = 0;
20while (i1 || i2)
21if (!((i1 && (length(col[1][i1]) > 35)) || (i2 && (length(col[2][i2]) > 35))))
22d = {@d, $string_utils:left(i1 ? col[1][i1] | "", 40) + (i2 ? col[2][i2] | "")};
23i1 && (i1 = i1 - 1);
24i2 && (i2 = i2 - 1);
25right = 0;
26elseif (right && i2)
27d = {@d, (length(col[2][i2]) > 35) ? $string_utils:right(col[2][i2], 75) | ($string_utils:space(40) + col[2][i2])};
28i2 = i2 - 1;
29right = 0;
30elseif (i1)
31d = {@d, col[1][i1]};
32i1 = i1 - 1;
33right = 1;
34else
35right = 1;
36endif
37endwhile
38return {@d, "", "----  Do `help <cmdname>' for help with a given command.  ----", "", "  <ins> ::= $ (the end) | [^]n (above line n) | _n (below line n) | . (current)", "<range> ::= <lin> | <lin>-<lin> | from <lin> | to <lin> | from <lin> to <lin>", "  <lin> ::= n | [n]$ (n from the end) | [n]_ (n before .) | [n]^ (n after .)", "`help insert' and `help ranges' describe these in detail.", @this.description};

commands_info

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1cmd = args[1];
2if (pc = $list_utils:assoc(cmd, this.commands))
3return pc;
4elseif (this == $generic_editor)
5return {cmd, "<<<<<======= Need to add this to .commands"};
6else
7return parent(this):commands_info(cmd);
8endif

match_object

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1{objstr, ?who = player} = args;
2origin = this;
3while ((where = player in origin.active) && ($recycler:valid(origin = origin.original[where]) && (origin != this)))
4if (!$object_utils:isa(origin, $generic_editor))
5return origin:match_object(objstr, who);
6endif
7endwhile
8return who:my_match_object(objstr, #-1);

who_location_msg

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1who = args[1];
2where = {#-1, @this.original}[1 + (who in this.active)];
3return strsub(this.who_location_msg, "%L", `where:who_location_msg(who) ! ANY => "An Editor"');
4return $string_utils:pronoun_sub(this.who_location_msg, who, this, where);

nothing_loaded_msg no_text_msg change_msg no_change_msg no_littering_msg depart_msg return_msg previous_session_msg

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return this.(verb);

announce announce_all announce_all_but tell_contents

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1return;

fill_string(noansi)

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1"fill(string [, width [, prefix]])";
2"tries to cut <string> into substrings of length < <width> along word boundaries.  Prefix, if supplied, will be prefixed to the 2nd..last substrings.";
3{string, ?width = 1 + player:linelen(), ?prefix = ""} = args;
4width = width + 1;
5if (width < (3 + length(prefix)))
6return E_INVARG;
7endif
8string = ("$" + string) + " $";
9len = length(string);
10if (len <= width)
11last = len - 1;
12next = len;
13else
14last = rindex(string[1..width], " ");
15if (last < ((width + 1) / 2))
16last = width + index(string[width + 1..len], " ");
17endif
18next = last;
19while (string[next = next + 1] == " ")
20endwhile
21endif
22while (string[last = last - 1] == " ")
23endwhile
24ret = {string[2..last]};
25width = width - length(prefix);
26minlast = (width + 1) / 2;
27while (next < len)
28string = "$" + string[next..len];
29len = (len - next) + 2;
30if (len <= width)
31last = len - 1;
32next = len;
33else
34last = rindex(string[1..width], " ");
35if (last < minlast)
36last = width + index(string[width + 1..len], " ");
37endif
38next = last;
39while (string[next = next + 1] == " ")
40endwhile
41endif
42while (string[last = last - 1] == " ")
43endwhile
44if (last > 1)
45ret = {@ret, prefix + string[2..last]};
46endif
47endwhile
48return ret;

here_huh

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

none

Source

1"This catches subst and find commands that don't fit into the usual model, e.g., s/.../.../ without the space after the s, and find commands without the verb `find'.  Still behaves in annoying ways (e.g., loses if the search string contains multiple whitespace), but better than before.";
2if ((caller != this) && (caller_perms() != player))
3return E_PERM;
4endif
5{verb, args} = args;
6v = 1;
7vmax = min(length(verb), 5);
8while ((v <= vmax) && (verb[v] == "subst"[v]))
9v = v + 1;
10endwhile
11argstr = $code_utils:argstr(verb, args);
12if ((v > 1) && ((v <= length(verb)) && (((vl = verb[v]) < "A") || (vl > "Z"))))
13argstr = (verb[v..$] + (argstr && " ")) + argstr;
14this:subst();
15return 1;
16elseif ("/" == verb[1])
17argstr = (verb + (argstr && " ")) + argstr;
18this:find();
19return 1;
20else
21return 0;
22endif

match

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

none

Source

1return $failed_match;

get_room

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1":get_room([player])  => correct room to match in on invocation.";
2{?who = player} = args;
3if (who.location != this)
4return who.location;
5else
6origin = this;
7while ((where = player in origin.active) && (valid(origin = origin.original[where]) && (origin != this)))
8if (!$object_utils:isa(origin, $generic_editor))
9return origin;
10endif
11endwhile
12return this;
13endif

invoke_local_editor

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

Source

1":invoke_local_editor(name, text, upload)";
2"Spits out the magic text that invokes the local editor in the player's client.";
3"NAME is a good human-readable name for the local editor to use for this particular piece of text.";
4"TEXT is a string or list of strings, the initial body of the text being edited.";
5"UPLOAD, a string, is a MOO command that the local editor can use to save the text when the user is done editing.  The local editor is going to send that command on a line by itself, followed by the new text lines, followed by a line containing only `.'.  The UPLOAD command should therefore call $command_utils:read_lines() to get the new text as a list of strings.";
6if (caller != this)
7return;
8endif
9{name, text, upload} = args;
10if (typeof(text) == STR)
11text = {text};
12endif
13notify(player, tostr("#$# edit name: ", name, " upload: ", upload));
14":dump_lines() takes care of the final `.' ...";
15for line in ($command_utils:dump_lines(text))
16notify(player, line);
17endfor

_stateprop_length

Spec this none thisFlags rxdOwner #2Definer #50

Referenced by

Source

1"+c properties on children cannot necessarily be read, so we need this silliness...";
2if (caller != this)
3return E_PERM;
4else
5return length(this.(args[1]));
6endif

print

Spec none none noneFlags rdOwner #2Definer #50

Referenced by

none

Source

1txt = this:text(player in this.active);
2if (typeof(txt) == LIST)
3player:tell_lines(txt);
4else
5player:tell("Text unreadable:  ", txt);
6endif
7player:tell("--------------------------");

accept

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1return this:acceptable(who_obj = args[1]) && this:new_session(who_obj, who_obj.location);

y*ank

Spec any any anyFlags rdOwner #2Definer #50

Referenced by

none

Source

1"Usage: yank from <note>";
2"       yank <message-sequence> from <mail-recipient>";
3"       yank from <object>:<verb>";
4"       yank from <object>.<property>";
5"Grabs the specified text and inserts it at the cursor.";
6set_task_perms(player);
7if (dobjstr)
8"yank <message-sequence> from <mail-recipient>";
9if (!(p = player:parse_mailread_cmd(verb, args, "", "from")))
10return;
11elseif ($seq_utils:size(sequence = p[2]) != 1)
12player:notify(tostr("You can only ", verb, " one message at a time"));
13return;
14else
15m = (folder = p[1]):messages_in_seq(sequence);
16msg = m[1];
17header = tostr("Message ", msg[1]);
18if (folder != player)
19header = tostr(header, " on ", $mail_agent:name(folder));
20endif
21header = tostr(header, ":");
22lines = {header, @player:msg_full_text(@msg[2])};
23this:insert_line(this:loaded(player), lines, 0);
24endif
25elseif (pr = $code_utils:parse_propref(iobjstr))
26o = player:my_match_object(pr[1]);
27if ($command_utils:object_match_failed(o, pr[1]))
28return;
29elseif ((lines = `o.(pr[2]) ! ANY') == E_PROPNF)
30player:notify(tostr("There is no `", pr[2], "' property on ", $string_utils:nn(o), "."));
31return;
32elseif (lines == E_PERM)
33player:notify(tostr("Error: Permission denied reading ", iobjstr));
34return;
35elseif (typeof(lines) == ERR)
36player:notify(tostr("Error: ", lines, " reading ", iobjstr));
37return;
38elseif (typeof(lines) == STR)
39this:insert_line(this:loaded(player), lines, 0);
40return;
41elseif (typeof(lines) == LIST)
42for x in (lines)
43if (typeof(x) != STR)
44player:notify(tostr("Error: ", iobjstr, " does not contain a ", verb, "-able value."));
45return;
46endif
47endfor
48this:insert_line(this:loaded(player), lines, 0);
49return;
50else
51player:notify(tostr("Error: ", iobjstr, " does not contain a ", verb, "-able value."));
52return;
53endif
54elseif (pr = $code_utils:parse_verbref(iobjstr))
55o = player:my_match_object(pr[1]);
56if ($command_utils:object_match_failed(o, pr[1]))
57return;
58elseif (lines = `verb_code(o, pr[2], !player:edit_option("no_parens")) ! ANY')
59this:insert_line(this:loaded(player), lines, 0);
60return;
61elseif (lines == E_PERM)
62player:notify(tostr("Error: Permission denied reading ", iobjstr));
63return;
64elseif (lines == E_VERBNF)
65player:notify(tostr("There is no `", pr[2], "' verb on ", $string_utils:nn(o), "."));
66else
67player:notify(tostr("Error: ", lines, " reading ", iobjstr));
68return;
69endif
70elseif ($command_utils:object_match_failed(iobj = player:my_match_object(iobjstr), iobjstr))
71return;
72elseif ((lines = `iobj:text() ! ANY') == E_PERM)
73player:notify(tostr("Error: Permission denied reading ", iobjstr));
74return;
75elseif (lines == E_VERBNF)
76player:notify($string_utils:nn(iobj), " doesn't seem to be a note.");
77elseif (typeof(lines) == ERR)
78player:notify(tostr("Error: ", lines, " reading ", iobjstr));
79return;
80else
81this:insert_line(this:loaded(player), lines, 0);
82endif

do_flush

Spec this none thisFlags rxdOwner #36Definer #50

Referenced by

Source

1"Flushes editor sessions older than args[1].  If args[2] is true, prints status as it runs.  If args[2] is false, runs silently.";
2if (!$perm_utils:controls(caller_perms(), this))
3return E_PERM;
4else
5{t, noisy} = args;
6for i in [-length(this.active)..-1]
7if (this.times[-i] < t)
8if (noisy)
9player:tell($string_utils:nn(this.active[-i]), ctime(this.times[-i]));
10endif
11this:kill_session(-i);
12endif
13endfor
14endif

fill_string

Spec this none thisFlags rxOwner #2Definer #50

Referenced by

Source

1if (valid(au = $ansi_utils) && au.active)
2return au:(verb)(@args);
3else
4return this:(verb + "(noansi)")(@args);
5endif