Verb Editor #49

Parent #50Owner #36Flags readSource QuestCore.db

Aliases: Verb Editor, vedit, verbedit, verb edit

12 verbs · 40 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
e*ditany none nonerd#495
com*pile savenone any anyrd#4982
working_onthis none thisrxd#4912
init_sessionthis none thisrxd#498
parse_invokethis none thisrxd#4942
fetch_verb_codethis none thisrxd#497
set_verb_codethis none thisrxd#497
local_editing_infothis none thisrxd#4920
verb_namethis none thisrxd#4916
verb_argsthis none thisrxd#499
commentany any anyrd#4926
uncommentany any anyrd#4935

Properties

PropertyDefinerFlagsOwnerValue
objects#49#36{}
verbnames#49#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", "e*dit", "com*pile", "abort", "q*uit,done,pause"}}
help#50rc#36{}
no_text_msg#50rc#36"Verb body is empty."
commands#50rc#36{{"e*dit", "<obj>:<verb>"}, {"com*pile", "[as <obj>:<verb>]"}}
invoke_task#50r#360
exit_on_abort#50rc#36<clear>
previous_session_msg#50rc#36"You need to either COMPILE or ABORT this verb before you can start on another."
stateprops#50r#36{{"objects", 0}, {"verbnames", 0}, {"texts", 0}, {"changes", 0}, {"inserting", 1}, {"readable", 0}}
depart_msg#50rc#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#50rc#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#50rc#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#50rc#36"The verb has no pending changes."
change_msg#50rc#36"You have changed the verb since last successful compile."
nothing_loaded_msg#50rc#36"First, you have to select a verb to edit with the EDIT command."
texts#50#36{}
active#50r#36{}
changes#50#36{}
inserting#50#36{}
original#50r#36{}
who_location_msg#3rc#36"%L [editing verbs]"
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#361639500112
exits#3c#36{}
dark#3rc#36<clear>
ctype#3rc#36<clear>
key#1c#36<clear>
aliases#1rc#36{"Verb Editor", "vedit", "verbedit", "verb edit"}
description#1rc#36<clear>
object_size#1r#36{15587, -1090650497}

Ancestry

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

Children: none

Call graph

calls n49_0 #49:e*dit n6_18 #6:tell n49_0->n6_18 n50_37 #50:invoke n49_0->n50_37 n49_1 #49:com*pile n49_1->n6_18 n50_28 #50:loaded n49_1->n50_28 n50_56 #50:nothing_loaded_msg n49_1->n50_56 n59_14 #59:parse_verbref n49_1->n59_14 n59_15 #59:parse_argspec n49_1->n59_15 n20_5 #20:from_list n49_1->n20_5 n56_0 #56:object_match_failed n49_1->n56_0 n6_7 #6:my_match_object n49_1->n6_7 n50_61 #50:get_room n49_1->n50_61 n59_18 #59:full_prep n49_1->n59_18 n59_21 #59:find_verb_named n49_1->n59_21 n59_1 #59:toint n49_1->n59_1 n49_8 #49:verb_name n49_1->n49_8 n6_44 #6:edit_option n49_1->n6_44 n50_24 #50:text n49_1->n50_24 n59_41 #59:substitute n49_1->n59_41 n49_6 #49:set_verb_code n49_1->n49_6 n50_19 #50:set_changed n49_1->n50_19 n49_2 #49:working_on n49_2->n20_5 n49_2->n49_8 n50_27 #50:ok n49_2->n50_27 n49_9 #49:verb_args n49_2->n49_9 n49_9->n20_5 n49_3 #49:init_session n49_3->n49_2 n49_3->n50_27 n50_25 #50:load n49_3->n50_25 n49_4 #49:parse_invoke n49_4->n6_18 n49_4->n59_14 n49_4->n59_15 n49_4->n20_5 n49_4->n56_0 n49_4->n6_7 n49_4->n50_61 n49_4->n59_18 n49_4->n59_21 n20_39 #20:words n49_4->n20_39 n49_5 #49:fetch_verb_code n49_4->n49_5 n49_5->n6_44 n49_7 #49:local_editing_info n59_17 #59:short_prep n49_7->n59_17 n49_10 #49:comment n49_10->n6_18 n49_10->n50_28 n49_10->n50_56 n50_34 #50:parse_range n49_10->n50_34 n6_79 #6:tell_lines n49_10->n6_79 n59_11 #59:verb_documentation n49_10->n59_11 n49_11 #49:uncomment n49_11->n6_18 n49_11->n50_28 n49_11->n50_56 n49_11->n50_34 n49_11->n6_79 n49_11->n59_11 n38_0 #38:eval n49_11->n38_0 n20_6 #20:english_list n49_11->n20_6

Source

e*dit

Spec any none noneFlags rdOwner #36Definer #49

Referenced by

none

Source

1if (!args)
2player:tell("edit what?");
3else
4this:invoke(argstr, verb);
5endif

com*pile save

Spec none any anyFlags rdOwner #36Definer #49

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

Spec this none thisFlags rxdOwner #36Definer #49

Referenced by

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

Spec this none thisFlags rxdOwner #36Definer #49

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

Spec this none thisFlags rxdOwner #36Definer #49

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

Spec this none thisFlags rxdOwner #2Definer #49

Referenced by

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

Spec this none thisFlags rxdOwner #2Definer #49

Referenced by

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

Spec this none thisFlags rxdOwner #2Definer #49

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

Spec this none thisFlags rxdOwner #2Definer #49

Referenced by

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

Spec this none thisFlags rxdOwner #2Definer #49

Referenced by

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

Spec any any anyFlags rdOwner #36Definer #49

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

Spec any any anyFlags rdOwner #36Definer #49

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