Advertisement
Guest User

Untitled

a guest
Feb 7th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This is a music player script. The sound files are named as numbers. It is intended to play from 1 to 13, then 1 to 13b, then 14 to 39. The problem: it keeps looping at 13b. What am I doing wrong?
  2.  
  3. integer playing;
  4. integer current;
  5. integer repeated;
  6. integer ended;
  7.  
  8. default
  9. {
  10.     state_entry()
  11.     {
  12.         llSetSoundQueueing(FALSE); // just in case
  13.         current = 0;
  14.         repeated = FALSE;
  15.         integer p = 39;
  16.         llSay(0, "Preloading!");
  17.         do
  18.         {
  19.             llPreloadSound((string)p);
  20.         }
  21.         while (--p > 0);
  22.         llPreloadSound("13b");
  23.         llSay(0, "Preloaded!");
  24.     }
  25.  
  26.     touch_start(integer total_number)
  27.     {
  28.         if (playing == TRUE) return;
  29.         playing = TRUE;
  30.         current = 1;
  31.         llSetTimerEvent(3.92);
  32.     }
  33.    
  34.     timer()
  35.     {
  36.         if (ended)
  37.         {
  38.             current = 0;
  39.             playing = FALSE;
  40.             llSetTimerEvent(0.0);
  41.         }
  42.         else if (current > 0 && current < 13)
  43.         {
  44.             llPlaySound((string)current, 1.0);
  45.             current +=1;
  46.         }
  47.         else if (current = 13)
  48.         {
  49.             if (!repeated)
  50.             {
  51.                 llPlaySound("13", 1.0);
  52.                 repeated = TRUE;
  53.                 current = 1;
  54.             }
  55.             else if (repeated)
  56.             {
  57.                 llPlaySound("13b", 1.0);
  58.                 current = 14;
  59.                 return;
  60.             }
  61.         }
  62.         else if (current >= 14 && current < 39)
  63.         {
  64.             llPlaySound((string)current, 1.0);
  65.             current +=1;
  66.         }
  67.         else if (current = 39)
  68.             ended = TRUE;
  69.             playing = FALSE;
  70.             repeated = FALSE;
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement