Advertisement
Jym_Nova

PingPong Chat

Jul 22nd, 2015
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Written By: Ĵyм Ѡҩℓƒ (Jym Resident)
  2. /*
  3. LICENCE:
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. or you may visit - http://license.idjhost.com/
  17. */
  18. // DESCRIPTION
  19. // bouncing chat between scripts
  20.  
  21. integer chan = -15482659;
  22. integer ping = FALSE;
  23.  
  24. default
  25. {
  26.     state_entry()
  27.     {
  28.     llListen(chan,"","',"");
  29.    }
  30.    touch_start(integer detect)
  31.    {
  32.     ping = TRUE;
  33.     llSetTimerEvent(1);
  34.    }
  35.    listen(integer channel, string name, key id, string message)
  36.    {
  37.     if(message == "Ping") //Change to Pong in script number 2
  38.     {
  39.         ping = FALSE
  40.         llSetTimerEvent(1);
  41.     }
  42.    }
  43.    timer()
  44.    {
  45.     if(ping == TRUE)
  46.     {
  47.         ping = FALSE;
  48.         llSetTimerEvent(0); //Cancels Timer to prevent duplicate messages
  49.         llRegionSay(chan,"Ping"); //Change to Pong in script number 2
  50.     }
  51.     else
  52.     {
  53.         llSetTimerEvent(0);
  54.         llRegionSay(chan,"Pong"); //Change to Ping in Script number 2
  55.     }
  56.    }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement