ID:143216
 
Code:
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")

Please explain what you are trying to do with this code. When you input something into that proc, what is the expected output? That may help people determine the problem, or offer a better way to do it.
In response to digitalmouse
I was trying to make it so you can use BBC code within text. With this proc I was trying to turn it into HTML using copy text to replace the [ and ] with < and >
In response to Squall4120
So, is anyone going to help me with this?