Note Editor #48
Aliases: Note Editor, nedit
12 verbs · 41 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
e*dit | any none none | rd | #48 | 5 |
save | any none none | rd | #48 | 27 |
init_session | this none this | rxd | #48 | 6 |
working_on | this none this | rxd | #48 | 12 |
parse_invoke | this none this | rxd | #48 | 12 |
note_text | this none this | rxd | #48 | 15 |
set_note_text | this none this | rxd | #48 | 16 |
note_match_failed | this none this | rxd | #48 | 22 |
w*hat | none none none | rd | #48 | 4 |
mode | any none none | rd | #48 | 23 |
local_editing_info | this none this | rxd | #48 | 5 |
set_* | this none this | rxd | #48 | 5 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
strmode | #48 | r | #36 | {} |
objects | #48 | rc | #36 | {} |
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", "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 | #50 | rc | #36 | {} |
no_text_msg | #50 | rc | #36 | "Note is devoid of text." |
commands | #50 | rc | #36 | {{"e*dit", "<note>"}, {"save", "[<note>]"}, {"mode", "[string|list]"}} |
invoke_task | #50 | r | #36 | 0 |
exit_on_abort | #50 | rc | #36 | <clear> |
previous_session_msg | #50 | rc | #36 | "You need to ABORT or SAVE this note before editing any other." |
stateprops | #50 | r | #36 | {{"strmode", 0}, {"objects", 0}, {"texts", 0}, {"changes", 0}, {"inserting", 1}, {"readable", 0}} |
depart_msg | #50 | rc | #36 | "A small swarm of coffin flies arrives, engulfs %n, and carries %o away." |
return_msg | #50 | rc | #36 | "A small swarm of coffin flies blows in and disperses, revealing %n." |
no_littering_msg | #50 | rc | #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 | #50 | rc | #36 | "Note has not been modified since the last save." |
change_msg | #50 | rc | #36 | "There are changes." |
nothing_loaded_msg | #50 | rc | #36 | "Use the EDIT command to select a note." |
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 notes]" |
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 | 1968131562 |
exits | #3 | c | #36 | {} |
dark | #3 | rc | #36 | <clear> |
ctype | #3 | rc | #36 | <clear> |
key | #1 | c | #36 | <clear> |
aliases | #1 | rc | #36 | {"Note Editor", "nedit"} |
description | #1 | rc | #36 | <clear> |
object_size | #1 | r | #36 | {11434, -1090650497} |
html | #1 | rc | #36 | <clear> |
Ancestry
Ancestors (nearest first): #50 Generic Editor → #3 generic room → #1 Root Class
Children: none
Call graph
Source
e*dit
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
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
Referenced by
- #48:e*dit line 4:
this:init_session
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
Referenced by
- #48:e*dit line 2:
this:working_on - #48:save line 18:
this:working_on - #48:save line 25:
this:working_on - #48:init_session line 5:
this:working_on
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
Referenced by
- #48:e*dit line 3:
this:parse_invoke
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
Referenced by
- #48:parse_invoke line 7:
this:note_text
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
Referenced by
- #48:save line 17:
this:set_note_text
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
Referenced by
- #48:save line 7:
this:note_match_failed - #48:parse_invoke line 6:
this:note_match_failed
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
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
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
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_*
Referenced by
none
Source
1if ($perm_utils:controls(caller_perms(), this)) 2return pass(@args); 3else 4return E_PERM; 5endif