OsSetDynamictextureURL example2

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(New page: <source lang="lsl"> // osWeaherMap.lsl from standard Oopensim Library Scripts integer count = 0; integer refreshRate = 300; string URL1 = "http://icons.wunderground.com/data/640x480/2xus_...)
 
m (Robot: Cosmetic changes)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 +
{{Quicklinks}}
 +
<br />
 +
 
<source lang="lsl">
 
<source lang="lsl">
 
// osWeaherMap.lsl from standard Oopensim Library Scripts
 
// osWeaherMap.lsl from standard Oopensim Library Scripts
Line 4: Line 8:
 
integer count = 0;
 
integer count = 0;
 
integer refreshRate = 300;
 
integer refreshRate = 300;
string URL1 = "http://icons.wunderground.com/data/640x480/2xus_rd.gif";
+
string URL1 = "http://icons.wunderground.com/data/640x480/2xus_rd.gif";  
 
string URL2 = "http://icons.wunderground.com/data/640x480/2xus_sf.gif";  
 
string URL2 = "http://icons.wunderground.com/data/640x480/2xus_sf.gif";  
 
string URL3 = "http://icons.wunderground.com/data/640x480/2xus_st.gif";  
 
string URL3 = "http://icons.wunderground.com/data/640x480/2xus_st.gif";  
Line 10: Line 14:
 
string contentType="image";
 
string contentType="image";
 
      
 
      
refresh_textu`re()
+
refresh_texture()
 
{
 
{
 
     count++;
 
     count++;
Line 46: Line 50:
 
}
 
}
 
</source>
 
</source>
 +
 +
[[Category:OSSL]]

Latest revision as of 20:51, 3 March 2012


// osWeaherMap.lsl from standard Oopensim Library Scripts
 
integer count = 0;
integer refreshRate = 300;
string URL1 = "http://icons.wunderground.com/data/640x480/2xus_rd.gif"; 
string URL2 = "http://icons.wunderground.com/data/640x480/2xus_sf.gif"; 
string URL3 = "http://icons.wunderground.com/data/640x480/2xus_st.gif"; 
string dynamicID="";
string contentType="image";
 
refresh_texture()
{
    count++;
    string url = "";
    integer c = count % 3;
 
    if (c == 0) {
        url = URL1;    
    } else if (c == 1) {
        url = URL2;
    } else {
        url = URL3;
    }
    // refresh rate is not yet respected here, which is why we need the timer
    osSetDynamicTextureURL(dynamicID, contentType ,url , "", refreshRate );
}
 
default
{
    state_entry()
    {
        refresh_texture();
        llSetTimerEvent(refreshRate); // create a "timer event" every 300 seconds.
    }
 
    timer()
    {
        refresh_texture();
    }
 
    touch_start(integer times)
    {
        refresh_texture();
    }
}
Personal tools
General
About This Wiki