Verb Editor #49
Aliases: Verb Editor, vedit, verbedit, verb edit
12 verbs · 40 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
e*dit | any none none | rd | #49 | 5 |
com*pile save | none any any | rd | #49 | 82 |
working_on | this none this | rxd | #49 | 12 |
init_session | this none this | rxd | #49 | 8 |
parse_invoke | this none this | rxd | #49 | 42 |
fetch_verb_code | this none this | rxd | #49 | 7 |
set_verb_code | this none this | rxd | #49 | 7 |
local_editing_info | this none this | rxd | #49 | 20 |
verb_name | this none this | rxd | #49 | 16 |
verb_args | this none this | rxd | #49 | 9 |
comment | any any any | rd | #49 | 26 |
uncomment | any any any | rd | #49 | 35 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
objects | #49 | | #36 | {} |
verbnames | #49 | | #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", "e*dit", "com*pile", "abort", "q*uit,done,pause"}} |
help | #50 | rc | #36 | {} |
no_text_msg | #50 | rc | #36 | "Verb body is empty." |
commands | #50 | rc | #36 | {{"e*dit", "<obj>:<verb>"}, {"com*pile", "[as <obj>:<verb>]"}} |
invoke_task | #50 | r | #36 | 0 |
exit_on_abort | #50 | rc | #36 | <clear> |
previous_session_msg | #50 | rc | #36 | "You need to either COMPILE or ABORT this verb before you can start on another." |
stateprops | #50 | r | #36 | {{"objects", 0}, {"verbnames", 0}, {"texts", 0}, {"changes", 0}, {"inserting", 1}, {"readable", 0}} |
depart_msg | #50 | rc | #36 | "You hear a mighty woosh, then see a swirl of colors never before described! As %n %<is/are> drawn into it, %s %<dissappears> into nothingness." |
return_msg | #50 | rc | #36 | "The abominable stench of marsh gases overwhelms you as %n %<fades> into view, shoving %r away from an invisible, unspeakable horror." |
no_littering_msg | #50 | rc | #36 | list of 3{"Keeping your verb for later work. ", "To return, give the `@edit' command with no arguments.", "Please come back and COMPILE or ABORT if you don't intend to be working on this verb in the immediate future. Keep Our MOO Clean! No Littering!"} |
no_change_msg | #50 | rc | #36 | "The verb has no pending changes." |
change_msg | #50 | rc | #36 | "You have changed the verb since last successful compile." |
nothing_loaded_msg | #50 | rc | #36 | "First, you have to select a verb to edit with the EDIT command." |
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 verbs]" |
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 | 1639500112 |
exits | #3 | c | #36 | {} |
dark | #3 | rc | #36 | <clear> |
ctype | #3 | rc | #36 | <clear> |
key | #1 | c | #36 | <clear> |
aliases | #1 | rc | #36 | {"Verb Editor", "vedit", "verbedit", "verb edit"} |
description | #1 | rc | #36 | <clear> |
object_size | #1 | r | #36 | {15587, -1090650497} |
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 (!args) 2player:tell("edit what?"); 3else 4this:invoke(argstr, verb); 5endif
com*pile save
Referenced by
none
Source
1pas = {{}, {}}; 2if (!(who = this:loaded(player))) 3player:tell(this:nothing_loaded_msg()); 4return; 5elseif (!args) 6object = this.objects[who]; 7vname = this.verbnames[who]; 8if (typeof(vname) == LIST) 9vargs = listdelete(vname, 1); 10vname = vname[1]; 11else 12vargs = {}; 13endif 14changeverb = 0; 15elseif ((args[1] != "as") || ((length(args) < 2) || ((!(spec = $code_utils:parse_verbref(args[2]))) || ((typeof(pas = $code_utils:parse_argspec(@args[3..$])) != LIST) || pas[2])))) 16if (typeof(pas) != LIST) 17player:tell(pas); 18elseif (pas[2]) 19player:tell("I don't understand \"", $string_utils:from_list(pas[2], " "), "\""); 20endif 21player:tell("Usage: ", verb, " [as <object>:<verb>]"); 22return; 23elseif ($command_utils:object_match_failed(object = player:my_match_object(spec[1], this:get_room(player)), spec[1])) 24return; 25else 26vname = spec[2]; 27vargs = pas[1] && {@pas[1], "none", "none"}[1..3]; 28if (vargs) 29vargs[2] = $code_utils:full_prep(vargs[2]) || vargs[2]; 30endif 31changeverb = 1; 32endif 33if (vargs) 34vnum = $code_utils:find_verb_named(object, vname); 35while (vnum && (verb_args(object, vnum) != vargs)) 36vnum = $code_utils:find_verb_named(object, vname, vnum + 1); 37endwhile 38if (!vnum) 39player:tell("There is no ", object, ":", vname, " verb with args (", $string_utils:from_list(vargs, " "), ")."); 40if (!changeverb) 41player:tell("Use 'compile as ...' to write your code to another verb."); 42endif 43return; 44endif 45objverbname = tostr(object, ":", vname, " (", $string_utils:from_list(vargs, " "), ")"); 46else 47vnum = 0; 48objverbname = tostr(object, ":", ($code_utils:toint(vname) == E_TYPE) ? vname | this:verb_name(object, vname)); 49endif 50"..."; 51"...perform eval_subs on verb code if necessary..."; 52"..."; 53if (player.eval_subs && player:edit_option("eval_subs")) 54verbcode = {}; 55for x in (this:text(who)) 56verbcode = {@verbcode, $code_utils:substitute(x, player.eval_subs)}; 57endfor 58else 59verbcode = this:text(who); 60endif 61"..."; 62"...write it out..."; 63"..."; 64if (result = this:set_verb_code(object, vnum ? vnum | vname, verbcode)) 65player:tell(objverbname, " not compiled because:"); 66for x in (result) 67player:tell(" ", x); 68endfor 69elseif (typeof(result) == ERR) 70player:tell({result, ("You do not have write permission on " + objverbname) + ".", ("The verb " + objverbname) + " does not exist (!?!)", ("The object " + tostr(object)) + " does not exist (!?!)"}[1 + (result in {E_PERM, E_VERBNF, E_INVARG})]); 71if (!changeverb) 72player:tell("Do 'compile as <object>:<verb>' to write your code to another verb."); 73endif 74changeverb = 0; 75else 76player:tell(objverbname, verbcode ? " successfully compiled." | " verbcode removed."); 77this:set_changed(who, 0); 78endif 79if (changeverb) 80this.objects[who] = object; 81this.verbnames[who] = vargs ? {vname, @vargs} | vname; 82endif
working_on
Referenced by
- #49:init_session line 6:
this:working_on
Source
1if (!(fuckup = this:ok(who = args[1]))) 2return fuckup; 3else 4object = this.objects[who]; 5verbname = this.verbnames[who]; 6if (typeof(verbname) == LIST) 7return tostr(object, ":", verbname[1], " (", $string_utils:from_list(listdelete(verbname, 1), " "), ")"); 8else 9return tostr(object, ":", this:verb_name(object, verbname), " (", this:verb_args(object, verbname), ")"); 10endif 11endif 12"return this:ok(who = args[1]) && tostr(this.objects[who]) + \":\" + this.verbnames[who];";
init_session
Referenced by
none
Source
1{who, object, vname, vcode} = args; 2if (this:ok(who)) 3this:load(who, vcode); 4this.verbnames[who] = vname; 5this.objects[who] = object; 6this.active[who]:tell("Now editing ", this:working_on(who), "."); 7"this.active[who]:tell(\"Now editing \", object, \":\", vname, \".\");"; 8endif
parse_invoke
Referenced by
none
Source
1":parse_invoke(string,v)"; 2" string is the commandline string to parse to obtain the obj:verb to edit"; 3" v is the actual command verb used to invoke the editor"; 4" => {object, verbname, verb_code} or error"; 5vref = $string_utils:words(args[1]); 6if ((!vref) || (!(spec = $code_utils:parse_verbref(vref[1])))) 7player:tell("Usage: ", args[2], " object:verb"); 8return; 9endif 10if (argspec = listdelete(vref, 1)) 11if (typeof(pas = $code_utils:parse_argspec(@argspec)) == LIST) 12if (pas[2]) 13player:tell("I don't understand \"", $string_utils:from_list(pas[2], " "), "\""); 14return; 15endif 16argspec = {@pas[1], "none", "none"}[1..3]; 17argspec[2] = $code_utils:full_prep(argspec[2]) || argspec[2]; 18else 19player:tell(pas); 20return; 21endif 22endif 23if (!$command_utils:object_match_failed(object = player:my_match_object(spec[1], this:get_room(player)), spec[1])) 24vnum = $code_utils:find_verb_named(object, vname = spec[2]); 25if (argspec) 26while (vnum && (verb_args(object, vnum) != argspec)) 27vnum = $code_utils:find_verb_named(object, vname, vnum + 1); 28endwhile 29endif 30if (vnum) 31code = this:fetch_verb_code(object, vnum); 32else 33code = E_VERBNF; 34endif 35if (typeof(code) == ERR) 36player:tell((code != E_VERBNF) ? code | "That object does not define that verb", argspec ? " with those args." | "."); 37return code; 38else 39return {object, argspec ? {vname, @argspec} | vname, code}; 40endif 41endif 42return 0;
fetch_verb_code
Referenced by
- #49:parse_invoke line 31:
this:fetch_verb_code
Source
1"WIZARDLY"; 2if ((caller != $verb_editor) || (caller_perms() != $verb_editor.owner)) 3return E_PERM; 4else 5set_task_perms(player); 6return `verb_code(args[1], args[2], !player:edit_option("no_parens")) ! ANY'; 7endif
set_verb_code
Referenced by
- #49:com*pile line 64:
this:set_verb_code
Source
1"WIZARDLY"; 2if ((caller != $verb_editor) || (caller_perms() != $verb_editor.owner)) 3return E_PERM; 4else 5set_task_perms(player); 6return `set_verb_code(args[1], args[2], args[3]) ! ANY'; 7endif
local_editing_info
Referenced by
none
Source
1if (caller == $verb_editor) 2set_task_perms(player); 3endif 4{object, vname, code} = args; 5if (typeof(vname) == LIST) 6vargs = tostr(" ", vname[2], " ", $code_utils:short_prep(vname[3]), " ", vname[4]); 7vname = vname[1]; 8else 9vargs = ""; 10endif 11name = tostr(object.name, ":", vname); 12"... so the next 2 lines are actually wrong, since verb_info won't"; 13"... necessarily retrieve the correct verb if we have more than one"; 14"... matching the given same name; anyway, if parse_invoke understood vname,"; 15"... so will @program. I suspect these were put here because in the"; 16"... old scheme of things, vname was always a number."; 17"vname = strsub($string_utils:explode(verb_info(object, vname)[3])[1], \"*\", \"\")"; 18"vargs = verb_args(object, vname)"; 19""; 20return {name, code, tostr("@program ", object, ":", vname, vargs)};
verb_name
Referenced by
- #49:com*pile line 48:
this:verb_name - #49:working_on line 9:
this:verb_name
Source
1"verb_name(object, vname)"; 2"Find vname on object and return its full name (quoted)."; 3"This is useful for when we're working with verb numbers."; 4if ((caller != $verb_editor) || (caller_perms() != $verb_editor.owner)) 5return E_PERM; 6else 7set_task_perms(player); 8given = args[2]; 9if (typeof(info = `verb_info(args[1], given) ! ANY') == ERR) 10return tostr(given, "[", info, "]"); 11elseif (info[3] == given) 12return given; 13else 14return tostr(given, "/\"", info[3], "\""); 15endif 16endif
verb_args
Referenced by
- #49:working_on line 9:
this:verb_args
Source
1"verb_name(object, vname)"; 2"Find vname on object and return its full name (quoted)."; 3"This is useful for when we're working with verb numbers."; 4if ((caller != $verb_editor) || (caller_perms() != $verb_editor.owner)) 5return E_PERM; 6else 7set_task_perms(player); 8return $string_utils:from_list(`verb_args(args[1], args[2]) ! ANY', " "); 9endif
comment
Referenced by
none
Source
1"Syntax: comment [<range>]"; 2""; 3"Turns the specified range of lines, into comments."; 4if ((caller != player) && (caller_perms() != player)) 5return E_PERM; 6elseif (!(who = this:loaded(player))) 7player:tell(this:nothing_loaded_msg()); 8elseif (typeof(range = this:parse_range(who, {"."}, @args)) != LIST) 9player:tell(tostr(range)); 10elseif (range[3]) 11player:tell_lines($code_utils:verb_documentation()); 12else 13text = this.texts[who]; 14{from, to, crap} = range; 15cut = $maxint; 16for line in [from..to] 17cut = min(cut, `match(text[line], "[^ ]")[1] ! E_RANGE => 1'); 18endfor 19for line in [from..to] 20text[line] = toliteral(text[line][cut..$]) + ";"; 21endfor 22this.texts[who] = text; 23player:tell((to == from) ? "Line" | "Lines", " changed."); 24this.changes[who] = 1; 25this.times[who] = time(); 26endif
uncomment
Referenced by
none
Source
1"Syntax: uncomment [<range>]"; 2""; 3"Turns the specified range of lines from comments to, uh, not comments."; 4if ((caller != player) && (caller_perms() != player)) 5return E_PERM; 6elseif (!(who = this:loaded(player))) 7player:tell(this:nothing_loaded_msg()); 8elseif (typeof(range = this:parse_range(who, {"."}, @args)) != LIST) 9player:tell(tostr(range)); 10elseif (range[3]) 11player:tell_lines($code_utils:verb_documentation()); 12else 13text = this.texts[who]; 14{from, to, crap} = range; 15bogus = {}; 16for line in [from..to] 17if (match(text[line], "^ *\"%([^\\\"]%|\\.%)*\";$")) 18"check from $code_utils:verb_documentation"; 19if (!bogus) 20text[line] = $no_one:eval(text[line])[2]; 21endif 22else 23bogus = setadd(bogus, line); 24endif 25endfor 26if (bogus) 27player:tell((length(bogus) == 1) ? "Line" | "Lines", " ", $string_utils:english_list(bogus), " ", (length(bogus) == 1) ? "is" | "are", " not comments."); 28player:tell("No changes."); 29return; 30endif 31this.texts[who] = text; 32player:tell((to == from) ? "Line" | "Lines", " changed."); 33this.changes[who] = 1; 34this.times[who] = time(); 35endif