Walking Sound

Written by Kitsune
 on_rez(integer omitted)
   {
       llResetScript();
   }

   state_entry()
   {
       sound = llGetInventoryName(INVENTORY_SOUND, 0);
       llSetTimerEvent(0.5);
   }

   timer()
   {
       integer info = llGetAgentInfo(llGetOwner());
       if(info & AGENT_WALKING)
       {
           if(!walking)
           {
               walking = TRUE;
               llLoopSound(sound, 1.0);
           }
       }
       else
       {
           if(walking)
           {
               walking = FALSE;
               llStopSound();
           }
       }
   }