Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dataserver Tutorial

Aakanaar LaSalle
Registered User
Join date: 1 Sep 2006
Posts: 132
09-20-2006 19:21
Well, again in that sniplet you posted above you're using variables as MENU_ and couple others that I don't see declared anywhere.. I'm guessing I'm not seeing the whole script.

And i see that the llGetNotecardLine calls inside the listen event doesn't use the same format as what We setup in the state_entry. They need to, or else they'll get ignored.

Couple other things I'd like to check on that too. Check your private message.. I send you one with my email.. shoot me an email and let's get to work on this.. possibly meet in game too.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
09-21-2006 01:16
From: Landing Normandy
...
I know we're so close, it does work to a degree, like now it reads all three notecards, which is great. If we could just figure out why it will never read another line.


It never gets asked to read another line is why. Or at least the code fragment you posted doesnt. You are only submitting one dataserver request on state entry.

Look back at the original code I posted, you will see that after processing the current data it requests the next line:

CODE
                
// Request the next line of data
lineCounter += 1;
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(10);


The same goes for why you dont get the line count, you never ask for it.
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
09-21-2006 01:28
OK, I can see this has gone far enough now.

Yes, you're right, I wasn't asking for the right information, not because of bad coding as much as it was that I didn't know what I was doing!

Thanks to Aakanaar LaSalle's advice outside the forum I have translated what you're trying to tell me into a clunky but working player. It rolls over when I click back while reading line 1 and goes to the last line of the notecard no problem. Likewise it rolls from the last line to line 0 without a problem now.

I've also implemented a timer which appears, amazingly enough, to work perfectly and progresses the tracks through when the time is up, even from the last line to the first.

So, it all works fine... I'd post all of the code but I'm a little embarassed at how rough I've done it, I know you guys would shorten it by loads but it works so I don't want to mess anymore!

Thanks for all your help though, I really appreciate it all!
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
09-21-2006 12:55
I could suggest one thing Landing. I am new into the scripting too, you can see that by looking at my last couple of threads. In both threads what I had did work after a couple of changes. But after looking at then and getting some feedback I was able to shorten them down even more. More importantly it made them where they are not as much load on the server.

I still have all of the versions and I can go back and look and see the progression. It might not be a bad idea to post what you do have. Let it run through the mill here a little and see what pops out. It might help you to become a better scripter faster.

You will soon learn in SL that there is some really nasty scripting here sometimes. Some has a tremendous impact on the server. Then there is more impact from a bunch of scripts that aren't as well made as they could be.

Just my 2 cents worth.
Aakanaar LaSalle
Registered User
Join date: 1 Sep 2006
Posts: 132
09-21-2006 13:10
Let me know if you got my last email. From the sounds of the last post here, I think you did. It should work more now.

For those who are wondering, I had him move the llGetNoteCardLines to the listen event from the dialog, and had him add a llGetNumberOfNotecardLines from the state_entry. The next step that I was going to move onto, but havn't yet, is adding code so when the notecard(s) get changed, we'd re-fetch the number of lines.

Last I had contact, he was still using three notecards, we'll get him down to one when ready. I did explain the benifits to using one card and a CSV formatted line for this.

And I had him change the
currentline = currentline + 1
to
if (++currentline >= totallines) { currentline = 0; }

and likewise
currentline = currentline - 1
to
if (--currentline < 0) { currentline = totallines - 1; }

So it's wrapping around the list. From the sounds of his reply I am assuming he made that change.

Let me know how it's going. Go ahead and post the entire code up here when you're ready, and we'll move onto the next improvement.
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
09-21-2006 14:39
The code is so messy now! I had alsorts of problems getting it to get the name of the previous and next lines, all of which should've been real easy! What I kept getting was that when I went backwards, it would go from line 2, 1, 0, 20, 19 but the names displayed would be 2, 1, 0, 20, 20 or 2, 1, 0, NULL, 20.

A whole lot of ballsing around and I got it to work something like how it should and I added a timer event. I set it autoplaying at 7am SL time and it's been progressing through the 46lines in the final notecards without problem, although on the first run it seems to play the same track twice.

To see the code will give experienced coders a real headache, I had to tweak practically every bit to get it to work properly but by doing so I undid most of the good work you guys had already done.... next step is to see about CSV or something like, I think I've learnt enough about dataserver for a lifetime!

Thanks again everyone, I really appreciate the help... onwards!
Dominic Webb
Differential Engineer
Join date: 1 Feb 2006
Posts: 73
09-22-2006 06:49
From: Jesse Barnett
You will soon learn in SL that there is some really nasty scripting here sometimes. Some has a tremendous impact on the server. Then there is more impact from a bunch of scripts that aren't as well made as they could be.


I have given up, but sadly I suspect this will be one of those...


- d.
_____________________
.sig space for rent.
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
10-08-2006 15:33
Just so you know, this was a learning script. No need to give up because I've now progressed on to a single notecard that is much neater and more efficient. The point of this excercise was just to learn how to import data from multiple cards. Done now, and thanks for the help, now onto bigger and better things

Sorry if anyone thinks that I've wasted their time
1 2