Switch to edit mode.
Name(s): raw_notify ansi1: "Copied from Cecil... (#7407):ansi Nov 15 15:50:27 1997"
2: "Copied from gamma (#9814):ansi Jun 30 08:14:43 1997"
3: "Copied from Cecil (#7407):ansi Jun 29 14:42:44 1997"
4: "Copied from Generic player (#6):raw_notify by manta (#7165) Aug 27 13:29:27 1996"
5: "A portion of the code was then hacked into Cecil's ANSI System on Jun 8 22:21:20 1997"
6: "Optional ANSI support verbs (recommended) are:"
7: " #7407:linesplit => Wraps ansified text correctly (or, attempts to.)"
8: " #7407:quietcolumns => Useful for columnizing ANSI"
9: " #7407:@ansi-option => Allows you to set certain options"
10: {text, perms} = args
11: $command_utils:suspend_if_needed()
12: set_task_perms(this)
13: accentbin = 0
14: if (caller == this || caller_perms().wizard)
15: text = strsub(args[1], "~", "~7E")
16: text = connection_option(this, "binary") ? strsub(text, "~7E~7E", "~7E") | text
17: if (this.beep_type == "all" || (this.beep_type == "me" && caller_perms() == this))
18: ot = text
19: text = strsub(text, "&beep;", "~07")
20: ot == text || (accentbin = 1)
21: endif
22: if (this.esc_type == "all" || (this.esc_type == "me" && caller_perms() == this))
23: ot = text
24: text = strsub(text, "&esc;", "~1B")
25: ot == text || (accentbin = 1)
26: endif
27: text == (text = $msg:process_notify(text, this.accent_mode)) || (accentbin = 1)
28: "And here, begins the ANSI hack."
29: {needbin, text} = $ansi_utils:substitute(this, text)
30: if (accentbin || needbin)
31: text = text + "~1B[0m~0D~0A"
32: try
33: if (!(bin = `connection_option(this, "binary") ! ANY => 0'))
34: set_connection_option(this, "binary", 1)
35: endif
36: notify(this, text)
37: finally
38: bin || set_connection_option(this, "binary", 0)
39: endtry
40: else
41: notify(this, strsub(text, "~7E", "~"))
42: endif
43: else
44: raise(E_PERM)
45: endif
46: if (this != #7407 && `!index(verb_info(this, "linesplit")[2], "x") ! ANY => 0')
47: notify(this, tostr("Activating ", this, ":linesplit..."))
48: set_verb_info(this, "linesplit", {this, "rdxo", "linesplit"})
49: endif
50: "Last modified by Dax (#789) on Sat May 16 14:20:56 1998 EDT."