Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llList2Integer ?

Jenny Carlos
Registered User
Join date: 30 Aug 2005
Posts: 52
09-03-2005 11:51
listen(integer channel,string name,key id,string msg)

{
list int = llParseString2List(msg, [" "], []);
integer rnt = llList2Integer(int, 1);


The code bit above has been stumping me, Let me explain what im doing and then maybe someone can understand my questions.

First off my gues is that int is taking the values of msg ,
msg im thinking would be the sent string from the channel and owner if I set it up that way and then creating a list from the string recieved.

Then I use rnt to store the first part of the string stored in int.

Well how the heck is this list created and stored?
How do I send a string that is usefull for llParseString2List to use?

I could use some in depth info about llParseString2List and how it works.

Ive got example code im useing just as test and ive got a simple listen on channel 2.
Ive got if commands that sort out the listens,
For example If /2 Effect 10 was typed and sent the script displays the value of rnt.
BUT rnt is always 0 for me I cant get it to find 10 in the list , Isnt that the second thing that would be in the list?

Maybe a simple example code that works that someone could post for me and some detailed info on where and how everything is being stored and is going lol..

Its just got me stumped .

Thanks again everyone
Jenny Carlos
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
09-03-2005 11:54
You want this:

listen(integer channel,string name,key id,string msg)

{
list int = llParseString2List(msg, [" "], []);
integer rnt = (integer)llList2String(int, 1);
}

The list you get from parsing is made of strings. When llList2Integer tries to get an integer, when it's given a string, it returns 0.
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Jenny Carlos
Registered User
Join date: 30 Aug 2005
Posts: 52
09-03-2005 12:04
Isnt that called typecasting? Seems like I tried that..
Ill try it now and and see if it works, But I still dont know how commands would be entred on the channel in order for the list to determine what is in what place of order in the list?

Do you use coma or something to tell it its a new list item or just plain spaces?
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
09-03-2005 13:06
Yes, it is typecasting. Changing it from being a string to being an integer.

I'm not exactly sure what you're asking, but this page of the scripting wiki should help:
http://secondlife.com/badgeo/wakka.php?wakka=llParseString2List

You can specify whatever seperators you want, to tell it how to know when it has got to the next element of the list. Eg:

string foo = "1&2&3";
list bar = llParseString2List(foo, ["&"], []);

Then bar is the list [1,2,3].
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Jenny Carlos
Registered User
Join date: 30 Aug 2005
Posts: 52
09-04-2005 08:53
Woot Thanks for this info that helps me understand it a whole lot more.