ID:139670
 
Code:
Roleplay()
set category = "Misc."
usr.overlays += 'rpbubble.dmi'
var/msg = input("Roleplay") as message | null
if(msg == null || msg == "" || !(length(msg)))
usr.overlays -= 'rpbubble.dmi'
return
msg = " " + msg
var/i = findtext(msg, " \"") // Look for the " in the message.
while(i)// When it finds the "
var/msgStart = copytext(msg, 1, i) + " <font color = white>\"" //+ copytext(msg,i+length("\"")+1))
var/msgEnd = copytext(msg,i+length("\"")+1)
var/check = findtext(msgEnd, "\"")
var/check2 = findtext(msgEnd, "\".")
var/check4 = findtext(msgEnd, "\"\n")
if(check)
msgEnd = copytext(msgEnd,1, check) + "\" </font><font color = yellow>" + copytext(msgEnd, check+length("\"")+1)
else if(check2)
msgEnd = copytext(msgEnd,1, check2) + "\" </font><font color = yellow>." + copytext(msgEnd, check2+length("\"")+1)
else if(check4)
msgEnd = copytext(msgEnd,1, check4) + "\" </font><font color = yellow>" + copytext(msgEnd, check4+length("\""))
msg = msgStart + msgEnd
i = findtext(msg, " \"")
i = findtext(msg, " (") // Look for the " in the message.
while(i)// When it finds the "
var/msgStart = copytext(msg, 1, i) + " <font color = #52F3FF>(" //+ copytext(msg,i+length("\"")+1))
var/msgEnd = copytext(msg,i+length("(")+1)
var/check = findtext(msgEnd, ")")
var/check2 = findtext(msgEnd, ").")
var/check4 = findtext(msgEnd, ")\n")
if(check)
msgEnd = copytext(msgEnd,1, check) + ") </font><font color = yellow>" + copytext(msgEnd, check+length(")")+1)
else if(check2)
msgEnd = copytext(msgEnd,1, check2) + ") </font><font color = yellow>." + copytext(msgEnd, check2+length(")")+1)

else if(check4)
msgEnd = copytext(msgEnd,1, check4) + ") </font><font color = yellow>" + copytext(msgEnd, check4+length(")"))
msg = msgStart + msgEnd
i = findtext(msg, " (")
if(!(usr.name in RPLogs))
RPLogs[usr.name] = list()
RPLogs[usr.name] += "[time2text(world.realtime,"(Month Day, YYYY) hh:mm:ss")] RP: [usr] [html_encode(msg)]<br>"
hearers(10,usr) << "<font color = yellow><b>[usr.name] [msg]</b></font>" // Send it out!
if(src.TempVars["AstralProjecting"])
hearers(10,usr.client.eye) << "<FONT FACE=Arial COLOR=#FFFFFF>[usr.name] says: [html_encode(msg)]</FONT>"
for(var/AP/A in view(10,usr.client.eye))
A.owner << "<font color = yellow><b>[usr.name] [msg]</b></font>"
for(var/mob/M in world)
if(M.TempVars["AdminMonitor"])
M << output("<font color = #0174DF><b>[usr.name][html_encode(msg)]</b></font>","DefaultOutput.output2")
spawn() if(LogStuff&&usr&&usr.client) text2file("RP: [usr], [msg]<br>", "logs/[usr.name].[usr.client ? usr.key : "AI"].txt")
usr.overlays -= 'rpbubble.dmi'


Problem description:
I fixed the crash bug before.

There apparently is a problem, at the moment, where if you end a paragraph in the message with a end quotation, it makes <fon"
ellow> then the next paragraph as output.

How can I fix this verb to show the white dialog just fine, even at end of paragraphs?

edits:
testing "testing"

testing

outputs

Asellia testing "testing"
testing

and
testing "testing" testing "testing"

testing

outputs

Asellia testing "testing" <font col" r = yellow>testing "testing"
testing
This is really a fantastic example of horrible commenting. You have lines such as "Look for the " in the message", which are thoroughly useless: anybody reading findtext(msg, " \"") will be able to figure THAT out. What you DON'T provide a comment for, however, is what the loops as a whole do. What you need is a comment before them saying something like, "Search for any text between quotation marks, and change them to yellow", and other things that explain what BLOCKS of code does, not specific lines.

I say this because I really can't figure out what it is you are actually trying to do there, which makes it impossible for me to provide advice beyond saying that you are probably doing things in a manner that is five times more complicated than it needs to be.