|
marc8300 Beltran
Registered User
Join date: 28 Dec 2006
Posts: 9
|
03-05-2007 12:01
Hello everyone,
I have tried different times to read 2 or 3 lines from a notecard, by using some simple scripts and examples i found, but i can same it to get it working.
I need a kind a script that reads line one (name), 2 and 3, to see if that person is 'on the list' so to speak, anybody that could help me out.
I have some experiecence with scripting but not a lot
thanks
marc
|
|
Mechant Boucher
Registered User
Join date: 26 Feb 2007
Posts: 4
|
03-05-2007 12:11
You will have to use this function to get the number of lines the Notecard contains : http://wiki.secondlife.com/wiki/LlGetNumberOfNotecardLinesThen get each line using this function : http://wiki.secondlife.com/wiki/LlGetNotecardLineHere's a small example : integer nLines = llGetNumberOfNotecardLines("My Notecard") // has to be in the object's inventory integer i;
for (i = 0; i < nLines; i++) { string lText = llGetNotecardLine("My Notecard", i); llSay(0, "Line #" + (string)i + " : " + lText); }
This script has to be in the same Object as the Notecard. I hope that helped 
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
03-05-2007 12:44
The following is an example of how to read a notecard: http://lslwiki.org/index.php/LlGetNotecardLineThe following has been modified from the preceding article to include declarations of the global variables:
string gName="the name of your notecard"; integer gLine; integer gQueryID; default {
state_entry() { gQueryID = llGetNotecardLine(gName, gLine); // request first line } dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { // not at the end of the notecard llSay(0, (string)gLine+": "+data); // output the line ++gLine; // increase line count gQueryID = llGetNotecardLine(gName, gLine); // request next line } } } }
You need to compare the query_id with gQueryID because the dataserver is responsible for returning all kinds of data, so the query_id is used to correlate the dataserver's response with your query. -2fast
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
03-05-2007 12:53
From: 2fast4u Nabob ...query_id with gQueryID because the dataserver is responsible for returning all kinds of data... True but he only needs this if you're doing other dataserver things. If you're only using it to read notecards, don't bother with the overhead of remembering & checking it. To Mechant Boucher.. Uhh.. Might want to test your script out some more.. 
|
|
marc8300 Beltran
Registered User
Join date: 28 Dec 2006
Posts: 9
|
second script giving me a error
03-05-2007 23:45
string gName="test"; integer gLine; integer gQueryID; default {
state_entry() { gQueryID = llGetNotecardLine(gName, gLine); // request first line } dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { // not at the end of the notecard llSay(0, (string)gLine+": "+data); // output the line ++gLine; // increase line count gQueryID = llGetNotecardLine(gName, gLine); // request next line } } } }
this script is given me a type mismatch error, by looking to other scripts i changed the integer gQueryID; line into key gQueryID; script is not giving me a error anymore, but also it does not say the lines in given in the notecard, it does nothing, the script is was working on, give me alway the oct code instead of the ascii text
where is my fault then ?? i don't understand at all thanks for any help given
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-06-2007 01:47
The correction you made is correct and it shoudl function. Check that the script is still set to run as a compilation error will sometimes unset the check box.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-06-2007 05:25
Further investigation has shown this to have been a problem with the notecard. If you use any characters above 127 then any llGetNotecardLine will return a null string. The same problem will happen if your notecard has previously had any embedded objects, i.e. land marks or tetures, added to it. Check this post for more details.
|