Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

simple text question

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
11-27-2007 13:40
i went stupid wile scripting my stuff, is there a posible way to do something like this


CODE

{
llSay(0,"test");
}


to something like this

CODE

integer something = test

{
llSay(0,something);
}


im sure it isnt integer that i would use but is that type of way posible?
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
11-27-2007 14:06
Sure. But you would have to use string something = test instead. The value of test would be copied into something and it should work fine.
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
11-27-2007 15:09
that is what i thought, was sure integer wouldnt do it
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
11-28-2007 03:05
llSay (0,"test";); //.... is called a string literal
.
.
.
string something = "test"; //... declaration of a string type variable
llSay (0,something); // .... will print the variable named 'something'
.
.
.

integer x = 1; //.... is an integer type variable;
llSay (0, (string)x); //... will print the numeric value of what's stored in the integer variable 'x'
.
.
.
all variables printed with llSay() or llSetText() have to be strings, you can cast a variable of one type into another temporarily, as I'm doing in the last example above...

integer x = 5;

llSay (0,(string)x);

read the wiki section on variable types and casting.
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
11-28-2007 03:15
From: Mrc Homewood
i went stupid wile scripting my stuff, is there a posible way to do something like this


CODE

{
llSay(0,"test");
}


to something like this

CODE

integer something = test

{
llSay(0,something);
}


im sure it isnt integer that i would use but is that type of way posible?


Absolutely.

llSay(0,(string)something);

you have to convert to a string if its not, then it'll work.
_____________________
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
11-28-2007 03:51
And integers are for integer numbers, you can use it for strings.

http://lslwiki.net/lslwiki/wakka.php?wakka=types