proc/bbc_code(txt as text)
if(findtext(txt, "\[")&&findtext(txt, "\]"))
if(findtext(copytext(txt, "\[","\]"), "color=")||findtext(copytext(txt, "\[","\]"), "Color=")||findtext(copytext(txt, "\[","\]"), "COLOR="))
txt = copytext(txt, 1, "\[" - 1) + "<font color=" + copytext(txt, "color=" + 1, "\]" - 1) + ">" + copytext(txt, "\]" + 1)
if(findtext(copytext(txt, "\[","\]"), "font=")||findtext(copytext(txt, "\[","\]"), "Font=")||findtext(copytext(txt, "\[","\]"), "FONT="))
txt = copytext(txt, 1, "\[" - 1) + "<font style=" + copytext(txt, "font=" + 1, "\]" - 1) + ">" + copytext(txt, "\]" + 1)
if(findtext(copytext(txt, "\[","\]"), "size=")||findtext(copytext(txt, "\[","\]"), "Size=")||findtext(copytext(txt, "\[","\]"), "SIZE="))
txt = copytext(txt, 1, "\[" - 1) + "<font size=" + copytext(txt, "size=" + 1, "\]" - 1) + ">" + copytext(txt, "\]" + 1)
if(findtext(copytext(txt, "\[","\]"), "b")||findtext(copytext(txt, "\[","\]"), "B"))
txt = copytext(txt, 1, "\[" - 1) + "<b>" + copytext(txt, "\]" + 1)
if(findtext(copytext(txt, "\[","\]"), "i")||findtext(copytext(txt, "\[","\]"), "I"))
txt = copytext(txt, 1, "\[" - 1) + "<i>" + copytext(txt, "\]" + 1)
return txt
Problem description:
When I input anything, for example [b], I get this:
runtime error: bad text or out of bounds
proc name: bbc code (/proc/bbc_code)
usr: Squall (/mob)
src: null
call stack:
bbc code("\[b]hi")
Squall (/mob): Say("\[b]hi")