Generic Editor #50
Aliases: Generic Editor, gedit, edit
69 verbs · 39 properties · 3 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
say | any any any | rxd | #50 | 8 |
emote | any any any | rxd | #50 | 8 |
enter | any none none | rd | #50 | 10 |
lis*t view | any any any | rd | #50 | 58 |
ins*ert n*ext p*revious . | any none none | rd | #50 | 39 |
del*ete | any any any | rd | #50 | 16 |
f*ind | any any any | rxd | #50 | 24 |
s*ubst | any any any | rxd | #50 | 46 |
m*ove c*opy | any any any | rd | #50 | 55 |
join*literal | any any any | rd | #50 | 11 |
fill | any any any | rd | #50 | 24 |
pub*lish perish unpub*lish depub*lish | none none none | rd | #50 | 11 |
w*hat | none none none | rxd | #50 | 10 |
abort | none none none | rd | #50 | 9 |
done q*uit pause | none none none | rxd | #50 | 19 |
huh2 | this none this | rxd | #50 | 21 |
insertion | this none this | rxd | #50 | 1 |
set_insertion | this none this | rxd | #50 | 1 |
changed retain_session_on_exit | this none this | rxd | #50 | 1 |
set_changed | this none this | rxd | #50 | 1 |
origin | this none this | rxd | #50 | 1 |
set_origin | this none this | rxd | #50 | 1 |
readable | this none this | rxd | #50 | 1 |
set_readable | this none this | rxd | #50 | 1 |
text | this none this | rxd | #50 | 2 |
load | this none this | rxd | #50 | 13 |
working_on | this none this | rxd | #50 | 2 |
ok | this none this | rxd | #50 | 8 |
loaded | this none this | rxd | #50 | 1 |
list_line | this none this | rxd | #50 | 6 |
insert_line | this none this | rxd | #50 | 35 |
append_line | this none this | rxd | #50 | 24 |
join_lines | this none this | rxd | #50 | 29 |
parse_number | this none this | rxd | #50 | 25 |
parse_range | this none this | rxd | #50 | 61 |
parse_insert | this none this | rxd | #50 | 30 |
parse_subst | this none this | rxd | #50 | 15 |
invoke | this none this | rxd | #50 | 44 |
suck_in | this none this | rxd | #50 | 21 |
new_session | this none this | rxd | #50 | 24 |
kill_session | this none this | rxd | #50 | 9 |
reset_session | this none this | rxd | #50 | 10 |
kill_all_sessions | this none this | rxd | #50 | 13 |
acceptable | this none this | rxd | #50 | 1 |
enterfunc | this none this | rxd | #50 | 13 |
exitfunc | this none this | rxd | #50 | 9 |
@flush | this any any | rxd | #50 | 33 |
@stateprop | any for/about this | rd | #50 | 24 |
@rmstateprop | any out of/from inside/from this | rd | #50 | 7 |
initialize | this none this | rxd | #50 | 4 |
init_for_core | this none this | rxd | #50 | 10 |
set_stateprops | this none this | rxd | #50 | 25 |
description | this none this | rxd | #50 | 38 |
commands_info | this none this | rxd | #50 | 8 |
match_object | this none this | rxd | #50 | 8 |
who_location_msg | this none this | rxd | #50 | 4 |
nothing_loaded_msg no_text_msg change_msg no_change_msg no_littering_msg depart_msg return_msg previous_session_msg | this none this | rxd | #50 | 1 |
announce announce_all announce_all_but tell_contents | this none this | rxd | #50 | 1 |
fill_string(noansi) | this none this | rxd | #50 | 48 |
here_huh | this none this | rxd | #50 | 22 |
match | this none this | rxd | #50 | 1 |
get_room | this none this | rxd | #50 | 13 |
invoke_local_editor | this none this | rxd | #50 | 17 |
_stateprop_length | this none this | rxd | #50 | 6 |
print | none none none | rd | #50 | 7 |
accept | this none this | rxd | #50 | 1 |
y*ank | any any any | rd | #50 | 82 |
do_flush | this none this | rxd | #50 | 14 |
fill_string | this none this | rx | #50 | 5 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
readable | #50 | r | #36 | {} |
times | #50 | r | #36 | {} |
commands2 | #50 | rc | #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 | #50 | rc | #36 | #44 |
no_text_msg | #50 | rc | #36 | "There are no lines of text." |
commands | #50 | rc | #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 | #50 | r | #36 | 0 |
exit_on_abort | #50 | rc | #36 | 0 |
previous_session_msg | #50 | rc | #36 | "" |
stateprops | #50 | r | #36 | {{"texts", 0}, {"changes", 0}, {"inserting", 1}, {"readable", 0}} |
depart_msg | #50 | rc | #36 | "%N heads off to the Generic Editing Room." |
return_msg | #50 | rc | #36 | "%N comes back from the Generic Editing Room." |
no_littering_msg | #50 | rc | #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 | #50 | rc | #36 | "There have been no changes since the last save." |
change_msg | #50 | rc | #36 | "Text has been altered since the last save." |
nothing_loaded_msg | #50 | rc | #36 | "You're not currently editing anything." |
texts | #50 | | #36 | {} |
active | #50 | r | #36 | {} |
changes | #50 | | #36 | {} |
inserting | #50 | | #36 | {} |
original | #50 | r | #36 | {} |
who_location_msg | #3 | rc | #36 | "%L [editing]" |
free_home | #3 | rc | #36 | <clear> |
victim_ejection_msg | #3 | rc | #36 | <clear> |
ejection_msg | #3 | rc | #36 | <clear> |
oejection_msg | #3 | rc | #36 | <clear> |
residents | #3 | rc | #36 | <clear> |
free_entry | #3 | rc | #36 | 1 |
entrances | #3 | c | #36 | {} |
blessed_object | #3 | rc | #36 | #-1 |
blessed_task | #3 | rc | #36 | 1397392137 |
exits | #3 | c | #36 | <clear> |
dark | #3 | rc | #36 | <clear> |
ctype | #3 | rc | #36 | <clear> |
key | #1 | c | #36 | <clear> |
aliases | #1 | rc | #36 | {"Generic Editor", "gedit", "edit"} |
description | #1 | rc | #36 | {} |
object_size | #1 | r | #36 | {56919, -1090650497} |
html | #1 | rc | #36 | <clear> |
Ancestry
Ancestors (nearest first): #3 generic room → #1 Root Class
Children: #47 Mail Room, #48 Note Editor, #49 Verb Editor
Call graph
Showing 48 of 110 verbs; 62 not shown.
Source
say
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
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
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
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 .
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
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
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
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
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
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
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
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
Referenced by
- #48:w*hat line 1:
pass(
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
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
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
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
Referenced by
none
Source
1return this:ok(who = args[1]) && this.inserting[who];
set_insertion
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
Referenced by
- #47:send line 42:
this:changed - #47:retain_session_on_exit line 1:
pass( - #47:no_littering_msg line 2:
this:changed - #48:e*dit line 1:
this:changed - #50:invoke line 9:
this:changed - #50:exitfunc line 2:
this:retain_session_on_exit
Source
1return this:ok(who = args[1]) && this.changes[who];
set_changed
Referenced by
- #47:set_subject line 5:
this:set_changed - #47:sending line 7:
this:set_changed - #47:to*: line 7:
this:set_changed - #47:also*-to: line 5:
this:set_changed - #47:not-to*: line 34:
this:set_changed - #47:reply-to*: line 6:
this:set_changed - #47:send line 11:
this:set_changed - #47:send line 29:
this:set_changed - #47:send line 32:
this:set_changed - #48:save line 26:
this:set_changed - #49:com*pile line 77:
this:set_changed
Source
1return this:ok(who = args[1]) && (((unchanged = !args[2]) || (this.times[who] = time())) && (this.changes[who] = !unchanged));
origin
Referenced by
none
Source
1return this:ok(who = args[1]) && this.original[who];
set_origin
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
Referenced by
- #47:pri*nt line 6:
this:readable - #47:message_with_headers line 1:
this:readable - #50:lis*t line 19:
this:readable - #50:text line 2:
this:readable
Source
1return (((who = args[1]) < 1) || (who > length(this.active))) ? E_RANGE | this.readable[who];
set_readable
Referenced by
- #50:pub*lish line 5:
this:set_readable
Source
1return this:ok(who = args[1]) && (this.readable[who] = !(!args[2]));
text
Referenced by
- #47:message_with_headers line 1:
this:text - #48:save line 12:
this:text - #49:com*pile line 55:
this:text - #49:com*pile line 59:
this:text - #50:print line 1:
this:text
Source
1{?who = player in this.active} = args; 2return (this:readable(who) || this:ok(who)) && this.texts[who];
load
Referenced by
- #47:init_session line 7:
this:load - #48:init_session line 3:
this:load - #49:init_session line 3:
this:load
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
Referenced by
- #50:w*hat line 4:
this:working_on - #50:abort line 4:
this:working_on - #50:invoke line 12:
this:working_on - #50:invoke line 16:
this:working_on - #50:invoke line 24:
this:working_on - #50:invoke line 27:
this:working_on - #50:enterfunc line 10:
this:working_on
Source
1"Dummy routine. The child editor should provide something informative"; 2return this:ok(who = args[1]) && (("something [in " + this.name) + "]");
ok
Referenced by
- #47:working_on line 1:
this:ok - #47:init_session line 2:
this:ok - #47:message_with_headers line 1:
this:ok - #47:set_subject line 1:
this:ok - #47:sending line 1:
this:ok - #47:recipient_names line 1:
this:ok - #47:retain_session_on_exit line 1:
this:ok - #47:no_littering_msg line 2:
this:ok - #48:init_session line 1:
this:ok - #49:working_on line 1:
this:ok - #49:init_session line 2:
this:ok - #50:w*hat line 1:
this:ok - #50:insertion line 1:
this:ok - #50:set_insertion line 1:
this:ok - #50:changed line 1:
this:ok - #50:set_changed line 1:
this:ok - #50:origin line 1:
this:ok - #50:set_origin line 1:
this:ok - #50:set_readable line 1:
this:ok - #50:text line 2:
this:ok - #50:load line 2:
this:ok - #50:working_on line 2:
this:ok - #50:list_line line 2:
this:ok - #50:insert_line line 8:
this:ok - #50:append_line line 8:
this:ok - #50:join_lines line 2:
this:ok - #50:parse_number line 3:
this:ok - #50:parse_range line 3:
this:ok - #50:parse_insert line 2:
this:ok - #50:kill_session line 2:
this:ok - #50:reset_session line 2:
this:ok
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
Referenced by
- #47:subj*ect: line 1:
this:loaded - #47:to*: line 1:
this:loaded - #47:also*-to: line 1:
this:loaded - #47:not-to*: line 1:
this:loaded - #47:reply-to*: line 1:
this:loaded - #47:send line 2:
this:loaded - #47:who line 8:
this:loaded - #48:save line 1:
this:loaded - #48:w*hat line 2:
this:loaded - #48:mode line 2:
this:loaded - #49:com*pile line 2:
this:loaded - #49:comment line 6:
this:loaded - #49:uncomment line 6:
this:loaded - #50:say line 4:
this:loaded - #50:emote line 4:
this:loaded - #50:enter line 1:
this:loaded - #50:enter line 9:
this:loaded - #50:lis*t line 19:
this:loaded - #50:lis*t line 24:
this:loaded - #50:lis*t line 49:
this:loaded - #50:ins*ert line 17:
this:loaded - #50:del*ete line 1:
this:loaded - #50:f*ind line 4:
this:loaded - #50:s*ubst line 4:
this:loaded - #50:m*ove line 2:
this:loaded - #50:join*literal line 1:
this:loaded - #50:fill line 2:
this:loaded - #50:pub*lish line 1:
this:loaded - #50:invoke line 9:
this:loaded - #50:enterfunc line 9:
this:loaded - #50:y*ank line 23:
this:loaded - #50:y*ank line 39:
this:loaded - #50:y*ank line 48:
this:loaded - #50:y*ank line 59:
this:loaded - #50:y*ank line 81:
this:loaded
Source
1return ((who = args[1] in this.active) && (typeof(this.texts[who]) == LIST)) && who;
list_line
Referenced by
- #50:lis*t line 46:
this:list_line - #50:ins*ert line 33:
this:list_line - #50:ins*ert line 36:
this:list_line - #50:f*ind line 22:
this:list_line - #50:s*ubst line 43:
this:list_line - #50:join*literal line 10:
this:list_line - #50:fill line 19:
this:list_line
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
Referenced by
- #47:init_session line 16:
this:insert_line - #50:say line 7:
this:insert_line - #50:enter line 9:
this:insert_line - #50:ins*ert line 30:
this:insert_line - #50:append_line line 11:
this:insert_line - #50:y*ank line 23:
this:insert_line - #50:y*ank line 39:
this:insert_line - #50:y*ank line 48:
this:insert_line - #50:y*ank line 59:
this:insert_line - #50:y*ank line 81:
this:insert_line
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
Referenced by
- #50:emote line 7:
this:append_line
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
Referenced by
- #50:join*literal line 7:
this:join_lines - #50:fill line 9:
this:join_lines
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
Referenced by
- #50:parse_range line 24:
this:parse_number - #50:parse_range line 29:
this:parse_number - #50:parse_range line 37:
this:parse_number - #50:parse_range line 38:
this:parse_number - #50:parse_range line 40:
this:parse_number - #50:parse_range line 42:
this:parse_number
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
Referenced by
- #49:comment line 8:
this:parse_range - #49:uncomment line 8:
this:parse_range - #50:lis*t line 38:
this:parse_range - #50:del*ete line 3:
this:parse_range - #50:s*ubst line 8:
this:parse_range - #50:m*ove line 18:
this:parse_range - #50:join*literal line 3:
this:parse_range - #50:fill line 4:
this:parse_range - #50:parse_range line 10:
this:parse_range
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
Referenced by
- #50:ins*ert line 19:
this:parse_insert - #50:f*ind line 8:
this:parse_insert - #50:m*ove line 12:
this:parse_insert
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
Referenced by
- #50:f*ind line 6:
this:parse_subst - #50:s*ubst line 6:
this:parse_subst
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
Referenced by
- #6:@notedit line 1:
$note_editor:invoke - #6:@edit line 6:
$verb_editor:invoke - #6:@edit line 13:
$note_editor:invoke - #40:@send line 12:
$mail_editor:invoke - #40:@answer line 10:
$mail_editor:invoke - #40:@gripe line 1:
$mail_editor:invoke - #40:@typo line 17:
$mail_editor:invoke - #40:@quickr*eply line 29:
$mail_editor:invoke - #40:@quick*send line 46:
$mail_editor:invoke - #49:e*dit line 4:
this:invoke - #104:@edit-d*etail line 8:
$note_editor:invoke - #118:@vdig line 66:
$note_editor:invoke
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
Referenced by
- #50:invoke line 11:
this:suck_in - #50:invoke line 26:
this:suck_in - #50:invoke line 41:
this:suck_in
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
Referenced by
- #50:accept line 1:
this:new_session
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
Referenced by
- #47:send line 44:
this:kill_session - #50:invoke line 35:
this:kill_session - #50:exitfunc line 7:
this:kill_session - #50:do_flush line 11:
this:kill_session
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
Referenced by
- #50:abort line 6:
this:reset_session
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
Referenced by
- #50:@flush line 13:
this:kill_all_sessions - #50:initialize line 3:
this:kill_all_sessions - #50:init_for_core line 3:
this:kill_all_sessions
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
Referenced by
- #50:accept line 1:
this:acceptable
Source
1return is_player(who_obj = args[1]) && (who_obj.wizard || pass(@args));
enterfunc
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
Referenced by
- #50:suck_in line 17:
this:exitfunc
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
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
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
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
Referenced by
none
Source
1if ($perm_utils:controls(caller_perms(), this)) 2pass(@args); 3this:kill_all_sessions(); 4endif
init_for_core
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
Referenced by
- #50:@stateprop line 20:
this:set_stateprops - #50:@rmstateprop line 3:
this:set_stateprops
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
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
Referenced by
- #50:description line 13:
this:commands_info
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
Referenced by
- #50:match_object line 5:
origin:match_object
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
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
Referenced by
- #47:subj*ect: line 2:
this:nothing_loaded_msg - #47:to*: line 2:
this:nothing_loaded_msg - #47:also*-to: line 2:
this:nothing_loaded_msg - #47:not-to*: line 2:
this:nothing_loaded_msg - #47:reply-to*: line 2:
this:nothing_loaded_msg - #47:send line 3:
this:nothing_loaded_msg - #47:who line 9:
this:nothing_loaded_msg - #48:save line 2:
this:nothing_loaded_msg - #48:mode line 3:
this:nothing_loaded_msg - #49:com*pile line 3:
this:nothing_loaded_msg - #49:comment line 7:
this:nothing_loaded_msg - #49:uncomment line 7:
this:nothing_loaded_msg - #50:say line 5:
this:nothing_loaded_msg - #50:emote line 5:
this:nothing_loaded_msg - #50:enter line 2:
this:nothing_loaded_msg - #50:lis*t line 25:
this:nothing_loaded_msg - #50:ins*ert line 18:
this:nothing_loaded_msg - #50:del*ete line 2:
this:nothing_loaded_msg - #50:f*ind line 5:
this:nothing_loaded_msg - #50:s*ubst line 5:
this:nothing_loaded_msg - #50:m*ove line 3:
this:nothing_loaded_msg - #50:join*literal line 2:
this:nothing_loaded_msg - #50:fill line 3:
this:nothing_loaded_msg - #50:pub*lish line 2:
this:nothing_loaded_msg - #50:w*hat line 2:
this:nothing_loaded_msg - #50:w*hat line 6:
this:change_msg - #50:w*hat line 6:
this:no_change_msg - #50:done line 13:
this:return_msg - #50:parse_range line 6:
this:no_text_msg - #50:invoke line 17:
this:previous_session_msg - #50:invoke line 28:
this:previous_session_msg - #50:suck_in line 9:
this:depart_msg - #50:enterfunc line 11:
this:nothing_loaded_msg - #50:exitfunc line 3:
this:no_littering_msg
Source
1return this.(verb);
announce announce_all announce_all_but tell_contents
Referenced by
none
Source
1return;
fill_string(noansi)
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
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
Referenced by
none
Source
1return $failed_match;
get_room
Referenced by
- #48:note_match_failed line 8:
this:get_room - #49:com*pile line 23:
this:get_room - #49:parse_invoke line 23:
this:get_room
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
Referenced by
- #50:invoke line 40:
this:invoke_local_editor
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
Referenced by
- #50:set_stateprops line 18:
this:_stateprop_length
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
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
Referenced by
- #50:enterfunc line 3:
this:accept
Source
1return this:acceptable(who_obj = args[1]) && this:new_session(who_obj, who_obj.location);
y*ank
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
Referenced by
- #50:@flush line 31:
this:do_flush
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
Referenced by
- #6:@registerme line 45:
$generic_editor:fill_string - #6:@users line 4:
$generic_editor:fill_string - #10:check_for_shutdown line 10:
$generic_editor:fill_string - #10:check_player_db line 6:
$generic_editor:fill_string - #10:check_player_db line 10:
$generic_editor:fill_string - #10:request_character line 18:
$generic_editor:fill_string - #10:request_character line 37:
$generic_editor:fill_string - #10:req*uest line 6:
$generic_editor:fill_string - #40:receive_message line 18:
$generic_editor:fill_string - #40:format_for_netforward line 16:
$generic_editor:fill_string - #40:format_for_netforward_debug line 16:
$generic_editor:fill_string - #45:look_self line 39:
$generic_editor:fill_string - #45:@register line 34:
$generic_editor:fill_string - #47:parse_invoke line 34:
this:fill_string - #50:fill line 10:
this:fill_string - #57:@shutdown line 31:
$generic_editor:fill_string - #95:confunc line 14:
$generic_editor:fill_string - #95:@ansi-s*tatus line 92:
$generic_editor:fill_string - #95:@ansi-title line 29:
$generic_editor:fill_string - #96:ansi_log line 8:
$generic_editor:fill_string
Source
1if (valid(au = $ansi_utils) && au.active) 2return au:(verb)(@args); 3else 4return this:(verb + "(noansi)")(@args); 5endif