Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

ENTER in strings

GaL Soyer
Registered User
Join date: 24 Feb 2006
Posts: 47
04-02-2007 04:36
i made that:

string str="Hello! \n How are you?";

llSetText(str,......)

and the text shown as:

Hello! \n How are you?

and not as i want :

Hello!
How are you?

why? how can i made ENTER?
Buxton Malaprop
Mad Physicist
Join date: 8 Jun 2005
Posts: 118
04-02-2007 04:53
Try the win32-style \r\n code instead of just \n? I know it's possible to do linebreaks in llSetText, and I think that's how (can't get in-world to test it right now though).
_____________________
Phillip and Griefers Sitting In A Tree
K-I-S-S-I-N-G
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
04-02-2007 07:02
This worked fine for me:


llSetText("Hello! \n How are you?", <1,0,0>, 1.0);
GaL Soyer
Registered User
Join date: 24 Feb 2006
Posts: 47
04-02-2007 07:34
yea its works if you right into the function like you did but it doesnt work for...

wait, look at this and you will understand (it works!) -

FROM WIKI:
The following code fixes the "\n" not being converted in literal cases. Chat input, variables, etc... -SiRiSAsturias
msg = llDumpList2String(llParseString2List(msg, ["\\n"], []), "\n";);
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-02-2007 07:43
From: GaL Soyer
yea its works if you right into the function like you did but it doesnt work for...

wait, look at this and you will understand (it works!) -

FROM WIKI:
The following code fixes the "\n" not being converted in literal cases. Chat input, variables, etc... -SiRiSAsturias
msg = llDumpList2String(llParseString2List(msg, ["\\n"], []), "\n";);


basically you have to escape the \'s to \\ as per the example code you show.
This is a hang over from the standard C runtime libraries
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
04-02-2007 07:48
From: GaL Soyer
yea its works if you right into the function like you did but it doesnt work for..


This works for me too:

CODE

string g_Hello = "Hello! \n How are you?";

default
{
state_entry()
{
llSetText(g_Hello, <1,0,0>, 1.0);
}
}
Cindy Crabgrass
Crashed to Desktop
Join date: 9 Sep 2006
Posts: 158
04-02-2007 07:54
I guess its not the same at all SL versions (or Operating Systems) :confused:

This one :
CODE

string g_Hello = "Hello! \n How are you?";
default
{
state_entry()
{
llSetText(g_Hello, <1,0,0>, 1.0);
}
}


works fine for me, with SL 1.14.0 and Win XP SP2