I made a test script to read a notecard within an object as show below:
CODE
integer iNotecardIndex;
integer CardLine = 0;
key CardDataRead;
string sNotecardName;
string CardName;
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
CardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
CardDataRead = llGetNotecardLine(CardName, CardLine);
}
dataserver (key Data_id, string CardData) {
if (Data_id == CardDataRead) {
if (CardData !=EOF) {
llSay(0, (string)CardLine+": "+CardData);
++CardLine;
CardDataRead = llGetNotecardLine(CardName, CardLine);
}
}
}
}
This is mostly based of a script from LSL Wiki. This works perfect - YAY!
When I transplant that into my main script where it is needed it turns into this:
CODE
integer ENT = 0;
integer iNotecardIndex;
integer CardLine = 0;
key CardDataRead;
string sNotecardName;
string CardName;
// This is a basic security function that will allow two preset people to open the door only.
doorlock(string whoisit)
{
ENT = 0 ;
CardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
CardDataRead = llGetNotecardLine(CardName, CardLine);
}
dataserver (key Data_id, string CardData) {
if (Data_id == CardDataRead) {
if (CardData !=EOF) {
if ( whoisit = CardData)
{
ENT = 1;
}
++CardLine;
CardDataRead = llGetNotecardLine(CardName, CardLine);
}
}
}
And then promptly throws up a syntax error on the "dataserver" command and fails to save/work.
Can anyone see what the heck I have done wrong there? The code that reads the nodecard is an exact copy. I cannot see why SL is failing to save/run that at all.
Can anyone see what I Cannot and tell what I have done wrong?
Thanks
Klaire - who is off to bed to sleep on this...