im taking your advice and useeinf "llGetLinkedName(llDetectedLinkNumber(0));" works great. thanks for that advice.
NOW here is my problem. i put the buttons uner the "touch_start" section of the script.
so it looks something like this....
CODE
touch_start(integer num_det)
{
string button = llGetLinkName(llDetectedLinkNumber(0));
if (button == "Rock")
{
nkey = llGetNotecardLine("Rock", nline);
llOwnerSay("Rock notecard loaded");
initialize("");
}
else if (button == "Tile")
{
llGetNotecardLine("Tile", nline);
llOwnerSay("Tile notecard loaded");
initialize("");
}
}
now i know one of then just had the GetNotecardLine and the other one says nkey = blah blah blah. i did that trying diffrent methods. either way i work it it loads up the same notecard. dont think its supposed to work like that. so the way i have it written, especially with the Tile button, it should load up that notecard and display the information in it. yes i have the notecard in there with something written in it. so im thinking its something in the dataserver part maybe.
CODE
list text1; // All the lines from from the first card
list text2;
list text3;
list text4;
list text5;
list text6;
list text7;
list text8;
list text9;
list text10;
list text11;
list text12;
list text13;
list text14;
list text15;
list text16;
string card1 = "Rock"; //Set these to the name of the inventory item.
string card2 = "Tile";
string card3 = "Stone";
string card4 = "Wood";
string card5 = "Organic";
string card6 = "Fabric";
string card7 = "Glass";
string card8 = "Metal";
string card9 = "Water";
string card10 = "Ground";
string card11 = "Wall";
string card12 = "Floor";
string card13 = "Building";
string card14 = "Wallpaper";
string card15 = "Road";
string card16 = "Misc";
//Temporary variables for processing
string texture_card; // Name of the card to be read.
list texture_info; // The resulting data pushed into a list
integer nline; // The line count for the card reader
key nkey; // The key of thge card being read
initialize(string _action) {
//Due to the execution order when using dataserver, this function sets the first card to
//be read, and the excetuion finishes when called again with the _action set to "finish".
if (_action == "") {
llOwnerSay("initialize if");
loadNoteCard(card1);//the first card was never being called
}
else if (_action == "finish") {//needed == not = common mistake
llOwnerSay("initialize finish");
// All cards have been read into the lists... now you can do any kind of string
// manipulations to get the data you need to set your script.
// But here we will prove that the cards have been read with a loop
integer end = llGetListLength(text1);
// Don't be a noob scripter - evaluate end once
// for (i=0; i< LLGetListLength(gOneCard); i++)
// is just so wrong and laggy! THINK and reduce lag.
integer i;
for (i = 0; i < end; i++)
llSay(0, llList2String(text1, i));
end = llGetListLength(text2);
for (i = 0; i < end; i++)
llSay(0, llList2String(text2, i));
end = llGetListLength(text3);
for (i = 0; i < end; i++)
llSay(0, llList2String(text3, i));
end = llGetListLength(text4);
for (i = 0; i < end; i++)
llSay(0, llList2String(text4, i));
end = llGetListLength(text5);
for (i = 0; i < end; i++)
llSay(0, llList2String(text5, i));
end = llGetListLength(text6);
for (i = 0; i < end; i++)
llSay(0, llList2String(text6, i));
end = llGetListLength(text7);
for (i = 0; i < end; i++)
llSay(0, llList2String(text7, i));
end = llGetListLength(text8);
for (i = 0; i < end; i++)
llSay(0, llList2String(text8, i));
end = llGetListLength(text9);
for (i = 0; i < end; i++)
llSay(0, llList2String(text9, i));
end = llGetListLength(text10);
for (i = 0; i < end; i++)
llSay(0, llList2String(text10, i));
end = llGetListLength(text11);
for (i = 0; i < end; i++)
llSay(0, llList2String(text11, i));
end = llGetListLength(text12);
for (i = 0; i < end; i++)
llSay(0, llList2String(text12, i));
end = llGetListLength(text13);
for (i = 0; i < end; i++)
llSay(0, llList2String(text13, i));
end = llGetListLength(text14);
for (i = 0; i < end; i++)
llSay(0, llList2String(text14, i));
end = llGetListLength(text3);
for (i = 0; i < end; i++)
llSay(0, llList2String(text15, i));
end = llGetListLength(text3);
for (i = 0; i < end; i++)
llSay(0, llList2String(text15, i));
end = llGetListLength(text16);
for (i = 0; i < end; i++)
llSay(0, llList2String(text16, i));
}
}
loadNoteCard(string _notecard) {
texture_info =[]; //clear the temp lines
texture_card = _notecard;
nline = 0;
llOwnerSay("loadNoteCard name = " + texture_card);
nkey = llGetNotecardLine(texture_card, nline);
}
notecardFinished(string _notecard) {
// Called at the end of each notcard as it is read. The temp results are stored
// and the next card is commanded to be read.
if (_notecard == card1) {
card1 = texture_card;
loadNoteCard(card2);
}
else if (_notecard == card2) {
card2 = texture_card;
loadNoteCard(card3);
}
else if (_notecard == card3) {
card3 = texture_card;
loadNoteCard(card4);
}
else if (_notecard == card5) {
card5 = texture_card;
loadNoteCard(card6);
}
else if (_notecard == card7) {
card7 = texture_card;
loadNoteCard(card8);
}
else if (_notecard == card8) {
card8 = texture_card;
loadNoteCard(card9);
}
else if (_notecard == card9) {
card9 = texture_card;
loadNoteCard(card10);
}
else if (_notecard == card10) {
card10 = texture_card;
loadNoteCard(card11);
}
else if (_notecard == card12) {
card12 = texture_card;
loadNoteCard(card13);
}
else if (_notecard == card13) {
card13 = texture_card;
loadNoteCard(card14);
}
else if (_notecard == card14) {
card14 = texture_card;
loadNoteCard(card15);
}
else if (_notecard == card15) {
card15 = texture_card;
loadNoteCard(card16);
}
else if (_notecard == card16) {
card16 = texture_card;
initialize("finish"); // Finally pass exection to finish the initialization.
}
}
default {
state_entry() {
}
touch_start(integer num_det)
{
string button = llGetLinkName(llDetectedLinkNumber(0));
if (button == "Rock")
{
nkey = llGetNotecardLine("Rock", nline);
llOwnerSay("Rock notecard loaded");
initialize("");
}
else if (button == "Tile")
{
nkey = llGetNotecardLine("Tile", nline);
llOwnerSay("Tile notecard loaded");
initialize("");
}
}
dataserver(key _query_id, string _data) {
if (_query_id == nkey) {
// this is a line of our notecard
if (_data != EOF) {
// increment line count
texture_info +=[_data];
//request a next line
nline++;
nkey = llGetNotecardLine(texture_card, nline);
}
else {
//The notecard has been read
//notify end of read
llOwnerSay(llList2CSV(texture_info));
llOwnerSay(texture_card = " read");
notecardFinished(texture_card);
}
}
}
}
there is what it looks like now.