User:Sherry
From Flexible Survival
comb_win_name = "fs_comb" local comb_win_failed = false chat_win_name = "fs_chat" local chat_win_failed = false function initchat() chat_win = GetWorld (chat_win_name) local filename = GetInfo (67) .. chat_win_name .. ".mcl" Open (filename) chat_win = GetWorld (chat_win_name) if not chat_win then ColourNote ("white", "red", "Can't open chat world file: " .. filename) chat_win_failed = true -- Give up trying to open end end function tochat (name, line, wildcards, styles) if not chat_win and not chat_win_failed then initchat() end if chat_win then for _, v in ipairs (styles) do chat_win:ColourTell (RGBColourToName (v.textcolour), RGBColourToName (v.backcolour), v.text) end chat_win:Note("") end end function initcomb() comb_win = GetWorld (comb_win_name) local filename = GetInfo (67) .. comb_win_name .. ".mcl" Open (filename) comb_win = GetWorld (comb_win_name) if not comb_win then ColourNote ("white", "red", "Can't open combat world file: " .. filename) comb_win_failed = true -- Give up trying to open end end function tocomb (name, line, wildcards, styles) if not comb_win and not comb_win_failed then initcomb() end if comb_win then for _, v in ipairs (styles) do comb_win:ColourTell (RGBColourToName (v.textcolour), RGBColourToName (v.backcolour), v.text) end comb_win:Note("") end end