For example - in on-rez I need to read a texture name from a notecard - In one instance the script work well and I get it - yet in the other, the string's default value remains.
I am using query keys to identify each - I think it is something to do with the time it takes to answer a dataerver query.
I note in Wiki that it says that queries are not necessarily answered in the position they are placed in the script (my interpretation)
It is fairly - ney! drastically important that I get the query answered before moving on to the next command.
See if this helps:
//===Set Variables================================
//================================================
//......
integer noteline;
// line number on the notecard
key noteQuery;
// identify Dataserver request for notecard line
string textureStore = "rubbish";
//the texture to be preloaded
string noteSheet = "configuration";
// name of notecard with sheet textures
//================================================
//=== noteRead function ==========================
//=== does not work in on_rez ====================
//================================================
//Used to lift texture names from the notecardSheet notecard
noteRead()
{
noteQuery = llGetNotecardLine(noteSheet, noteline);
//Get the contents of a notecard line
}
//......
//......
//================================================
//================================================
//=== States =====================================
//================================================
//================================================
default
{
//================================================
//=== on_rez =====================================
//================================================
on_rez(integer start_param)
{
llSetTexture("Working Cover", ALL_SIDES);
//set a standard texture to the prim (this may vary, different textures same name)
//=====================preload the first content texture ===================tbd=========
noteline = 0;
//noteRead();
//like to do this because need to do the same thing in
//another state, but doesn't work here
noteQuery = llGetNotecardLine(noteSheet, noteline);
// Get the contents of notecard first line
llSetTexture(textureStore, 5);
//preload the texture into the hollow prim face (5)
llWhisper(0,"Texture stored preloading is " + textureStore);
//Test Line - the results are correct here for one of the prims
//but not the other
}
//================================================
//=== touch_start ================================
//================================================
touch_start(integer touch_num)
{
//.......................
}
dataserver(key queryid, string data)//Get the result of the request
{
if (queryid == noteQuery)
// Is the result of the query the a line of the notecard?
{
if (data == EOF)//Is it the end of the Notecard?
{
//Yes it is ..........
}
else
{
// No it is not ......
textureStore = data;
llWhisper(0, "textureStore = " + textureStore);
//This line correctly in both prims
}
}
else
{
if (data == "0"

{
//......other queries occur here - all work OK
{
}
// ........
}