Switch to edit mode.
Name(s): substitute1: {?who = player, string} = args
2: if (!(index(string, "[") && index(string, "]")))
3: return {0, string}
4: elseif (!this:enabled(who))
5: return {0, this:strip_codes_fast(string)}
6: endif
7: colors = this:get_colors(1)
8: bin = 0
9: allowbinary = player == caller || this:ansi_option(caller, "allow_binary")
10: if (this:ansi_option(who, "all"))
11: while (i = index(string, "[random]"))
12: string[i..i + 7] = colors[random($)]
13: bin = 1
14: endwhile
15: for x in (this.bracketed)
16: string = strsub(string, x, this.codes[x in this.bracketed])
17: bin = 1
18: endfor
19: os = string
20: string = this:special_subs(string, allowbinary)
21: os == string || (bin = 1)
22: return {bin, strsub(string, "[null]", "")}
23: elseif (this:ansi_option(who, "colors"))
24: for x in (colors)
25: string = strsub(string, x, this.codes[x in this.bracketed])
26: bin = 1
27: endfor
28: os = string
29: string = this:special_subs(string, allowbinary)
30: os == string || (bin = 1)
31: return {bin, strsub(string, "[null]", "")}
32: else
33: while (i = index(string, "[random]"))
34: string[i..i + 7] = ""
35: endwhile
36: for x in (this.bracketed)
37: if (x in colors)
38: string = strsub(string, x, "")
39: else
40: string = strsub(string, x, this.codes[x in this.bracketed])
41: bin = 1
42: endif
43: endfor
44: os = string
45: string = this:special_subs(string, allowbinary)
46: os == string || (bin = 1)
47: return {bin, strsub(string, "[null]", "")}
48: endif