Generic Conversational Wandering Automaton (#2383)(an instance of Generic Speaking Wandering Automaton made by Trismegistos)     An unprogrammed, unmodified humanoid 'bot chassis, quietly skeletal in gleaming chrome. Go to location of this object, Machine Shop. HELP MANUAL:      GENERIC CONVERSATIONAL WANDERING AUTOMATON by Trism            For additional help on this robot's features, see: help #192, help #502, and help #1044            This child of the Speakin' Wanderin' Automaton has the virtue of responding to actual say- and emote- statements, rather than using the verb "talk" or "talk to." Like all bots, it's only as good as its programming ...            addpat VERB SOURCE CODE: talky:
if (this.talky)
player:tell(this.name, " is already feeling conversational!");
else
this.talky = 1;
this.location:announce_all(this.name, " becomes interested in conversation.");
endif
.
hush:
if (this.talky == 0)
player:tell(this.name, " is already hushed!");
else
this.talky = 0;
player.location:announce_all_but({this}, this.name, " loses all interest in talking.");
endif
.
nosy:
if (this.talky == 2)
player:tell(this.name, " is already nosy!");
else
this.talky = 2;
player.location:announce_all(this.name, " becomes interested in other people's
conversations.");
endif
.
polite:
if (this.talky == 1)
player:tell(this.name, " is already polite!");
else
this.talky = 1;
player.location:announce_all_but({this}, this.name, " stops eavesdropping on
other people's conversations.");
endif
.
addpat:
if ((this.owner != player) || ((!player) in this.teachers))
player:tell("Sorry, you must be the owner of ", this.name, " to add a new word...");
player:tell(this.name, " resists your attempts to mess with ", this.pp, " mind.");
endif
player:tell("Type in key word on line 1, and any aliases on subsequent lines --
single or hyphenated words only: (Don't use quotes) ");
w = $command_utils:read_lines();
player:tell("Type in list of random responses to key word, one per line: (Don't
use quotes) :");
player:tell("NOTE: Beginning a response with ':' will cause the bot to emote that
response, substituting %n for the player's name and %s, etc. for the player's pronouns.");
player:tell("So, ':kisses %n on %p cheek.' when activated on the bot Fred by the
player Wilma leads to 'Fred kisses Wilma on her cheek.'");
r = $command_utils:read_lines();
if (w && r)
this.mkeys[1] = listappend(this.mkeys[1], w);
this.mkeys[2] = listappend(this.mkeys[2], r);
else
player:tell("Command aborted.");
endif
player.location:announce_all(player.name, " teaches ", this.name, " a new word.");
.
rmpat:
if (player == this.owner)
player:tell("Enter number of pattern to be edited (don't know it? @abort and
type 'keys ", this.name, "'):");
pat = $command_utils:read();
if ($string_utils:is_numeric(pat))
pat = tonum(pat);
if (pat <= length(this.mkeys[1]))
player:tell("Pattern ", pat, " keywords:");
n = 1;
for key in (this.mkeys[1][pat])
player:tell(n, ": ", key);
n = n + 1;
endfor
player:tell("");
player:tell("Pattern ", pat, " responses:");
n = 1;
if (this.mkeys[2][pat])
for key in (this.mkeys[2][pat])
player:tell(n, ": ", key);
n = n + 1;
endfor
endif
abort = 0;
while (!abort)
player:tell("To remove the entire pattern type 'rm all'; to abort
type '.'");
input = $command_utils:read();
if (input[1] == ".")
abort = 1;
player:tell("Pattern editing over.");
elseif (input == "rm all")
this.mkeys[1] = listdelete(this.mkeys[1], pat);
this.mkeys[2] = listdelete(this.mkeys[2], pat);
player:tell("Pattern removed.");
return;
endif
endwhile
else
player:tell("That is not a valid pattern. Type 'keys ", this.name, "
for numbers of valid patterns.");
endif
else
player:tell("You must enter the NUMBER of the pattern. That is not a number.");
endif
else
player:tell("Sorry.. see ", this.owner.name, " for help in deleting keywords...");
endif
.
tell:
if (this.talky)
argystring = $string_utils:strip_chars(argstr, ",?]')[(:;.!-");
words = $string_utils:words(argystring);
if ($set_utils:intersection(this.aliases, words) || (this.talky == 2))
pat = {};
for w in [1..length(words)]
if (ticks_left() < 1000)
suspend(3);
if (this.mull_msg)
this.location:announce_all_but({this}, $string_utils:pronoun_sub(this.mull_msg));
endif
endif
for y in [1..length(this.mkeys[1])]
if ((y != this.lastkey[1]) || (this.lastkey[2] < (time() - 30)))
if ((x = words[w] in this.mkeys[1][y]) && this.mkeys[2][y])
pat = {@pat, this.mkeys[2][y][random(length(this.mkeys[2][y]))]};
this.lastkey = {y, time()};
endif
endif
endfor
endfor
if (pat)
speech = pat[random(length(pat))];
fork (5)
if (player.location == this.location)
if (speech[1] == ":")
speech[1] = " ";
player.location:announce_all_but({this}, $string_utils:capitalize(this.name),
$string_utils:pronoun_sub(speech));
else
player.location:announce_all_but({this}, $string_utils:capitalize(this.name),
" [to ", player.name, "]: ", speech);
endif
endif
return;
endfork
endif
endif
endif
pass(@args);
.
keys:
if (player == this.owner)
player:tell("You scrutinize ", this.name, "'s key word list.");
for x in [1..length(this.mkeys[1])]
player:tell(x, ") Responds to: ", $string_utils:english_list(this.mkeys[1][x]));
player:tell(" with: \"", $string_utils:from_list(this.mkeys[2][x], "\",\""),
"\"");
endfor
else
player:tell(this.name, " doesn't appreciate that kind of scrutiny.");
endif
.
PROPERTY DATA:       mkeys       talky       lastkey       mull_msg       teachers CHILDREN: Kim the Novelist Grimaldi |