Advertisement
Gayngel

Untitled

Jun 3rd, 2016
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. string notecard1 = "notecard1"; // First notecard in inventory
  2. string notecard2 = "notecard2";
  3.  
  4. key QueryNotecard1; // Key assigned to the dataserver query to read the first notecard.
  5. key QueryNotecard2; // Key asssigned to the dataserver query to read the the second notecard.
  6.  
  7. // We give each notecard to be read a unique identifier so the dataserver event knows which notecard to read.
  8.  
  9. integer i; // Notecard line
  10.  
  11. integer total1;
  12. integer total2;
  13.  
  14.  
  15. default
  16. {
  17. state_entry()
  18. {
  19. total1 = llGetNumberOfNotecardLines(notecard1);
  20. QueryNotecard1 = llGetNotecardLine(notecard1,i = 0); // Assigning reading of the first notecard to a key that is passed to the dataserver to identify what notecard to read.
  21.  
  22. }
  23.  
  24. touch_start(integer total_number)
  25. {
  26. total2 = llGetNumberOfNotecardLines(notecard2);
  27. QueryNotecard2 = llGetNotecardLine(notecard2,i = 0); // Assigning reading of the second notecard to a key that is passed to the dataserver to identify what notecard to read.
  28. }
  29.  
  30.  
  31. dataserver(key queryid, string data)
  32. {
  33.  
  34. if(queryid == QueryNotecard1) // The id passed to the dataserever event was the id for the first notecard so read the first notecard.
  35. {
  36.  
  37.  
  38. if(data != EOF)
  39. {
  40.  
  41. llOwnerSay("Data on line " + (string)i + " of "+ (string)total1 + " is " + data + ".");
  42.  
  43. QueryNotecard1 = llGetNotecardLine(notecard1, ++i); // Read the next line of the first notecard
  44.  
  45. }
  46.  
  47. else
  48. {
  49.  
  50. llOwnerSay("Finished reading notecard.");
  51. }
  52.  
  53.  
  54. }
  55.  
  56.  
  57. else if(queryid == QueryNotecard2) // The id passed to the dataserever event was the id for the second notecard so read the second notecard.
  58. {
  59.  
  60.  
  61. if(data != EOF)
  62. {
  63.  
  64. llOwnerSay("Data on line " + (string)i + " of "+ (string)total2 + " is " + data + ".");
  65.  
  66. QueryNotecard2 = llGetNotecardLine(notecard2, ++i); // Read the next line of the second notecard
  67.  
  68. }
  69.  
  70. else
  71. {
  72.  
  73. llOwnerSay("Finished reading notecard.");
  74. }
  75.  
  76.  
  77. }
  78.  
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement