Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dataserver problem

Klaire Larnia
Learner, be gentle....
Join date: 2 Jun 2008
Posts: 41
05-22-2009 15:36
Ok I am really really confused....

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...
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
05-22-2009 16:57
At the bare minimum, every script needs a default state. You will also need an event; touch_start, state_entry, listen, on_rez, etc to call the data server event.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-22-2009 18:45
Also, for when you get this working again, you PROBABLY meant "if ( whoisit == CardData)". Note the double equals sign for a comparison. You had a single equals sign, which is an assignment.

EDIT: Oops. Actually, I see "whoisit" isn't even in scope there, unless there are some more global variables you aren't showing.