aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/osWeatherMap.lsl
blob: 7dda87badb7bfbe3f080c08debba11c6276dfed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
default
{
    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";
        
    state_entry()
    {
        refresh_texture();
        llSetTimerEvent(refreshRate); // create a "timer event" every 300 seconds.
    }
   
    timer()
    {
        refresh_texture();
    }
    
    touch_start(integer times)
    {
        refresh_texture();
    }
    
    void 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 );
    }
}