Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Novice: String inside a string?

azure Milev
Registered User
Join date: 5 Jan 2008
Posts: 4
03-18-2008 16:39
Howdy all,
I'm relatively self taught at scripting, and I'm trying to figure out if it's possible to put a predefined string and text inside another string? if it is, can somebody post a short example of how to code it?

Here's a short simplified example of what I'm trying to do. Not posting the entire script because it's massive and the three parts (including where I defined what is inside line7 are difficult to find visually). Basically, I'm trying to define a string that includes both text and strings within it.

string line7;
string text01 = "text"+line7+"text"

I only know how to combine text and string inside the llSay function, and trying to figure out if it's possible to do it or something like it inside a string. Thankyou kindly for any help you have to offer.
...azure

duh, I'm a doof. figured it out. ((would delete this if knew how)) the string text01 coding does work, just wasn't putting it into the correct place.
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
03-18-2008 18:02
I dont know if this is that you need
Here the code
CODE


// www.lsleditor.org by Alphons van der Heijden (SL: Alphons Jano)

string texT1="A";
integer plusText=0;
integer switch = 0;//Just for on and off

default
{
state_entry()
{
llSay(0, "Im Off and ready");
llSetTimerEvent(0.0);
}
touch_start(integer total_number)
{
if (switch==0)
{ llSay(0, "im On and counting..");

llSetTimerEvent(5.0);
switch=1;
}else if(switch==1)
{ llSay(0, "Im Off");

llSetTimerEvent(0.0);
switch=0;
texT1="A";//set the string like at the begining
plusText=0;//set theinteger like at the begining

}

}
timer()
{
plusText +=1;
texT1=texT1+(string)plusText;//this (string)is for convert first the integer to string first /the texT1=texT1+ -->take your old text update and add teh new text result of the plusText+=1
llSay(0, "My text is:"+" "+ texT1);

}
}


Try it and let me know ;)