| Scripting Discuss scripting for SL and other platforms |
| |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Junior Member ![]()
Open Grid addict
Join Date: Jul 2009
Posts: 11
My Mood: | I have a script which outputs 2 lines of text into a hidden chat channel, and I need another prim to take those 2 lines of text and turn each line into a separate string for later usage.. just to be sure what I mean, this is the text im outputing "City Of Dweller NE" + "\n" + "<40,99,32>" I am thankfull for any help A code snippet would be great!
__________________ Ignorance is bliss, you dont realise that it is infinatley more complicated than it appears at first glance. |
| | |
| | #2 (permalink) |
| Free, not cheap ![]() ![]() ![]()
Buttercup without a witty
retort? Huh, imagine that!
| A couple ways I can see you going about this. First, if it's necessary to send the output all as a single string, you can parse it into a list and assign them to variables that way, like so: Code: integer CHANNEL = -123; // listening on this channel
list myList;
string myRegion;
string myCoordinates;
default{
state_entry()
{
llListen(CHANNEL, "", llDetectedKey(0), "");
}
listen(integer channel, string name, key id, string message)
{
myList = llParseString2List(message, ["\n"], [""]);
myRegion = llList2String(myList, 0);
myCoordinates = llList2String(myList, 1);
}
}
Code: integer CHANNEL = -123; // listening on this channel
string myRegion;
string myCoordinates;
default{
state_entry()
{
llListen(CHANNEL, "", llDetectedKey(0), "");
}
listen(integer channel, string name, key id, string message)
{
if( llGetSubString(message,0,0) == "<" )
myCoordinates = message;
else
myRegion = message;
}
}
Last edited by Free Xue; 10-29-2009 at 08:01 PM. Reason: edit follow up... |
| | |
![]() |
| Thread Tools | |
| Display Modes | |
| |