Jump to content

Data processing Notecard with dropped Link-message information causing script failures


Recommended Posts

31 minutes ago, Profaitchikenz Haiku said:

Another wild thought has just occurred to me. The script apparently worked for two days and then stopped working. Did by any chance the notecard that was being fed to the script change? Because although that Notecard reader script is voluminous, I'm sure it can't cope with everything that happens in the universe. It might now be reacting to some quite trivial change in the data that is being supplied to it?

i know your pain. Without a data set to test against then is all pretty much guessing as to why OP is having problems

 

just a general note for anyone reading.  When testing then if we want to find an issue then be systematic

comment out all but the first codeblock (make this as short as possible). Say all the variable values. Check them against what you know the test output at this point should be   

when these are correct, then uncomment the next codeblock. Say the variables and check them against what they should be

and so on

when we have nested inline code and/or multiple conditions then break them out into their own variable assignments. Say these. When the variable values are as they should be then move on.  Sometimes when we inline code then without realising it, we can sometimes change the logic and get different results than what we expect

 

Link to post
Share on other sites

@Mollymews  I am pondering the @Profaitchikenz Haiku comments about tabs. I am trying to remember when I changed from /t to \t  it could be incidental in string splicing as he indicated that he felt there may be a random connection . I did this along the way when I was trying to make data returned from debugging more readable . I am going to try to substitute \t for ~ to see if this makes any notable change .

Hugs Denise x

Link to post
Share on other sites
2 minutes ago, VirtualKitten said:

@Mollymews  I am pondering the @Profaitchikenz Haiku comments about tabs. I am trying to remember when I changed from /t to \t  it could be incidental in string splicing as he indicated that he felt there may be a random connection . I did this along the way when I was trying to make data returned from debugging more readable . I am going to try to substitute \t for ~ to see if this makes any notable change .

Hugs Denise x

yes. is always good to start with the data. Ensure that at each parsing step in the receiver it is as you know/expect it to be

Link to post
Share on other sites
Posted (edited)

Yes its these rotten tabs /t  I think which has been creating this strange behavior +1 ❤️ to @Profaitchikenz HaikuxD the tabs are affecting llParseString2List() in string splicing  wonders why this is not on wiki.

 

however the missing link_messages continue you can see from this debug it should populate he whole list back to drawing board  xD

Apart from my silly mistake reading to many lines in header 13 unluckily for sum, not 24 lol idk what happened there xD

Edited by VirtualKitten
Added printout
  • Like 1
Link to post
Share on other sites
16 minutes ago, VirtualKitten said:

Yes its these rotten tabs /t  I think which has been creating this strange behavior

 

am happy that you got it worked out

the escape code \t is documented here: http://wiki.secondlife.com/wiki/Category:LSL_String

example code:
 

default
{
    state_entry()
    {
        string data = "apple\tbanana\tcarrot";
        llOwnerSay(data);

       // output: apple (4 spaces) banana (4 spaces) carrot
        
        list parsed = llParseString2List(data, ["\t"], []);
        integer i;
        for (i = 0; i < 3; i++)
        {
            llOwnerSay(llList2String(parsed, i));
        }
    }
}

 

 

 

Link to post
Share on other sites
3 hours ago, VirtualKitten said:

Yes its these rotten tabs /t  I think which has been creating this strange behavior +1 ❤️ to @Profaitchikenz HaikuxD the tabs are affecting llParseString2List() in string splicing  wonders why this is not on wiki.

 

however the missing link_messages continue you can see from this debug it should populate he whole list back to drawing board  xD

Apart from my silly mistake reading to many lines in header 13 unluckily for sum, not 24 lol idk what happened there xD

Glad you fixed it.   Reading through the thread, I was wondering if non-printing characters were causing the problem -- I found them a real nuisance until I adopted this technique when I read notecards:

	dataserver(key requested, string data)
	{
		if(kQuery == requested){
			if(EOF	!= data){
				data = llStringTrim(data,STRING_TRIM);//top and tail non-printing characters
				if(llStringLength(data)){//if there's anything left to read
					//go ahead and process the data
				}
				kQuery = llGetNotecardLine(strNotecard,++data);
			}
		}
	}

That precaution saves a great deal of time and frustration, I have learned.

  • Like 2
Link to post
Share on other sites
On 3/2/2021 at 3:33 AM, Mollymews said:

default { state_entry() { string data = "apple\tbanana\tcarrot"; llOwnerSay(data); // output: apple (4 spaces) banana (4 spaces) carrot list parsed = llParseString2List(data, ["\t"], []); integer i; for (i = 0; i < 3; i++) { llOwnerSay(llList2String(parsed, i)); } } }

@Mollymews your example does not d the same thing as my code it probably worked as its completely different I had keys added to list you just have a text printout I am sure it was the tabs now casing this failure suggest no one uses them \t or /t with llParseString2List( is now back working but a bit Skippy 

Link to post
Share on other sites
8 hours ago, VirtualKitten said:

@Mollymews your example does not d the same thing as my code it probably worked as its completely different I had keys added to list you just have a text printout I am sure it was the tabs now casing this failure suggest no one uses them \t or /t with llParseString2List( is now back working but a bit Skippy 

keys when embedded in a string result in string values

example: combining keys and tabs into a string and parsing the combined string back into keys with appropriate type casting
 

default
{
    state_entry()
    {
        list uuids;
        integer i;
        for (i = 0; i < 3; i++)
        {
            uuids += [llGenerateKey()];    
        }
        string data = llDumpList2String(uuids, "\t");

        list parsed = llParseString2List(data, ["\t"], []);
        
        for (i = 0; i < 3; i++)
        {
            key uuid = (key)llList2String(parsed, i);
            llOwnerSay((string)uuid);    
        }
    }
}

 

if your code is still skippy then the issue isn't confined to the use of tabs as a field seperator. There is something else going on. And I suggest that you examine every piece of data in the notecards for mal-formed data, beginning with invalid key (uuid) values

Edited by Mollymews
and
Link to post
Share on other sites

adding to the conversation

if we do want to use tabs as a seperator in a notecard for aesthetic reasons then use the space " " character as the parsing seperator. "\t" is read as 4 spaces

this also deals with the typos when we sometimes mistakenly enter into the notecard, space characters instead of or in addition to tabs

Edited by Mollymews
Link to post
Share on other sites
7 hours ago, Profaitchikenz Haiku said:

I'm never quite sure if it is actually four whole spaces, or sufficient spaces to bring the next character position up to a modulo 4 point?

it depends on the display device. Some move the draw point (in relative surface measurements) to the next tab stop position (modern word processors for example). Others like some of the early text editors that use a fixed-width font do it as you have described. The Linden notecard editor does this as well (even tho it uses a variable-width font)

so while in the notecard editor the string "apple\tbanana\tcarrot" will display (escape) on the notecard display surface as: apple (3 spaces) banana (2 spaces) carrot

the same string "apple\tbanana\tcarrot" will display (escape) on a LSL programmable display surface (primtext, chat/IM) as apple (4 spaces) banana (4 spaces) carrot

 

add: just so that we can clearly see what is happening

if in our notecard editor we type apple[TAB_KEY]banana[TAB_KEY]carrot

then this is escaped in the editor as apple (3 spaces) banana (2 spaces) carrot

and is this escaped value that is read in by llGetNotecardLine. So the suggestion that if we do use TAB_KEY in notecards then parse the line of text with space separator

Edited by Mollymews
(escape)
  • Thanks 1
Link to post
Share on other sites

Seems to me the discussion is running away from the main point rather.

Going back to the original post, 

Quote

I have been writing an update on my piano to read notecard information  through a data server script which provides this to a command script to play . 

The discussion, though, has been all about how to send lists using escaped characters as separators, which is not a good way of separating list items,  via link message, and I can't see what most of this has to do with playing the piano.    

Unless I'm misunderstanding something, someone's chosen a piece of music to play and now the script needs to find the corresponding list of uuids, so as to play them in order.   So you need to read from the notecard enough data to compile a list of uuids for the sound files for the pieces in your repertoire, along with information about timings and so on, and play them.

What do we need all the rest of the stuff for, and what are we doing with it while the music plays?

If you really do need to send the escaped characters, in order to form components of the message when the receiving script reconstructs it, I can think of much more efficient ways of doing it, but I'm not sure if you actually need to do that at all.

Edited by Innula Zenovka
Link to post
Share on other sites
1 hour ago, Innula Zenovka said:

Seems to me the discussion is running away from the main point rather.

Going back to the original post, 

The discussion, though, has been all about how to send lists using escaped characters as separators, which is not a good way of separating list items,  via link message, and I can't see what most of this has to do with playing the piano

the discussion went down the path of "\t" as it was initially being used in the script. Denise changed away from using "\t" to "~" as a separator at Prof's suggestion

which I agree with as tabs in a notecard are escaped to spaces, and any attempt to use "\t" as a list seperator on notecard data fails as there is no "\t" in the string as a result of using the tab key. However this behaviour doesn't negate the use of "\t" as a seperator in the general case, so end up talking about it

 

Link to post
Share on other sites
42 minutes ago, Mollymews said:

at Prof's suggestion

I'd better point out that I merely got lucky, the use of a forward slash at that point looked odd.

If I'm going to be called out on topic-swerving I feel obliged to state that the relevance to playing the piano is given in the opening paragraph as being done by notecard reads, but the poster themselves took us along the path of "SL must be broken because this worked yesterday", and I saw no harm at all in describing various means of keeping software changes under control. There is also the thorny issue of people posting old library scripts here and asking for help on how to modify them or get them working again, such topics will lead into the thorny parts of the garden and so a few (sharp jabs that are euphemisms for the male appendage)s here and there and consequent dodging away are to be expected in such adventures. 

Edited by Profaitchikenz Haiku
Anti-bowdlerising measures
  • Like 1
Link to post
Share on other sites

"I didn't start it"

No, that's not what I meant :) 

For Innula, I hope I didn't come across as snarling in my response, my sense of humour is sort of snarkish but that doesn't imply teeth. My apologies if it did raise a hackle here or there.

As mentioned earlier, the notecard reader in question is horribly   a tad bloated and so it wasn't really going to be on the cards for us to go through it line by line. This was never going to be a straightforward "do X but not Y" exercise. After trudging through all of this I suspect some of us wanted a little light relief :)

  • Like 1
Link to post
Share on other sites
4 minutes ago, Profaitchikenz Haiku said:

the thorny issue of people posting old library scripts here and asking for help on how to modify them or get them working again, such topics will lead into the thorny parts of the garden

i never mean't to put you in it :)

was more that Denise was starting to think that the problem was because of using "/t" and/or "\t". "\t" may have been an issue if TAB was being used in the notecard and it was anticipated that TAB translates to "\t". So I got into it to show why that might or might not be a cause

on the thorny issue, I am of the view that hacking other people's scripts (not those written by the posters themselves) on this forum is probably not the best place to do this.  Best to do in private correspondence I think

am in a correspondence in such a way with a person who is adding new features to a breedable opensource script. My input is that every few days they will send me a notecard detailing what they are intending, show what coding they have done to advance this, and ask questions like how might this be done more efficiently, or that they are not fully understanding what the original code is doing. And I comment back in the notecard on their improvements, explain what the original code is doing, and code snippets that show other ways to do what is intended and what the rationales are for doing it

not that I get into this kind of activity a lot, I tend to only pick the projects that are interesting to me. Interesting meaning coding projects that can get quite complex. A level of complexity which often results in quite sparse source code when efficiency is uppermost. Is parsing down complex functionality into efficient sparse code that is of most interest to me

sometimes I get approached by people who found a script, made some mods to it, then want me to debug it and make it go. I turn this kind of thing away, as I am not much interested in making scripts just go. And to be fair there are lots of scripters already who have their commercial shingles out, who do take on debug and quality assurance work

Link to post
Share on other sites

That's Ok, I regarded you as blameless. "Digresso, ergo sum" - (If you don't speak latin here's a Little Feat equivalent "Driven the back roads so I wouldn't get weighed")

Hacking old scripts in public is like watching porn in the cinema, you can't really let yourself go because it's too crowded. But, I think the lessons that can be learned from them make it justifiable., Also, there is a mindset to sorting out problems in coding that can't be given through straightforward instruction or easy examples, you have to somehow lead people to see in it in the way a zen master gets the pupil to work out the koan.

I personally am against one on one instruction because there's many more who will learn from just standing on the side and watching, but you've got a point, there's quite a few who seem nervous about posting a problem here in the first place, possibly because they've seen one or two rejoinders, and they'll only open up in quiet environments.

 

Link to post
Share on other sites

Prof, you are right that if everything is done in private then the knowledge doesn't get distributed as widely as it does when done in public

my own way of dealing with this is that when I read about a problem on here for which a solution can be better expressed with a whole other different design/approach then sometimes I will write an example/demo using the different approach and post it in the Script Library sub-forum. Sometimes with a link to the forum post that initiated the discussion

i get what you mean tho by cinema porn, not that I have ever been to a porn cinema but still. Often tho tho I feel a bit reluctant to appear critical of a third party script that has been copypasted on here by someone else, even if afterwards I want to poke my own eyes out when I do. Altho it comes with the box I suppose. Publicly post our work  and we are going to get it critiqued sometimes. And with my own posted stuff I am quite happy when the critique results in a better understanding, including my own understanding

 

 

Link to post
Share on other sites

Dear All I have had a chance to get back to this it was not in fact wholly a problem with the function llParse2String( in fact it was caused by sharing a variable  dump which was not cleared by dump=[]; it ended up with keys at the end of it from another initialization using same variable.   I have since created a new variable list for the part that worked and all is good . I also noted some errors with  another post on here for stopping to long button messages.

 

Hugs 

  • Like 1
Link to post
Share on other sites

Ok  So I have my main script playing properly no errors . I have now added this into another script which I call when its ready to play to read next into that script. The first song loads properly the second halts the whole progress dropping the message which is short without reason I have added state llSay and printed a copy of all message loops this is what occurs :

[07:17] New Note Card Reader3.03: {R} H|-91|0|1
[07:17] New Note Card Reader3.03: Lib:-90,  H|-91|-1| Weltschmerz.msu~ Omnia~ Jennifer "Jenny" Evans van der Harten - Weltschmerz~ Jennifer "Jenny" Evans van der Harten~ 10.0~ 4.0~ 15.0~  Pagan folk, Folk; ~ Earth Warrior|-91
[07:17] New Note Card Reader3.03: Lib:header:H|-91|0|1
[07:17] New Note Card Reader3.03: {R} H%7C%2D91%7C0%7C%20Weltschmerz%2Emsu%7E%20Omnia%7E%20Jennifer%20%22Jenny%22%20Evans%20van%20der%20Harten%20%2D%20Weltschmerz%7E%20Jennifer%20%22Jenny%22%20Evans%20van%20der%20Harten%7E%2010%2E0%7E%204%2E0%7E%2015%2E0%7E%20%20Pagan%20folk%2C%20Folk%3B%20%7E%20Earth%20Warrior%7C%2D91
[07:17] New Note Card Reader3.03: Lib:-90,  H|-91|-1| Weltschmerz.msu~ Omnia~ Jennifer "Jenny" Evans van der Harten - Weltschmerz~ Jennifer "Jenny" Evans van der Harten~ 10.0~ 4.0~ 15.0~  Pagan folk, Folk; ~ Earth Warrior|-91
[07:17] New Note Card Reader3.03: Lib:header:H|-91|0| Weltschmerz.msu~ Omnia~ Jennifer "Jenny" Evans van der Harten - Weltschmerz~ Jennifer "Jenny" Evans van der Harten~ 10.0~ 4.0~ 15.0~  Pagan folk, Folk; ~ Earth Warrior|-91
[07:17] New Note Card Reader3.03: {R} M%7C%2D91%7C0%7C%20Weltschmerz%2Emsu%7C%2015%2E0%7C1
[07:17] New Note Card Reader3.03: {3}Lib:M:M|-91|0| Weltschmerz.msu| 15.0|1
[07:17] New Note Card Reader3.03: Lib:M, -91, 0,  Weltschmerz.msu,  15.0, 1
[07:17] New Note Card Reader3.03: State Change: s_config_single
[07:17] New Note Card Reader3.03: State Change: s_active
[07:17] New Note Card Reader3.03: Sending start load:0,H|-101|1|0
[07:17] New Note Card Reader3.03: Go to  slave controller:H|-101|1|0,num:-101
[07:17] New Note Card Reader3.03: {1} SR: -101, $ M|-101|1|0||0
[07:17] New Note Card Reader3.03: {1(1)} SR: -101, $ M%7C%2D101%7C1%7C0%7C%7C0
[07:17] New Note Card Reader3.03: {R} M%7C%2D101%7C1%7C0%7C%7C0
[07:17] New Note Card Reader3.03: {3}Lib:M:M|-101|1|0||0
[07:17] New Note Card Reader3.03: Lib:M, -101, 1, 0, 0
[07:17] New Note Card Reader3.03: State Change: s_config_single



 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...