Jump to content

data processing from a notecard


Pedlar Decosta
 Share

You are about to reply to a thread that has been inactive for 1384 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm hoping someone will be kind enough to help. I am processing a list into a notecard and then reading that list in another script. It has various data types in the list. In all, there is a total of about 22 elements. Using dataserver I'm processing them back into the correct types and using them. However, (and this has only become a problem once I added more to the list up from 14 separate elements), it is not processing all the data. It seems to fall short around 14 (which is a vector and the list ends like this "<0.0"). I'm concluding this because A: the other data are missing and B: I added a feedback llSay function to evaluate the end processed data. I thought maybe it was a limitation of the data put into a CSV string (like the character limit if you cast a string into open chat), but the other script didn't have a problem making it. I then thought maybe it is a memory problem, so I tried processing twenty two 11 and 12 digit numbers and it processed fine. Perhaps with the various data types it uses more memory and has hit some limit I can't find mentioned ?

I'm stumped basically. lol. Can anyone shed some light on it ?

    dataserver( key queryid, string data )
    {  
        list sort;
        string name;  // object name that wrote the CSV
        string count;
        temp = [];
        if(queryid == QueryID)
        {
            if(data != EOF)
            {
                if(llGetSubString(data, 0, 0) != "#" && llStringTrim(data, STRING_TRIM) != "" )
                {
                     temp = llParseString2List(data, ["^"], []);  // just to separate the useable data from the name
                     name = llStringTrim(llToLower(llList2String(temp, 0)), STRING_TRIM);
                    count = llStringTrim(llList2String(temp, 1), STRING_TRIM);

                     sort += llCSV2List(count);

            //Then casting the data back to their types and using them

                }
                NotecardLine++;
                QueryID = llGetNotecardLine( CONFIG_CARD, NotecardLine);
            }                   
        }  
    }

Edited by Pedlar Decosta
missed a line of code
Link to comment
Share on other sites

I'm not quite sure what you are doing, but it looks as if you are breaking each line of data from the notecard into two parts:  (1) the object name and (2) a string called count that contains everything else. Then, you are converting count into a comma-delimited list called sort, which you then separate into pieces and "cast the data back to their types and use them."

You haven't included the important bit of code that shows how you plan to evaluate the various parts of sort, but I can tell you that if you are separating them by looking for commas, then you are ripping vectors and rotations into pieces.  A vector like

<13.56, 784.9, 500.10>

will be interpreted potentially as a string ( "<12.56"), a float (784.9), and another string ("500.10>"), which is not what you intended.  If you want to keep variables separate so that you can typecast them reliably, you can't use commas to delimit them.  Separate them with "~" or "$" or something else.

Edited by Rolig Loon
typos, of course
  • Like 1
Link to comment
Share on other sites

Hi Rolig and Wulfie, thanks for your replies. Sorry, I thought that code would have the answer in it as that is where the data is being lost. The stuff that comes after it is only able to use the list prior to it falling off. It is basically all about primitive parameters and I have been using it for a few years with no problems UNTIL I decided to update it and add support for advanced materials. So by this code below, it fails at the point half way through the normal material data and subsequently fails the specular as well. The code originally stopped at the bump shiny data.

I have added some notes below to show you what I mean. Any help is appreciated

    dataserver( key queryid, string data )
    {  
        list sort;
        string name;
        string count;
        temp = [];
        
        if(queryid == QueryID)
        {
            if(data != EOF)
            {
                if(llGetSubString(data, 0, 0) != "#" && llStringTrim(data, STRING_TRIM) != "" )
                {
                     temp = llParseString2List(data, ["*"], []);
                     name = llStringTrim(llToLower(llList2String(temp, 0)), STRING_TRIM);
                    count = llStringTrim(llList2String(temp, 1), STRING_TRIM);
                    sort += llCSV2List(count);
                 llOwnerSay("sort = "+llList2CSV(sort));   //PUT THIS IN TO TRY AND WORK OUT WHAT WAS GOING ON THE RESPONSE WAS - "sort = 0, 0bbc7abf-3b53-3200-eef9-2be67576db08, <1.00000, 1.00000, 1.00000>, 1.000000, <0.00000, 0.00000, 0.00000>, 0.000000, <1.00000, 1.00000, 0.00000>, 0, 0.000000, 0, 0,00000000-0000-0000-0000-000000000000, <1.000000, 1.000000, 0.000000>, <0.0 " WHICH IS WHY I ONLY SUPPLIED THAT PART OF THE CODE
                Face = llList2Integer(sort,0);
                Texture = llList2String(sort,1);
                Color = llList2Vector(sort,2);
                Alpha = llList2Float(sort,3);
                Tex_Offset =(vector)llList2String(sort, 4);
                Tex_Rotation = (float)llList2String(sort, 5);
                Tex_Scale = (vector)llList2String(sort, 6);   
                llSetTexture( llList2String(sort, 1), Face);
                llSetColor((vector)llList2String(sort,2),Face);
                llOffsetTexture(Tex_Offset.x,Tex_Offset.y,Face);
                llRotateTexture(Tex_Rotation, Face);
                llScaleTexture(Tex_Scale.x, Tex_Scale.y, Face);
                llSetLinkPrimitiveParamsFast(LINK_THIS,[Bright,Face,(integer)llList2String(sort,7)]);
                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,Face,(float)llList2String(sort,8)]);
                llSetAlpha(Alpha, Face);  
                llSetLinkPrimitiveParamsFast(LINK_THIS,[
PRIM_BUMP_SHINY,Face,(integer)llList2String(sort,9),(integer)llList2String(sort,10)]); // THE OLD CODE ENDED HERE AND NEVER HAD ANY ISSUES

                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_NORMAL,Face, llList2String(sort,11),llList2Vector(sort,12), llList2Vector(sort,13), llList2Float(sort,14)]);  //HERE IS WHERE THE DATA FAILS, BUT IT IS REALLY HAPPENING BEFORE IT GETS TO THE LIST "SORT"
                llSetLinkPrimitiveParams(LINK_THIS,[PRIM_SPECULAR,Face,llList2Key(sort,15), llList2Vector(sort,16), llList2Vector(sort,17), llList2Float(sort,18), llList2Vector(sort,19), llList2Integer(sort,20), llList2Integer(sort,21)]);
                }
                NotecardLine++;
                QueryID = llGetNotecardLine( CONFIG_CARD, NotecardLine);
            }                   
        }  
    }

Link to comment
Share on other sites

Just in case this helps, here is an example of the code that is in the notecard in it's entirety (except there is one for every face)

Object: *0,0bbc7abf-3b53-3200-eef9-2be67576db08,<1.00000, 1.00000, 1.00000>,1.000000,<0.00000, 0.00000, 0.00000>,0.000000,<1.00000, 1.00000, 0.00000>,0,0.000000,0, 0,00000000-0000-0000-0000-000000000000, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000,b8e82288-c577-42be-1500-5cadbbe337f2, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000, <1.000000, 1.000000, 1.000000>, 51, 0

Edited by Pedlar Decosta
spellcheck lol
Link to comment
Share on other sites

42 minutes ago, Pedlar Decosta said:

*0,0bbc7abf-3b53-3200-eef9-2be67576db08,<1.00000, 1.00000, 1.00000>,1.000000,<0.00000, 0.00000, 0.00000>,0.000000,<1.00000, 1.00000, 0.00000>,0,0.000000,0, 0,00000000-0000-0000-0000-000000000000, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000,b8e82288-c577-42be-1500-5cadbbe337f2, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000, <1.000000, 1.000000, 1.000000>, 51, 0

Are you putting all of this on a single line on a notecard? Scripts can't read more than the first 255 bytes of a line.

The "cut off" you're seeing isn't exactly at 255 characters, but it's very conveniently close, the discrepancy could be explained by the formatting...

Edited by Wulfie Reanimator
  • Like 2
Link to comment
Share on other sites

Hi again Wulfie :) 

yes, I thought that might have had something to do with it.But then I was thrown off because the other script generated the entire list without problems every time. Oh well. Everything up to the bump_shiny was under it. So how would you suggest fixing it... would it be better to break it up prior to generating it (in the other script), or here, in the dataserver ? I'm struggling to think of a way to do it in the dataserver event i.e. how to read part of a line for 1 list and then read the 2nd half for another. I guess I could do it with Parsing, but as you say, it does have problems. Which is why I asked for help. Where as it is not difficult to just put the information into 2 lists to begin with. ...I think I answered my own question, but your opinions are appreciated.

Link to comment
Share on other sites

30 minutes ago, Pedlar Decosta said:

Hi again Wulfie :) 

yes, I thought that might have had something to do with it.But then I was thrown off because the other script generated the entire list without problems every time. Oh well. Everything up to the bump_shiny was under it. So how would you suggest fixing it... would it be better to break it up prior to generating it (in the other script), or here, in the dataserver ? I'm struggling to think of a way to do it in the dataserver event i.e. how to read part of a line for 1 list and then read the 2nd half for another. I guess I could do it with Parsing, but as you say, it does have problems. Which is why I asked for help. Where as it is not difficult to just put the information into 2 lists to begin with. ...I think I answered my own question, but your opinions are appreciated.

You would have to break up the data into multiple lines. You can't read the first 255 characters and then the next 255 characters. You can only read the first 255 characters, because anything beyond 255 in a notecard doesn't exist for scripts.

Edited by Wulfie Reanimator
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

ahh. yes. of course. thanks mate. Why didn't I think of that? lol I will break up the lines in the notecard in the first script. And then put them in different lists in the 2nd script to make it easy to apply them in the right place. I think that should fix the problem. Thank you so much.

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1384 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...