Generic Editor #43

Parent #3Owner #29Flags read, fertileSource hellcore/hellcore.db

Aliases: Generic Editor, gedit, edit

70 verbs · 115 properties · 3 children

Verbs

VerbSpecFlagsDefinerLines
sayany any anyrxd#438
emoteany any anyrxd#438
enterany none nonerxd#4310
lis*t viewany any anyrxd#4358
ins*ert n*ext p*revious .any none nonerxd#4339
del*eteany any anyrxd#4316
f*indany any anyrxd#4324
m*ove c*opyany any anyrxd#4355
join*literalany any anyrxd#4311
fillany any anyrxd#4324
pub*lish perish unpub*lish depub*lishnone none nonerxd#4311
w*hatnone none nonerxd#4310
abortnone none nonerxd#439
done q*uit pausenone none nonerxd#4322
huh2this none thisrxd#4321
insertionthis none thisrxd#431
set_insertionthis none thisrxd#431
changed retain_session_on_exitthis none thisrxd#431
set_changedthis none thisrxd#431
originthis none thisrxd#431
set_originthis none thisrxd#431
readablethis none thisrxd#431
set_readablethis none thisrxd#431
textthis none thisrxd#432
loadthis none thisrxd#4313
working_onthis none thisrxd#432
okthis none thisrxd#438
loadedthis none thisrxd#431
list_linethis none thisrxd#434
insert_linethis none thisrxd#4335
append_linethis none thisrxd#4324
join_linesthis none thisrxd#4329
parse_numberthis none thisrxd#4325
parse_rangethis none thisrxd#4361
parse_insertthis none thisrxd#4330
parse_substthis none thisrxd#4315
invokethis none thisrxd#4344
suck_inthis none thisrxd#4324
new_sessionthis none thisrxd#4324
kill_sessionthis none thisrxd#439
reset_sessionthis none thisrxd#4310
kill_all_sessionsthis none thisrxd#4313
acceptablethis none thisrxd#431
enterfuncthis none thisrxd#4313
exitfuncthis none thisrxd#439
@flushthis any anyrxd#4333
@statepropany for/about thisrxd#4324
@rmstatepropany out of/from inside/from thisrxd#437
initializethis none thisrxd#434
init_for_corethis none thisrxd#4310
set_statepropsthis none thisrxd#4325
descriptionthis none thisrxd#4338
commands_infothis none thisrxd#438
match_objectthis none thisrxd#438
who_location_msgthis none thisrxd#438
nothing_loaded_msg no_text_msg change_msg no_change_msg no_littering_msg depart_msg return_msg previous_session_msgthis none thisrxd#431
announce announce_all announce_all_but tell_contentsthis none thisrxd#431
fill_stringthis none thisrxd#4348
here_huhthis none thisrxd#4322
matchthis none thisrxd#431
get_roomthis none thisrxd#4313
invoke_local_editorthis none thisrxd#4320
_stateprop_lengththis none thisrxd#436
printnone none nonerxd#437
acceptthis none thisrxd#431
y*ankany any anyrxd#4382
do_flushthis none thisrxd#4314
s*ubstany any anyrxd#4356
subst_regexpthis none thisrxd#4310
look_selfthis none thisrxd#432

Properties

PropertyDefinerFlagsOwnerValue
readable#43r#29{}
times#43r#29{}
commands2#43rc#29
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#43rc#29#36
no_text_msg#43rc#29"There are no lines of text."
commands#43rc#29
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#43r#290
exit_on_abort#43rc#290
previous_session_msg#43rc#29""
stateprops#43r#29{{"texts", 0}, {"changes", 0}, {"inserting", 1}, {"readable", 0}}
depart_msg#43rc#29"%N heads off to the Generic Editing Room."
return_msg#43rc#29"%N comes back from the Generic Editing Room."
no_littering_msg#43rc#29"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#43rc#29"There have been no changes since the last save."
change_msg#43rc#29"Text has been altered since the last save."
nothing_loaded_msg#43rc#29"You're not currently editing anything."
texts#43#29{}
active#43r#29{}
changes#43#29{}
inserting#43#29{}
original#43r#29{}
no_actions#43rc#291
wiz_editors#43rc#29{}
who_location_msg#3rc#29"%L [editing]"
exits#3c#29<clear>
go_fail_msg#3rc#29<clear>
outdoor#3rc#290
covers#3rc#29<clear>
covering#3rc#29<clear>
tracks#3rc#29{}
windows#3rc#29<clear>
public#3rc#29<clear>
drop_msg#3rc#29<clear>
get_msg#3rc#29<clear>
contents_msg#3rc#29<clear>
contents_many_msg#3rc#29<clear>
default_posture_msg#3rc#29<clear>
seats#3rc#29<clear>
sitting#3rc#29{}
reclining#3rc#29{}
sit_msg#3rc#29<clear>
osit_msg#3rc#29<clear>
sit_from_reclining#3rc#29<clear>
osit_from_reclining#3rc#29<clear>
rise_msg#3rc#29<clear>
orise_msg#3rc#29<clear>
icon#3rc#29<clear>
map#3rc#29<clear>
recent_noises#3rc#29<clear>
fall_into_msg#3rc#29<clear>
size#3rc#29<clear>
sit_from_reclining_msg#3rc#29<clear>
osit_from_reclining_msg#3rc#29<clear>
look_sitting_and_reclining#3rc#29<clear>
look_sitting_msg#3rc#29<clear>
recline_full_msg#3rc#29<clear>
already_sitting_msg#3rc#29<clear>
already_reclining_msg#3rc#29<clear>
recline_from_sitting_msg#3rc#29<clear>
orecline_from_sitting_msg#3rc#29<clear>
recline_msg#3rc#29<clear>
orecline_msg#3rc#29<clear>
look_reclining_msg#3rc#29<clear>
sitting_doing_msg#3rc#29<clear>
reclining_doing_msg#3rc#29<clear>
rise_failed_msg#3rc#29<clear>
infect_interval#3rc#29<clear>
no_exit_msg#3rc#29<clear>
x#3rc#29<clear>
y#3rc#29<clear>
z#3rc#29<clear>
residents#3rc#29<clear>
sit_full_msg#3rc#29<clear>
value#3rc#29<clear>
rustle_msg#3rc#29<clear>
last_rustle#3rc#29<clear>
thing_fall_into_msg#3rc#29<clear>
decal_fall_into_msg#3rc#29<clear>
client_icon#3rc#29<clear>
client_map#3rc#29<clear>
track_msg#3rc#29<clear>
watched#3rc#290
max_objects#3rc#29<clear>
show_map#3rc#29<clear>
objects_to_echo#3rc#29<clear>
always_brief#3rc#29<clear>
furniture#3rc#29{}
fall_into_noise#3rc#29<clear>
ambience#3rc#29<clear>
temperature#3rc#2965
last_temp_update#3rc#291277763889
continue_look_self_msg#3rc#29<clear>
map_restricted#3rc#29<clear>
global_xyz#3rc#29<clear>
common_name_msg#3rc#29<clear>
verb_subs#3rc#29<clear>
darkness#3rc#29{0, 1335143290}
total_dark_description_msg#3rc#29<clear>
has_commands#3rc#291
too_dark_msg#3rc#29<clear>
next_room_to_global_origin#3rc#29<clear>
global_xyz_anchor#3r#361<clear>
search_items#3rc#29<clear>
search_items_left#3rc#29<clear>
already_searched#3rc#29<clear>
aliases#1rc#29{"Generic Editor", "gedit", "edit"}
description#1rc#29{}
object_size#1r#29{54224, 1298433815}
hidden_verbs#1rc#29<clear>
phelp_msg#1rc#29<clear>
weight#1rc#29<clear>
owner_verbs#1rc#29<clear>
plural_name#1rc#29<clear>
client_image#1rc#29<clear>
listening#1rc#29<clear>

Ancestry

Ancestors (nearest first): #3 generic room#1 root

Children: #39 Mail Room, #40 Note Editor, #41 Verb Editor

Call graph

calls n43_0 #43:say n43_27 #43:loaded n43_0->n43_27 n107_43 #107:tell n43_0->n107_43 n43_55 #43:nothing_loaded_msg n43_0->n43_55 n43_29 #43:insert_line n43_0->n43_29 n43_26 #43:ok n43_29->n43_26 n43_1 #43:emote n43_1->n43_27 n43_1->n107_43 n43_1->n43_55 n43_30 #43:append_line n43_1->n43_30 n43_30->n43_29 n43_30->n43_26 n43_2 #43:enter n43_2->n43_27 n43_2->n107_43 n43_2->n43_55 n43_2->n43_29 n48_3 #48:read_lines n43_2->n48_3 n6_9 #6:notify n43_2->n6_9 n43_3 #43:lis*t n43_3->n43_27 n43_3->n107_43 n43_3->n43_55 n20_7 #20:names_of n43_3->n20_7 n48_1 #48:player_match_result n43_3->n48_1 n20_20 #20:match_player n43_3->n20_20 n43_21 #43:readable n43_3->n43_21 n43_33 #43:parse_range n43_3->n43_33 n20_9 #20:trim n43_3->n20_9 n1_11 #1:tell_lines n43_3->n1_11 n43_28 #43:list_line n43_3->n43_28 n48_7 #48:running_out_of_time n43_3->n48_7 n43_33->n43_55 n43_33->n43_33 n20_5 #20:from_list n43_33->n20_5 n43_33->n43_26 n43_28->n107_43 n43_28->n43_26 n43_4 #43:ins*ert n43_4->n43_27 n43_4->n107_43 n43_4->n43_55 n43_4->n43_29 n43_4->n20_9 n43_4->n43_28 n43_34 #43:parse_insert n43_4->n43_34 n43_34->n43_26 n43_5 #43:del*ete n43_5->n43_27 n43_5->n107_43 n43_5->n43_55 n43_5->n43_33 n43_5->n1_11 n43_6 #43:f*ind n43_6->n43_27 n43_6->n107_43 n43_6->n43_55 n43_6->n43_28 n43_6->n43_34 n43_35 #43:parse_subst n43_6->n43_35 n43_7 #43:m*ove n43_7->n43_27 n43_7->n107_43 n43_7->n43_55 n43_7->n43_33 n43_7->n43_34 n43_7->n20_5 n43_8 #43:join*literal n43_8->n43_27 n43_8->n107_43 n43_8->n43_55 n43_8->n43_33 n43_8->n43_28 n43_31 #43:join_lines n43_8->n43_31 n43_31->n43_26 n43_9 #43:fill n43_9->n43_27 n43_9->n107_43 n43_9->n43_55 n43_9->n43_33 n43_9->n43_28 n43_9->n43_31 n43_57 #43:fill_string n43_9->n43_57 n43_10 #43:pub*lish n43_10->n43_27 n43_10->n107_43 n43_10->n43_55 n43_22 #43:set_readable n43_10->n43_22 n43_22->n43_26 n43_11 #43:w*hat n43_11->n107_43 n43_11->n43_55 n43_11->n43_26 n43_25 #43:working_on n43_11->n43_25 n43_25->n43_26 n43_12 #43:abort n43_12->n107_43 n43_12->n43_25 n43_40 #43:reset_session n43_12->n43_40 n43_13 #43:done n43_12->n43_13 n43_40->n43_26 n43_13->n107_43 n57_9 #57:valid n43_13->n57_9 n6_91 #6:moveto n43_13->n6_91 n20_34 #20:pronoun_sub n43_13->n20_34 n43_14 #43:huh2 n51_39 #51:argstr n43_14->n51_39 n43_15 #43:insertion n43_15->n43_26 n43_16 #43:set_insertion n43_16->n43_26 n43_17 #43:changed n43_17->n43_26 n43_18 #43:set_changed n43_18->n43_26

Showing 48 of 112 verbs; 64 not shown.

Source

say

Spec any any anyFlags rxdOwner #29Definer #43

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 #29Definer #43

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 rxdOwner #29Definer #43

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 rxdOwner #29Definer #43

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 rxdOwner #29Definer #43

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 rxdOwner #29Definer #43

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 #29Definer #43

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

m*ove c*opy

Spec any any anyFlags rxdOwner #29Definer #43

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 rxdOwner #29Definer #43

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 rxdOwner #29Definer #43

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 rxdOwner #29Definer #43

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 #29Definer #43

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 rxdOwner #29Definer #43

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 #29Definer #43

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
9if (!$recycler:valid(origin))
10origin = #317;
11endif
12player:moveto(origin);
13if (player.location == this)
14player:tell("Hmmm... the place you came from doesn't want you back.");
15else
16if (msg = player:self_arrive_msg())
17player.location:announce($su:ps(msg));
18endif
19return;
20endif
21endif
22player:tell("You'll have to use 'home' or a teleporter.");

huh2

Spec this none thisFlags rxdOwner #361Definer #43

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 #29Definer #43

Referenced by

none

Source

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

set_insertion

Spec this none thisFlags rxdOwner #29Definer #43

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 #29Definer #43

Referenced by

Source

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

set_changed

Spec this none thisFlags rxdOwner #29Definer #43

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 #29Definer #43

Referenced by

none

Source

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

set_origin

Spec this none thisFlags rxdOwner #29Definer #43

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 #29Definer #43

Referenced by

Source

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

set_readable

Spec this none thisFlags rxdOwner #29Definer #43

Referenced by

Source

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

text

Spec this none thisFlags rxdOwner #29Definer #43

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 #29Definer #43

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 #29Definer #43

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 #29Definer #43

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 #29Definer #43

Referenced by

Source

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

list_line

Spec this none thisFlags rxdOwner #29Definer #43

Referenced by

Source

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

insert_line

Spec this none thisFlags rxdOwner #29Definer #43

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 #29Definer #43

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 #29Definer #43

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 #29Definer #43

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 #29Definer #43

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 #29Definer #43

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 #29Definer #43

Referenced by

Source

1{cmd, ?recognized_flags = "gcr", ?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 #29Definer #43

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 #29Definer #43

Referenced by

Source

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

new_session

Spec this none thisFlags rxdOwner #361Definer #43

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 #361Definer #43

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 #361Definer #43

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 #361Definer #43

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 #29Definer #43

Referenced by

Source

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

enterfunc

Spec this none thisFlags rxdOwner #29Definer #43

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 #29Definer #43

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 #29Definer #43

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 rxdOwner #29Definer #43

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 rxdOwner #29Definer #43

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 #29Definer #43

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 #361Definer #43

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 #29Definer #43

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 #29Definer #43

Referenced by

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 #29Definer #43

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 #29Definer #43

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 (!is_a(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 #29Definer #43

Referenced by

none

Source

1who = args[1];
2where = {#-1, @this.original}[1 + (who in this.active)];
3wherestr = `where:who_location_msg(who) ! ANY => "An Editor"';
4if (typeof(wherestr) != STR)
5wherestr = "broken who_location_msg";
6endif
7return strsub(this.who_location_msg, "%L", wherestr);
8return $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 #29Definer #43

Referenced by

Source

1return this.(verb);

announce announce_all announce_all_but tell_contents

Spec this none thisFlags rxdOwner #29Definer #43

Referenced by

none

Source

1return;

fill_string

Spec this none thisFlags rxdOwner #29Definer #43

Referenced by

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 #29Definer #43

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 #361Definer #43

Referenced by

none

Source

1return $failed_match;

get_room

Spec this none thisFlags rxdOwner #29Definer #43

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 #361Definer #43

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
18if (player.client)
19notify(player, "#$#/");
20endif

_stateprop_length

Spec this none thisFlags rxdOwner #361Definer #43

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 rxdOwner #361Definer #43

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 #29Definer #43

Referenced by

Source

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

y*ank

Spec any any anyFlags rxdOwner #361Definer #43

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 #29Definer #43

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

s*ubst

Spec any any anyFlags rxdOwner #29Definer #43

Referenced by

none

Source

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

subst_regexp

Spec this none thisFlags rxdOwner #29Definer #43

Referenced by

Source

1"Copied from Domain (#8111):subst_regexp by Mooshie (#106469) Mon Jan  5 19:27:26 1998 PST";
2"Usage: subst_regexp(STR text, STR from string, STR to string, INT case)";
3{text, from, to, case} = args;
4if (m = match(text, from, case))
5{start, end} = m[1..2];
6text[start..end] = substitute(to, m);
7return text;
8else
9return m;
10endif

look_self

Spec this none thisFlags rxdOwner #361Definer #43

Referenced by

none

Source

1player:tell(this:title());
2player:tell_lines(this:description());