Hi. I need a little help please.
|
Fiona Fatale
Registered User
Join date: 19 Aug 2004
Posts: 16
|
11-18-2005 11:30
Hi all. I currently have a script that I hand-edit whenever I want to make changes to it. I use a list to hold my friend's AV keys in so I can see if they are online on this real cool board I made. What I've been doing lately is just editing the script and restarting it. What I'd like to do is just put my frieds' keys in a notecard, one per line, and have the script read the card and put each key into the list. My attempts to do this have been disasterous because I don't understand dataserver events very well, and I learn best by example.  Can someone help me out, please?
|
Fiona Fatale
Registered User
Join date: 19 Aug 2004
Posts: 16
|
11-18-2005 11:44
So basically what I am asking for is the code to read a notecard and take each line and add it to a list.
Thanks. I'd thought I'd clarify because I tend to be longwinded.
|
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
|
11-18-2005 11:48
Contact me in world, and I'll sort it out for you... unless someone wants to post it here that is...
_____________________
http://siobhantaylor.wordpress.com/
|
JackBurton Faulkland
PorkChop Express
Join date: 3 Sep 2005
Posts: 478
|
11-18-2005 11:50
string gName = "Testnotecard"; // name of a notecard in the object's inventory integer gLine = 0; // current line number key gQueryID; // id used to identify dataserver queries list myList; default { state_entry() { gQueryID = llGetNotecardLine(gName, gLine); // request first line gLine++; // increase line count } dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { // not at the end of the notecard myList = myList + [data] ; storing the keys gQueryID = llGetNotecardLine(gName, gLine); // request next line gLine++; // increase line count } } } } note to sure since i havent worked with lists in LSL but i think this will work but i could be wrong 
_____________________
You know what Jack Burton always says... what the hell?
|
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
|
11-18-2005 11:53
looks like it should...
_____________________
http://siobhantaylor.wordpress.com/
|
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
|
11-18-2005 11:53
theres a notecard reader in the script forums /15/0a/33517/1.html -LW
|
Fiona Fatale
Registered User
Join date: 19 Aug 2004
Posts: 16
|
11-18-2005 12:05
Yeah I looked at that one but it was too complex. I wasn't setting variables like X=Y, I just needed a list made. I think the one JackBurton made looks like it would work, as it was similar to what I was working on, just, well, correct. LOL. Thanks!
|
Fiona Fatale
Registered User
Join date: 19 Aug 2004
Posts: 16
|
11-18-2005 15:04
Well, I'm happy to announce that the code given above worked perfect! Yay! All by itself.  But I need to call the dataserver again to turn the key into a name for my board. This worked before, but now that the dataserver is doing the notecard, I can't get my llRequestAgentData call for DATA_NAME to work. 
|
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
|
11-18-2005 15:06
just use llKeytoName
_____________________
http://siobhantaylor.wordpress.com/
|
Fiona Fatale
Registered User
Join date: 19 Aug 2004
Posts: 16
|
11-18-2005 15:17
llKey2Name only works when they are online & in the same Sim, according to the Wiki and my own testing. You have to use the dataserver event to get an AV's name from a key if they are offline or not in the same sim.
|
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
|
11-18-2005 15:24
Good point! I do have a script that can do it... I'll try to find it for you.
_____________________
http://siobhantaylor.wordpress.com/
|
Fiona Fatale
Registered User
Join date: 19 Aug 2004
Posts: 16
|
11-18-2005 15:44
Thanks Siobhan. The way it's working now is I can get the notecard to be read or the name lookup to work, but I cannot get both to work in the same script. 
|
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
|
11-18-2005 16:05
OKies, I'll meet up with you sometime over the weekend then... we can get something working.
_____________________
http://siobhantaylor.wordpress.com/
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
11-18-2005 16:13
It'll be easier to help you if you post your script  The dataserver event has a key associated with it. If you send out multiple requests, you need to store the key returned by the requesting function (like GetNotecardLine), and then in the dataserver event, match the key coming in to the key you saved to figure out which query the response is for. AFAIK, there is no guarantee that the responses will be in the same sequence as the requests, so you need to use the query key to match the response to the request.
|
Padraig Stygian
The thin mick
Join date: 15 Aug 2004
Posts: 111
|
11-18-2005 23:52
Yeah, I just had to do this very thing the other night... I was ripping up an online detector to make it do what *I* wanted it to, instead of what it was built for, and I came across that exact dataserver/query key problem. Here are the important parts of it, I left out all the truly strange customizations I made. string name_str = ""; string last_online = ""; integer ONLINE = FALSE; key onlineQ; key nameQ;
default state_entry() { nameQ = llRequestAgentData(person_id, DATA_NAME); llSetTimerEvent(60.0); } timer() { if(person_id) { onlineQ = llRequestAgentData(person_id, DATA_ONLINE); } }
...
dataserver(key query, string data) { if (query == onlineQ) { if((integer)data == 1) { ONLINE = TRUE; } else { ONLINE = FALSE; } } else if (query == nameQ) { name_str = data; } } }
|