Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 20th, 2012  |  syntax: None  |  size: 1.06 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. float frequency = 60; // 5 min
  2. integer set_daynight = 0; // 0 night 1 day
  3. float glow_full = 0.05;
  4.  
  5. //LINK_ROOT    1   sends to root prim in a linked set
  6. //LINK_SET     -1  sends to all prims
  7. //LINK_ALL_OTHERS  -2  sends to all other prims
  8. //LINK_ALL_CHILDREN    -3  sends to all children, (everything but the root)
  9. //LINK_THIS    -4  sends to the prim the script is in
  10. integer link_set = LINK_SET
  11.  
  12. start_glow()
  13. {
  14.     llSetLinkPrimitiveParams(link_set, [PRIM_GLOW, ALL_SIDES, glow_full]);
  15. }
  16.  
  17. stop_glow()
  18. {
  19.     llSetLinkPrimitiveParams(link_set, [PRIM_GLOW, ALL_SIDES, 0.0]);
  20. }
  21.  
  22. check_for_transition()
  23. {
  24.     vector sun = llGetSunDirection();
  25.     integer day_night = set_daynight;
  26.  
  27.     if (day_night)
  28.         day_night = sun.z > 0.0;
  29.     else
  30.         day_night = sun.z < 0.0;
  31.  
  32.     if(day_night)
  33.     {
  34.         start_glow();
  35.     }
  36.     else
  37.     {
  38.         stop_glow();
  39.     }
  40. }
  41.  
  42. default
  43. {
  44.     state_entry()
  45.     {
  46.         llSetTimerEvent(frequency);
  47.         check_for_transition();
  48.     }
  49.     timer(){
  50.         check_for_transition();
  51.     }
  52. }