osWeatherMap.lsl 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. integer count = 0;
  2. integer refreshRate = 300;
  3. string URL1 = "http://icons.wunderground.com/data/640x480/2xus_rd.gif";
  4. string URL2 = "http://icons.wunderground.com/data/640x480/2xus_sf.gif";
  5. string URL3 = "http://icons.wunderground.com/data/640x480/2xus_st.gif";
  6. string dynamicID="";
  7. string contentType="image";
  8. refresh_texture()
  9. {
  10. count++;
  11. string url = "";
  12. integer c = count % 3;
  13. if (c == 0) {
  14. url = URL1;
  15. } else if (c == 1) {
  16. url = URL2;
  17. } else {
  18. url = URL3;
  19. }
  20. // refresh rate is not yet respected here, which is why we need the timer
  21. osSetDynamicTextureURL(dynamicID, contentType ,url , "", refreshRate );
  22. }
  23. default
  24. {
  25. state_entry()
  26. {
  27. refresh_texture();
  28. llSetTimerEvent(refreshRate); // create a "timer event" every 300 seconds.
  29. }
  30. timer()
  31. {
  32. refresh_texture();
  33. }
  34. touch_start(integer times)
  35. {
  36. refresh_texture();
  37. }
  38. }