Switch to edit mode.
Name(s): dialog_box1: target = `args[1] ! ANY => player'
2: title = `args[2] ! ANY => ""'
3: scc = `args[3] ! ANY => "|"'
4: tlists = length(args) > 3 ? args[4..length(args)] | {}
5: target = typeof(target) == 1 ? target | player
6: title = typeof(title) == 2 ? title | ""
7: scl = scr = "|"
8: ansi = ""
9: subt = 0
10: if (typeof(scc) == 2)
11: scl = scr = length(scc) > 0 ? scc | "|"
12: elseif (typeof(scc) == 4)
13: scl = length(scc) == 0 ? "|" | (typeof(scc[1]) == 2 ? scc[1] | "|")
14: scr = length(scc) == 0 ? "|" | (length(scc) == 1 ? typeof(scc[1]) == 2 ? scc[1] | "|" | (typeof(scc[2]) == 2 ? scc[2] | "|"))
15: ansi = length(scc) > 2 ? typeof(scc[3]) == 2 ? this:get_ansi(scc[3]) | "" | ""
16: subt = length(scc) > 3 ? typeof(scc[3]) ? 0 | !!scc[3] | 0
17: endif
18: title_line = "" + ansi + "+" + (ppo = length(title) ? "---[ " + title + "" + ansi + " ]" | "") + $string_utils:space(target:linelen() - (3 + length(this:delete(ppo))), "-") + "+"
19: text_lines = {}
20: linelen = player:linelen()
21: fill_width = linelen - (length(scl) + length(scr) + 3)
22: c = 0
23: for text in (tlists)
24: if (typeof(text) == 4)
25: if (length(text))
26: text_lines = c ? text_lines | (length(text_lines) ? {@text_lines, ansi + "+" + $string_utils:space(target:linelen() - 3, "-") + "+"} | text_lines)
27: c = 0
28: for fline in (text)
29: $command_utils:suspend_if_needed(0)
30: qw = ""
31: for line in (this:wordwrap(fline, fill_width))
32: full_line = ansi + scl + " " + qw + $string_utils:left(line, fill_width, " ") + " " + ansi + scr + ""
33: qw = (ty = (qw + line)[(er = (er = rmatch(qw + line, this.all_regexp)) != {} ? er | {1, -1})[1]..er[2]]) != "" ? ty | ""
34: text_lines = {@text_lines, full_line}
35: endfor
36: endfor
37: endif
38: elseif (typeof(text) == 2)
39: subliner = $string_utils:space(abs(target:linelen()) - (11 + length(this:delete(text))), "-")
40: text_lines = !length(text) ? {@text_lines, ansi + "+" + $string_utils:space(target:linelen() - 3, "-") + "+"} | {@text_lines, "" + ansi + "+" + (subt ? subliner | "") + "-[ " + text + "" + ansi + " ]" + (subt ? "" | subliner) + "---+"}
41: c = 1
42: endif
43: endfor
44: text_lines = length(text_lines) ? text_lines | {ansi + scl + $string_utils:space(target:linelen() - (length(scl) + length(scr) + 1), " ") + scr + ""}
45: $command_utils:suspend_if_needed(0)
46: blah = {title_line, @text_lines, ansi + "+" + $string_utils:space(target:linelen() - 3, "-") + "+"}
47: for a in (blah)
48: target:tell(tostr(a))
49: endfor
50: "Last modified by Vladmir (#3936) on Wed Dec 10 20:03:22 2008 EST."