ANSI Database #122

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

Aliases: ANSI Database

10 verbs · 75 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
reset bold_on bold_off italics_on italics_off underline_on underline_off inverse_on inverse_off strikethrough_on strikethrough_off red black green yellow blue purple cyan white default_fg bg_black bg_red bg_green bg_yellow bg_blue bg_purple bg_cyan bg_white default_bgthis none thisrxd#1221
add_tagany at/to thisrxd#12236
add_themethis none thisrxd#12216
validthis none thisrxd#1227
remove_themethis none thisrxd#12221
remove_tagthis none thisrxd#12227
sub_text roomtitle player areatitle debug creature exit broadcast page regiontitlethis none thisrxd#12211
set_tagthis none thisrxd#1220
stripthis none thisrx#1225
findthis none thisrx#1227

Properties

PropertyDefinerFlagsOwnerValue
bold_on#122rc#361"~1b[1m"
bold_off#122rc#361"~1b[22m"
red#122rc#361"~1b[31m"
reset#122rc#361"~1b[0m"
italics_on#122rc#361"~1b[3m"
italics_off#122rc#361"~1b[23m"
underline_on#122rc#361"~1b[4m"
inverse_on#122rc#361"~1b[7m"
strikethrough_on#122rc#361"~1b[9m"
underline_off#122rc#361"~1b[24m"
inverse_off#122rc#361"~1b[27m"
strikethrough_off#122rc#361"~1b[29m"
black#122rc#361"~1b[30m"
green#122rc#361"~1b[32m"
yellow#122rc#361"~1b[33m"
blue#122rc#361"~1b[34m"
purple#122rc#361"~1b[35m"
cyan#122rc#361"~1b[36m"
white#122rc#361"~1b[37m"
default_fg#122rc#361"~1b[39m"
bg_black#122rc#361"~1B[40m"
bg_red#122rc#361"~1b[41m"
bg_green#122rc#361"~1b[42m"
bg_yellow#122rc#361"~1b[43m"
bg_blue#122rc#361"~1b[44m"
bg_purple#122rc#361"~1b[45m"
bg_cyan#122rc#361"~1b[46m"
bg_white#122rc#361"~1b[47m"
help_msg#122rc#361
list of 8{"There are currently the following theme tags available:", "", "roomtitle", "areatitle", "player", "creature", "debug", ""}
default_bg#122rc#361"~1b[49m"
theme_names#122rc#361{"default"}
tag_index#122rc#361
list of 9{"roomtitle", "player", "debug", "exit", "broadcast", "page", "creature", "areatitle", "regiontitle"}
roomtitle#122rc#361{"~1b[33m~1b[1m"}
player#122rc#361{"~1b[4m"}
debug#122rc#361{"~1b[44m~1b[36m~1b[1m"}
exit#122rc#361{"~1b[1m"}
broadcast#122rc#361{"~1b[35m"}
page#122rc#361{"~1b[1m"}
creature#122rc#361{"~1b[4m"}
areatitle#122rc#361{"~1b[33m"}
debug_event#122rc#361"~1b[44m~1b[1m~1b[36m"
debug_action#122rc#361"~1b[44m~1b[1m~1b[37m"
debugbold#122rc#361"~1b[44m~1b[37m~1b[1m"
header#122rc#361"~1b[4m~1b[1m~1b[44m~1b[37m"
brown#122rc#361"~1b[0;33m"
gray#122rc#361"~1b[0;37m"
dark_gray#122rc#361"~1b[1;30m"
reverse#122rc#361"~1b[7m"
regiontitle#122rc#361{"~1b[33m"}
grey#122rc#361"~1b[0;37m"
orange#122rc#361"~1b[31m~1b[1m"
brightblue#122rc#361"~1b[34m~1b[1m"
brightgreen#122rc#361"~1b[32m~1b[1m"
blink#122rc#361""
tab#122rc#361"~09"
pink#122rc#361"~1b[35m~1b[1m"
beep#122rc#361""
bold#122rc#361"~1b[1m"
magenta#122rc#361"~1b[35m"
darkgray#122rc#361"~1b[1;30m"
darkgrey#122rc#361"~1b[1;30m"
binary_tag#122rc#361"~"
brightwhite#122rc#361"~1b[1m~1b[37m"
brightyellow#122rc#361"~1b[33m~1b[1m"
tilde#122rc#361"~~"
aliases#1rc#361{"ANSI Database"}
description#1rc#361<clear>
object_size#1r#29{9077, 1298433815}
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): #1 root

Children: none

Call graph

calls n122_1 #122:add_tag n122_3 #122:valid n122_1->n122_3 n107_43 #107:tell n122_1->n107_43 n45_1 #45:all_properties n122_1->n45_1 n122_2 #122:add_theme n122_2->n122_3 n122_2->n107_43 n122_4 #122:remove_theme n122_4->n122_3 n122_4->n107_43 n122_5 #122:remove_tag n122_5->n122_3 n122_5->n107_43 n20_38 #20:explode n122_5->n20_38

Source

reset bold_on bold_off italics_on italics_off underline_on underline_off inverse_on inverse_off strikethrough_on strikethrough_off red black green yellow blue purple cyan white default_fg bg_black bg_red bg_green bg_yellow bg_blue bg_purple bg_cyan bg_white default_bg

Spec this none thisFlags rxdOwner #361Definer #122

Referenced by

Source

1return this.(verb);

add_tag

Spec any at/to thisFlags rxdOwner #361Definer #122

Referenced by

none

Source

1":add_tag(STR name[, STR default_value]) => Adds a new ANSI markup tag";
2tag = args[1];
3if (length(args) > 1)
4value = args[2];
5else
6value = "";
7endif
8if ((typeof(tag) != STR) || (typeof(value) != STR))
9return E_INVARG;
10endif
11"before we go any further, make sure all the properties are in sync";
12if (!this:valid())
13player:tell("*** ANSI DB is out of sync.  Can't add new tags.");
14return 1;
15endif
16"check to see if there is any conflict";
17if (tag in $ou:all_properties(this))
18player:tell("Can't add a \"", tag, "\" to the ANSI database: property exists");
19return 1;
20endif
21for x in ($ou:all_verbs(this))
22if (index(x, tag))
23player:tell("Can't add a \"", tag, "\" tag to the ANSI database: verb exists");
24return 1;
25endif
26endfor
27verbinfo = verb_info(this, "sub_text");
28names = verbinfo[3];
29names = (names + " ") + tag;
30add_property(this, tag, {}, {this.owner, "rc"});
31set_verb_info(this, "sub_text", {verbinfo[1], verbinfo[2], names});
32for x in [1..length(this.theme_names)]
33this.(tag) = listappend(this.(tag), value);
34endfor
35this.tag_index = listappend(this.tag_index, tag);
36return 0;

add_theme

Spec this none thisFlags rxdOwner #361Definer #122

Referenced by

none

Source

1":add_theme(STR theme_name) => Adds the theme to the ANSI database";
2theme = args[1];
3if (typeof(theme) != STR)
4return E_INVARG;
5endif
6if (!this:valid())
7player:tell("*** ANSI DB is out of sync.  Can't add a new theme. ***");
8return 1;
9endif
10for x in (this.tag_index)
11"copy the initial value from the default theme";
12default = this.(x)[1];
13this.(x) = listappend(this.(x), default);
14endfor
15this.theme_names = listappend(this.theme_names, theme);
16return 0;

valid

Spec this none thisFlags rxdOwner #361Definer #122

Referenced by

Source

1":valid() => 1 if everything is cool, 0 if not";
2for tag in (this.tag_index)
3if (length(this.(tag)) != length(this.theme_names))
4return 0;
5endif
6endfor
7return 1;

remove_theme

Spec this none thisFlags rxdOwner #361Definer #122

Referenced by

none

Source

1":remove_theme(STR theme_name) => removes the named theme";
2if (!player.wizard)
3return E_PERM;
4endif
5theme = args[1];
6if (typeof(theme) != STR)
7return E_INVARG;
8endif
9idx = theme in this.theme_names;
10if (!idx)
11return E_INVARG;
12endif
13if (!this:valid())
14player:tell("*** ANSI DB is not in sync, can't remove themes ***");
15return 1;
16endif
17for x in (this.tag_index)
18this.(x) = listdelete(this.(x), idx);
19endfor
20this.theme_names = listdelete(this.theme_names, idx);
21return 0;

remove_tag

Spec this none thisFlags rxdOwner #361Definer #122

Referenced by

none

Source

1":remove_tag(STR tag_name) => removes the named tag from all themes";
2tag = args[1];
3if (!player.wizard)
4return E_PERM;
5elseif (typeof(tag) != STR)
6return E_INVARG;
7endif
8if (!this:valid())
9player:tell("*** ANSI DB is out of sync.  Can't remove tags ***");
10return 1;
11endif
12idx = tag in this.tag_index;
13if (!idx)
14return E_INVARG;
15endif
16this.tag_index = listdelete(this.tag_index, idx);
17delete_property(this, tag);
18verbinfo = verb_info(this, "sub_text");
19names = $su:explode(verbinfo[3]);
20names = listdelete(names, tag in names);
21namestr = "";
22for x in (names)
23namestr = (namestr + " ") + x;
24endfor
25namestr = namestr[2..$];
26set_verb_info(this, "sub_text", {verbinfo[1], verbinfo[2], namestr});
27return 0;

sub_text roomtitle player areatitle debug creature exit broadcast page regiontitle

Spec this none thisFlags rxdOwner #361Definer #122

Referenced by

Source

1":sub_text(STR text) => wraps text in the proper ANSI codes based on the verb name";
2text = args[1];
3tag = verb;
4theme = $player.ansi;
5if (!theme)
6return text;
7endif
8if ((typeof(text) != STR) || (!(tag in this.tag_index)))
9return E_INVARG;
10endif
11return (this.(tag)[theme] + text) + this.reset;

set_tag

Spec this none thisFlags rxdOwner #361Definer #122

Referenced by

none

Source

No program (verb defined but unprogrammed).

strip

Spec this none thisFlags rxOwner #361Definer #122

Referenced by

Source

1s = args[1];
2while (spec = match(s, "~1[bB]%[[0-9;]+m"))
3s = s[1..spec[1] - 1] + s[spec[2] + 1..$];
4endwhile
5return s;

find

Spec this none thisFlags rxOwner #361Definer #122

Referenced by

Source

1s = args[1];
2l = {};
3while (spec = match(s, "~1[bB]%[[0-9]+m"))
4l = listappend(l, s[spec[1]..spec[2]]);
5s = s[spec[2] + 1..$];
6endwhile
7return l;