Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Example script handling sequential data server events (notecard reading)
- string notecardNameOrKey = "name or key of the notecard goes here";
- key notecardQueryId;
- integer notecardLine;// first notecard line is 0, so we don't have to set notecardLine = 1 here
- list players=["f72eccfc-20eb-446a-a1b2-eb1b21f72f8b","abea0d65-485a-4e6c-9e3b-b5c8192a1a6d","e7ca42c3-ab2f-4f9f-b114-72b02d611677","7cb6d8ea-99fa-4a5d-8702-65ffcd9d86bb"];
- list named;
- display()
- {
- integer x;
- do
- {
- if (llList2String(named,x)=="")
- {
- named=llListReplaceList(named,["No Player Yet"],x,x);
- }
- x=x+1;
- }while(x<5);
- llSay(0,llList2CSV(named));
- }
- default
- {
- state_entry()
- {
- }
- touch_start(integer t)
- {
- llSay(0, "Reading notecard...");
- notecardLine=0;
- named=[];
- notecardQueryId = llRequestUsername(llList2Key(players, notecardLine));
- }
- dataserver(key query_id, string data)
- {
- if (query_id == notecardQueryId)
- {
- if (data == EOF)// we have reached the EOF (end of file)
- {
- llSay(0, "No more lines in notecard, read " + (string) notecardLine + " lines.");
- }
- else
- {
- // increment line index first, both for line number reporting, and for reading the next line
- ++notecardLine;
- // llSay(0, "Line " + (string) notecardLine + ": " + data);
- named=named+[data];
- if (llList2String(players,notecardLine)!=""||notecardLine<4)
- {
- notecardQueryId = llRequestUsername(llList2Key(players, notecardLine));
- }
- else
- {
- // llSay(0,llList2CSV(named));
- display();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement