Posing Feature #310

Parent #68Owner #361Flags readSource hellcore/hellcore.db

Aliases: Posing Feature

7 verbs · 36 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
pose_exthis none thisrxd#310109
.*any any anyrxd#3103
parse_pose_argsthis none thisrxd#31058
args_with_quotesthis none thisrxd#31011
match_object_exactlythis none thisrxd#31010
match_object_exactlynone none nonerxd#3100
is_char*acterthis none thisrxd#3102

Properties

PropertyDefinerFlagsOwnerValue
pose_feature#310rc#361#310
quinn_utils#310rc#361#310
warehouse#68r#29<clear>
help_msg#68rc#361<clear>
feature_verbs#68r#29{}
feature_ok#68r#29<clear>
handed#5rc#361<clear>
wield_msg#5rc#361<clear>
unwield_msg#5rc#361<clear>
size#5rc#361<clear>
look_place_msg#5rc#361<clear>
value#5rc#361<clear>
get_msg#5rc#361<clear>
drop_msg#5rc#361<clear>
get_fail_msg#5rc#361<clear>
junk_ok#5rc#361<clear>
floats#5rc#361<clear>
long_name_msg#5rc#361<clear>
article#5rc#361<clear>
setup_list#5rc#361<clear>
health#5rc#361<clear>
health_max#5rc#361<clear>
min_skill#5rc#361<clear>
skill#5rc#361<clear>
recipe_for#5rc#361<clear>
carried_msg#5rc#361<clear>
aliases#1rc#361{"Posing Feature"}
description#1rc#361<clear>
object_size#1r#29{0, 0}
hidden_verbs#1rc#361<clear>
phelp_msg#1rc#361<clear>
weight#1rc#361<clear>
owner_verbs#1rc#361<clear>
plural_name#1rc#361<clear>
client_image#1rc#361<clear>
listening#1rc#361<clear>

Ancestry

Ancestors (nearest first): #68 Generic Feature Object#5 generic thing#1 root

Children: none

Call graph

calls n310_0 #310:pose_ex n20_39 #20:words n310_0->n20_39 n107_43 #107:tell n310_0->n107_43 n20_77 #20:escape n310_0->n20_77 n6_151 #6:name n310_0->n6_151 n310_3 #310:args_with_quotes n310_0->n310_3 n107_139 #107:title n310_0->n107_139 n310_1 #310:.* n310_1->n310_0 n310_2 #310:parse_pose_args n310_2->n20_39 n20_12 #20:strip_chars n310_2->n20_12 n44_5 #44:parse_possessive_reference n310_2->n44_5 n310_4 #310:match_object_exactly n310_2->n310_4 n310_6 #310:is_char*acter n45_5 #45:isa n310_6->n45_5

Source

pose_ex

Spec this none thisFlags rxdOwner #361Definer #310

Referenced by

Source

1"This is actually used as .* or pose.  The above name is coz I frigged it to be callable with strings, and I have added .* and pose to do so.";
2"Enter your pose as if you were typing in a first-person voice.";
3"-- Pose recognises the following:";
4"Names    -- Exact matches on the aliases of gendered objects in the room.";
5"Pronouns -- Pronouns will match for the last player mentioned.";
6"Addition verbs you wish conjugated to your gender should be prefixed with a colon.";
7"-- For example:";
8"   .kick chuck, bruising him on his shin as I :laugh madly.";
9"You   -> You kick chuck, bruising him on his shin as you laugh madly.";
10"Chuck -> Quinn kicks you, bruising you on your shin as he laughs madly.";
11"Room  -> Quinn kicks Chuck, bruising him on his shin as he laughs madly.";
12"  '.kick chuck, bruising chuck on chuck's shin...' would produce the same, except 'him' would translate to 'chuck', since a literal name was specified.";
13"As evident above, antecedent identification is rather simple right now.";
14"-- Special subs:";
15"/all /everybody /everyone -> A list of every $player in the room.";
16"Many thanks to Quinn for the original development of this code.";
17"I have made some minor fixes to allow better use by my code on here.";
18verb = args[1];
19args = listdelete(args, 1);
20if (args)
21argstr = args[1];
22args = $string_utils:words(argstr);
23endif
24if ((l = length(verb)) < 2)
25player:tell("The syntax \"", verb, argstr ? " " + argstr | "", "\" is invalid.");
26return;
27elseif ((verb == "pose") && args)
28verb = "." + args[1];
29args = listdelete(args, 1);
30else
31verb = verb[2..l];
32endif
33overb = $gender_utils:get_conj("/" + verb, player);
34here = player.location;
35if (!args)
36punk = match(verb, "[a-z0-9]$") ? "." | "";
37player:tell("You ", $su:escape(verb + punk));
38here:announce(player:name(), " ", $su:escape(overb + punk));
39return;
40endif
41la = length(args);
42if (pos = (("/all" in args) || ("/everyone" in args)) || ("/everybody" in args))
43contents = setremove(this:class_list(here:contents(), $player), player);
44titles = $string_utils:words($string_utils:title_list(contents));
45if (pos == 1)
46args = (pos == la) ? titles | {@titles, @verb[pos + 1..la]};
47elseif (pos == la)
48args = {@verb[1..pos - 1], @titles};
49else
50args = {@verb[1..pos - 1], @titles, @verb[pos + 1..la]};
51endif
52endif
53parsed = this.pose_feature:parse_pose_args(@this:args_with_quotes(args));
54"messages = this.pose_feature:build_messages(@parsed);";
55"msg = messages[1];";
56"omsg = messages[2];";
57msg = omsg = "";
58for w in (msglist = parsed[2])
59if (w == "(ps)")
60msg = tostr(msg, "you", " ");
61omsg = tostr(omsg, player.ps, " ");
62elseif (w == "(pr)")
63msg = tostr(msg, "yourself", " ");
64omsg = tostr(omsg, player.pr, " ");
65elseif (w == "(po)")
66msg = tostr(msg, "you", " ");
67omsg = tostr(omsg, player.po, " ");
68elseif (((lw = length(w)) > 1) && (w[1] == ":"))
69aux_verb = w[2..lw];
70msg = tostr(msg, aux_verb, " ");
71if (aux_verb[lw - 1] == ",")
72omsg = tostr(omsg, $gender_utils:get_conj("/" + aux_verb[1..lw - 2], player), ", ");
73else
74omsg = tostr(omsg, $gender_utils:get_conj("/" + aux_verb, player), " ");
75endif
76else
77msg = tostr(msg, w, " ");
78omsg = tostr(omsg, w, " ");
79endif
80endfor
81msg = tostr("You ", verb, " ", $su:escape(msg[1..length(msg) - 1]));
82omsg = tostr(player:title(), " ", $su:escape((overb + " ") + omsg[1..length(omsg) - 1]));
83msg = tostr(msg, match(msg, "[a-z0-9)]$") ? "." | "");
84omsg = tostr(omsg, match(omsg, "[a-z0-9)]$") ? "." | "");
85subs = {};
86for dp in [1..length(involved = parsed[1])]
87dude = involved[dp];
88subs = {@subs, {tostr("(", dp, ")"), dude:title()}, {tostr("(", dp, "s)"), dude.ps}, {tostr("(", dp, "p)"), dude.pp}, {tostr("(", dp, "o)"), dude.po}, {tostr("(", dp, "r)"), dude.pr}, {"ands", "and"}};
89endfor
90already_told_player = 0;
91for dp in [1..length(involved)]
92dude = involved[dp];
93msg_subs = subs;
94spa = ((dp - 1) * 5) + 1;
95spb = ((dp - 1) * 5) + 5;
96msg_subs[spa..spb] = {{tostr("(", dp, ")"), "you"}, {tostr("(", dp, "s)"), "you"}, {tostr("(", dp, "p)"), "your"}, {tostr("(", dp, "o)"), "you"}, {tostr("(", dp, "r)"), "yourself"}};
97if (dude == player)
98tell = $string_utils:substitute(msg, msg_subs);
99already_told_player = 1;
100else
101tell = $string_utils:substitute(omsg, msg_subs);
102endif
103"ugly little workaround for possessives without antecedents";
104dude:tell(strsub(strsub(tell, "you's", "your"), "you'", "your"));
105endfor
106if (!already_told_player)
107player:tell($string_utils:substitute(msg, subs));
108endif
109player.location:announce_all_but(setadd(involved, player), $su:substitute(omsg, subs));

.*

Spec any any anyFlags rxdOwner #361Definer #310

Referenced by

none

Source

1"This is just a pass-through verb for convenient use.";
2"Its usage is documented under pose_ex.";
3this:pose_ex(verb, argstr);

parse_pose_args

Spec this none thisFlags rxdOwner #361Definer #310

Referenced by

none

Source

1":parse_pose_args(cmd-line-args)";
2message = args = args || $string_utils:words(argstr);
3vi = player in (involved = {player});
4pron_props = {"s", "p", "o", "r"};
5last_pronouns = {player.ps, player.pp, player.po, player.pr};
6all_preps = $code_utils._all_preps;
7for wp in [1..length(args)]
8ls = length(string = args[wp]);
9match = $string_utils:strip_chars(string, "!.,;:?");
10poss = 0;
11if (((!string) || (string[1] == ":")) || (string[1] == "."))
12"...don't bother...";
13elseif (match == "me")
14message[wp] = "(po)";
15elseif (match == "myself")
16message[wp] = "(pr)";
17elseif (match == "I")
18message[wp] = "(ps)";
19elseif (p = match in last_pronouns)
20"pronoun referring to a matched character";
21message[wp] = tostr("(", tostr(vi), pron_props[p], ")");
22elseif ((m = match(match, "%(%w+%)s$")) && (p = substitute("%1", m) in last_pronouns))
23"reflexive possessive referring to a matched character";
24"ie: \"That's his.\" should parse to \"That's yours.\" for `him'.";
25message[wp] = tostr("(", tostr(vi), pron_props[p], ")s");
26else
27if (poss = string in {"my", "mine"})
28victim = player;
29elseif (poss = $match_utils:parse_possessive_reference(match))
30victim = this:match_object_exactly(poss[1]);
31else
32victim = this:match_object_exactly(match);
33endif
34if (this:is_character(victim))
35ovi = victim in involved;
36vi = victim in (involved = setadd(involved, victim));
37if (!poss)
38"It isn't possessive.";
39word = tostr("(", vi, ")");
40elseif (string == "mine")
41"mine -> yours, hers, etc";
42"grr.. this'll screw up outwardly for pps ending in 's'";
43word = tostr("(", vi, "p)", "s" || (match(victim.pp, "s$") ? "" | "s"));
44elseif (ovi || (typeof(poss) != LIST))
45"The possessive pronoun has a clear antecedent.";
46word = tostr("(", vi, "p)");
47else
48"Antecedent was found by parsing for a possessive.";
49"Use the victim's name, suffixed with possessive punctuation.";
50word = tostr("(", vi, ")", strsub(match, poss[1], ""));
51endif
52punctuation = (m = match(string, "%(%W+%)$")) ? substitute("%1", m) | "";
53message[wp] = word + punctuation;
54last_pronouns = {victim.ps, victim.pp, victim.po, victim.pr};
55endif
56endif
57endfor
58return {involved, message};

args_with_quotes

Spec this none thisFlags rxdOwner #361Definer #310

Referenced by

Source

1":args_with_quotes(cmdline_args)";
2"Return the arglist with argstr quotes intact.";
3oargstr = argstr;
4oargs = nargs = args[1];
5while (m = match(oargstr, "\"%([^\"]*%)\""))
6if ((i = substitute("%1", m) in oargs) && (!match(oargs[i], "^\".*\"$")))
7nargs[i] = tostr("\"", oargs[i], "\"");
8endif
9oargstr = oargstr[1..m[3][1][1] - 2] + oargstr[m[3][1][2] + 2..length(oargstr)];
10endwhile
11return nargs;

match_object_exactly

Spec this none thisFlags rxdOwner #361Definer #310

Referenced by

Source

1":social_match(string)";
2"Matches on room's occupants, accepting exact matches on an alias only.";
3string = args[1];
4where = (length(args) > 1) ? args[2] | player.location;
5for dude in (where:contents())
6if (string in `dude.aliases ! E_PERM => {}')
7return dude;
8endif
9endfor
10return $failed_match;

match_object_exactly

Spec none none noneFlags rxdOwner #361Definer #310

Referenced by

none

Source

No program (verb defined but unprogrammed).

is_char*acter

Spec this none thisFlags rxdOwner #361Definer #310

Referenced by

none

Source

1":is_char(OBJ what) => true if we should bother speaking to `what'";
2return valid(what = args[1]) && (is_player(what) || $object_utils:isa(what, #7680));