Note Editor #48

Parent #50Owner #36Flags readSource QuestCore.db

Aliases: Note Editor, nedit

12 verbs · 40 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
e*ditany none nonerd#485
saveany none nonerd#4827
init_sessionthis none thisrxd#486
working_onthis none thisrxd#4812
parse_invokethis none thisrxd#4812
note_textthis none thisrxd#4815
set_note_textthis none thisrxd#4816
note_match_failedthis none thisrxd#4822
w*hatnone none nonerd#484
modeany none nonerd#4823
local_editing_infothis none thisrxd#485
set_*this none thisrxd#485

Properties

PropertyDefinerFlagsOwnerValue
strmode#48r#36{}
objects#48rc#36{}
readable#50r#36{}
times#50r#36{}
commands2#50rc#36
list of 2{{"say", "emote", "lis*t", "ins*ert", "n*ext,p*rev", "enter", "del*ete", "f*ind", "s*ubst", "m*ove,c*opy", "join*l", "fill"}, {"y*ank", "w*hat", "mode", "e*dit", "save", "abort", "q*uit,done,pause"}}
help#50rc#36{}
no_text_msg#50rc#36"Note is devoid of text."
commands#50rc#36{{"e*dit", "<note>"}, {"save", "[<note>]"}, {"mode", "[string|list]"}}
invoke_task#50r#360
exit_on_abort#50rc#36<clear>
previous_session_msg#50rc#36"You need to ABORT or SAVE this note before editing any other."
stateprops#50r#36{{"strmode", 0}, {"objects", 0}, {"texts", 0}, {"changes", 0}, {"inserting", 1}, {"readable", 0}}
depart_msg#50rc#36"A small swarm of coffin flies arrives, engulfs %n, and carries %o away."
return_msg#50rc#36"A small swarm of coffin flies blows in and disperses, revealing %n."
no_littering_msg#50rc#36
list of 3{"Partially edited text will be here when you get back.", "To return, give the `@notedit' command with no arguments.", "Please come back and SAVE or ABORT if you don't intend to be working on this text in the immediate future. Keep Our MOO Clean! No Littering!"}
no_change_msg#50rc#36"Note has not been modified since the last save."
change_msg#50rc#36"There are changes."
nothing_loaded_msg#50rc#36"Use the EDIT command to select a note."
texts#50#36{}
active#50r#36{}
changes#50#36{}
inserting#50#36{}
original#50r#36{}
who_location_msg#3rc#36"%L [editing notes]"
free_home#3rc#36<clear>
victim_ejection_msg#3rc#36<clear>
ejection_msg#3rc#36<clear>
oejection_msg#3rc#36<clear>
residents#3rc#36<clear>
free_entry#3rc#361
entrances#3c#36{}
blessed_object#3rc#36#-1
blessed_task#3rc#361968131562
exits#3c#36{}
dark#3rc#36<clear>
ctype#3rc#36<clear>
key#1c#36<clear>
aliases#1rc#36{"Note Editor", "nedit"}
description#1rc#36<clear>
object_size#1r#36{11434, -1090650497}

Ancestry

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

Children: none

Call graph

calls n48_0 #48:e*dit n50_18 #50:changed n48_0->n50_18 n6_18 #6:tell n48_0->n6_18 n48_3 #48:working_on n48_0->n48_3 n48_4 #48:parse_invoke n48_0->n48_4 n48_2 #48:init_session n48_0->n48_2 n48_4->n6_18 n48_7 #48:note_match_failed n48_4->n48_7 n6_79 #6:tell_lines n48_4->n6_79 n48_5 #48:note_text n48_4->n48_5 n48_2->n6_18 n48_2->n48_3 n50_27 #50:ok n48_2->n50_27 n50_25 #50:load n48_2->n50_25 n48_1 #48:save n48_1->n6_18 n48_1->n48_3 n50_28 #50:loaded n48_1->n50_28 n50_56 #50:nothing_loaded_msg n48_1->n50_56 n48_1->n48_7 n50_24 #50:text n48_1->n50_24 n48_6 #48:set_note_text n48_1->n48_6 n50_19 #50:set_changed n48_1->n50_19 n48_7->n6_18 n52_3 #52:has_callable_verb n48_7->n52_3 n59_13 #59:parse_propref n48_7->n59_13 n56_0 #56:object_match_failed n48_7->n56_0 n6_7 #6:my_match_object n48_7->n6_7 n50_61 #50:get_room n48_7->n50_61 n52_0 #52:has_property n48_7->n52_0 n48_6->n52_3 n48_8 #48:w*hat n48_8->n6_18 n48_8->n50_28 n50_12 #50:w*hat n48_8->n50_12 n48_9 #48:mode n48_9->n6_18 n48_9->n50_28 n48_9->n50_56 n48_11 #48:set_* n42_0 #42:controls n48_11->n42_0

Source

e*dit

Spec any none noneFlags rdOwner #36Definer #48

Referenced by

none

Source

1if (this:changed(who = player in this.active))
2player:tell("You are still editing ", this:working_on(who), ".  Please type ABORT or SAVE first.");
3elseif (spec = this:parse_invoke(dobjstr, verb))
4this:init_session(who, @spec);
5endif

save

Spec any none noneFlags rdOwner #36Definer #48

Referenced by

none

Source

1if (!(who = this:loaded(player)))
2player:tell(this:nothing_loaded_msg());
3return;
4endif
5if (!dobjstr)
6note = this.objects[who];
7elseif (1 == (note = this:note_match_failed(dobjstr)))
8return;
9else
10this.objects[who] = note;
11endif
12text = this:text(who);
13strmode = (length(text) <= 1) && this.strmode[who];
14if (strmode)
15text = text ? text[1] | "";
16endif
17if (ERR == typeof(result = this:set_note_text(note, text)))
18player:tell("Text not saved to ", this:working_on(who), ":  ", result);
19if ((result == E_TYPE) && (typeof(note) == OBJ))
20player:tell("Do `mode list' and try saving again.");
21elseif (!dobjstr)
22player:tell("Use `save' with an argument to save the text elsewhere.");
23endif
24else
25player:tell("Text written to ", this:working_on(who), strmode ? " as a single string." | ".");
26this:set_changed(who, 0);
27endif

init_session

Spec this none thisFlags rxdOwner #36Definer #48

Referenced by

Source

1if (this:ok(who = args[1]))
2this.strmode[who] = strmode = typeof(text = args[3]) == STR;
3this:load(who, strmode ? text ? {text} | {} | text);
4this.objects[who] = args[2];
5player:tell("Now editing ", this:working_on(who), ".", strmode ? "  [string mode]" | "");
6endif

working_on

Spec this none thisFlags rxdOwner #36Definer #48

Referenced by

Source

1if (!(who = args[1]))
2return "????";
3endif
4spec = this.objects[who];
5if (typeof(spec) == LIST)
6object = spec[1];
7prop = spec[2];
8else
9object = spec;
10prop = 0;
11endif
12return valid(object) ? tostr("\"", object.name, "\"(", object, ")", prop ? "." + prop | "") | tostr(prop ? ("." + prop) + " on " | "", "invalid object (", object, ")");

parse_invoke

Spec this none thisFlags rxdOwner #36Definer #48

Referenced by

Source

1":parse_invoke(string,verb)";
2" string is the actual commandline string indicating what we are to edit";
3" verb is the command verb that is attempting to invoke the editor";
4if (!(string = args[1]))
5player:tell_lines({("Usage:  " + args[2]) + " <note>   (where <note> is some note object)", ("        " + args[2]) + "          (continues editing an unsaved note)"});
6elseif (1 == (note = this:note_match_failed(string)))
7elseif (ERR == typeof(text = this:note_text(note)))
8player:tell("Couldn't retrieve text:  ", text);
9else
10return {note, text};
11endif
12return 0;

note_text

Spec this none thisFlags rxdOwner #2Definer #48

Referenced by

Source

1"WIZARDLY";
2if ((caller != $note_editor) || (caller_perms() != $note_editor.owner))
3return E_PERM;
4endif
5set_task_perms(player);
6if (typeof(spec = args[1]) == OBJ)
7text = spec:text();
8else
9text = `spec[1].(spec[2]) ! ANY';
10endif
11if (((tt = typeof(text)) in {ERR, STR}) || ((tt == LIST) && ((!text) || (typeof(text[1]) == STR))))
12return text;
13else
14return E_TYPE;
15endif

set_note_text

Spec this none thisFlags rxdOwner #2Definer #48

Referenced by

Source

1"WIZARDLY";
2if ((caller != $note_editor) || (caller_perms() != $note_editor.owner))
3return E_PERM;
4endif
5set_task_perms(player);
6attempt = E_NONE;
7if (typeof(spec = args[1]) == OBJ)
8return spec:set_text(args[2]);
9elseif ($object_utils:has_callable_verb(spec[1], "set_" + spec[2]))
10attempt = spec[1]:("set_" + spec[2])(args[2]);
11endif
12if (typeof(attempt) == ERR)
13return `spec[1].(spec[2]) = args[2] ! ANY';
14else
15return attempt;
16endif

note_match_failed

Spec this none thisFlags rxdOwner #36Definer #48

Referenced by

Source

1if (pp = $code_utils:parse_propref(string = args[1]))
2object = pp[1];
3prop = pp[2];
4else
5object = string;
6prop = 0;
7endif
8if ($command_utils:object_match_failed(note = player:my_match_object(object, this:get_room(player)), object))
9elseif (prop)
10if (!$object_utils:has_property(note, prop))
11player:tell(object, " has no \".", prop, "\" property.");
12else
13return {note, prop};
14endif
15elseif ((!$object_utils:has_callable_verb(note, "text")) || (!$object_utils:has_callable_verb(note, "set_text")))
16return {note, "description"};
17"... what we used to do.  but why barf?   that's no fun...";
18player:tell(object, "(", note, ") doesn't look like a note.");
19else
20return note;
21endif
22return 1;

w*hat

Spec none none noneFlags rdOwner #36Definer #48

Referenced by

none

Source

1pass(@args);
2if ((who = this:loaded(player)) && this.strmode[who])
3player:tell("Text will be stored as a single string instead of a list when possible.");
4endif

mode

Spec any none noneFlags rdOwner #36Definer #48

Referenced by

none

Source

1"mode [string|list]";
2if (!(who = this:loaded(player)))
3player:tell(this:nothing_loaded_msg());
4return;
5endif
6if (dobjstr && (index("string", dobjstr) == 1))
7this.strmode[who] = mode = 1;
8player:tell("Now in string mode:");
9elseif (dobjstr && (index("list", dobjstr) == 1))
10this.strmode[who] = mode = 0;
11player:tell("Now in list mode:");
12elseif (dobjstr)
13player:tell("Unrecognized mode:  ", dobjstr);
14player:tell("Should be one of `string' or `list'");
15return;
16else
17player:tell("Currently in ", mode = this.strmode[who] ? "string " | "list ", "mode:");
18endif
19if (mode)
20player:tell("  store text as a single string instead of a list when possible.");
21else
22player:tell("  always store text as a list of strings.");
23endif

local_editing_info

Spec this none thisFlags rxdOwner #36Definer #48

Referenced by

none

Source

1{what, text} = args;
2cmd = (typeof(text) == STR) ? "@set-note-string" | "@set-note-text";
3name = (typeof(what) == OBJ) ? what.name | tostr(what[1].name, ".", what[2]);
4note = (typeof(what) == OBJ) ? what | tostr(what[1], ".", what[2]);
5return {name, text, tostr(cmd, " ", note)};

set_*

Spec this none thisFlags rxdOwner #36Definer #48

Referenced by

none

Source

1if ($perm_utils:controls(caller_perms(), this))
2return pass(@args);
3else
4return E_PERM;
5endif