ID:267514
 
Well, I am trying to get a showcode like verb in my game, so I'll just call it that for now.
mob
verb
showcode(m as message)
world << browse(m,"window=[m]")


What happens is, you type the message, and it come up in one line! Like if I typed:
mob
verb
showcode
it would come up as:

mob verb showcode

Does anyone know the problem?
Yes. Your problem is that the new lines when typing something into the message box are represented by "\n". HTML does not recognize this, and uses <BR> instead. You'll have to replace all instances of "\n" with <BR>
var/pos
pos = findtext(m,"\n")
while(pos)
m = copytext(m,1,pos)+"<BR>"+copytext(m,pos+1)
pos = findtext(m,"\n")
In response to Garthor
Not trying to be contradictory, but what about tabs? Anything for those?
In response to Maz
Tabs are the \t character, and you should probably replace them with a bunch of &nbsp .
In response to Maz
No, tabs do not do anything either. I'm sorry Garthor, but I didn't follow much of what you said...I guess I'll just skip this command for a bit...
In response to Garthor
Garthor wrote:<code> > var/pos > pos = findtext(m,"\n") > while(pos) > m = copytext(m,1,pos)+"<BR>"+copytext(m,pos+</code>2<code>) > pos = findtext(m,"\n")</code>

That should be 1 instead of 2.
In response to OneFishDown
Oh yeah, you're right. Oops.
In response to Dragon of Ice
There's a far simpler solution to this; surround the text in <pre> tags. =P
<code> mob verb showcode(m as message) world << browse("<pre>[m]</pre>","window=[m]")</ code>
In response to Crispy
Of course, that's assuming he doesn't want color and such to be preserved.