Advertisement
Guest User

Untitled

a guest
Jan 5th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Example script handling sequential data server events (notecard reading)
  2.  
  3. string notecardNameOrKey = "name or key of the notecard goes here";
  4. key notecardQueryId;
  5. integer notecardLine;//  first notecard line is 0, so we don't have to set notecardLine = 1 here
  6.  list players=["f72eccfc-20eb-446a-a1b2-eb1b21f72f8b","abea0d65-485a-4e6c-9e3b-b5c8192a1a6d","e7ca42c3-ab2f-4f9f-b114-72b02d611677","7cb6d8ea-99fa-4a5d-8702-65ffcd9d86bb"];
  7. list named;
  8. display()
  9. {
  10.     integer x;
  11.     do
  12.     {
  13.         if (llList2String(named,x)=="")
  14.         {
  15.             named=llListReplaceList(named,["No Player Yet"],x,x);
  16.             }
  17.         x=x+1;
  18.         }while(x<5);
  19.     llSay(0,llList2CSV(named));
  20.     }
  21. default
  22. {
  23.     state_entry()
  24.     {
  25.        
  26.        
  27.     }
  28.     touch_start(integer t)
  29.     {
  30.         llSay(0, "Reading notecard...");
  31.         notecardLine=0;
  32.         named=[];
  33.         notecardQueryId = llRequestUsername(llList2Key(players, notecardLine));
  34.     }
  35.  
  36.     dataserver(key query_id, string data)
  37.     {
  38.         if (query_id == notecardQueryId)
  39.         {
  40.             if (data == EOF)//  we have reached the EOF (end of file)
  41.             {
  42.                 llSay(0, "No more lines in notecard, read " + (string) notecardLine + " lines.");
  43.             }
  44.             else
  45.             {
  46.             //  increment line index first, both for line number reporting, and for reading the next line
  47.                 ++notecardLine;
  48.                // llSay(0, "Line " + (string) notecardLine + ": " + data);
  49.                 named=named+[data];
  50.                 if (llList2String(players,notecardLine)!=""||notecardLine<4)
  51.                 {
  52.                 notecardQueryId = llRequestUsername(llList2Key(players, notecardLine));
  53.                 }
  54.                 else
  55.                 {
  56.                    // llSay(0,llList2CSV(named));
  57.                    display();
  58.                     }
  59.             }
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement