diff options
Diffstat (limited to 'bin/assets/ScriptsAssetSet/osWeatherMap.lsl')
-rw-r--r-- | bin/assets/ScriptsAssetSet/osWeatherMap.lsl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/osWeatherMap.lsl b/bin/assets/ScriptsAssetSet/osWeatherMap.lsl new file mode 100644 index 0000000..7dda87b --- /dev/null +++ b/bin/assets/ScriptsAssetSet/osWeatherMap.lsl | |||
@@ -0,0 +1,43 @@ | |||
1 | default | ||
2 | { | ||
3 | integer count = 0; | ||
4 | integer refreshRate = 300; | ||
5 | string URL1 = "http://icons.wunderground.com/data/640x480/2xus_rd.gif"; | ||
6 | string URL2 = "http://icons.wunderground.com/data/640x480/2xus_sf.gif"; | ||
7 | string URL3 = "http://icons.wunderground.com/data/640x480/2xus_st.gif"; | ||
8 | string dynamicID=""; | ||
9 | string contentType="image"; | ||
10 | |||
11 | state_entry() | ||
12 | { | ||
13 | refresh_texture(); | ||
14 | llSetTimerEvent(refreshRate); // create a "timer event" every 300 seconds. | ||
15 | } | ||
16 | |||
17 | timer() | ||
18 | { | ||
19 | refresh_texture(); | ||
20 | } | ||
21 | |||
22 | touch_start(integer times) | ||
23 | { | ||
24 | refresh_texture(); | ||
25 | } | ||
26 | |||
27 | void refresh_texture() | ||
28 | { | ||
29 | count++; | ||
30 | string url = ""; | ||
31 | integer c = count % 3; | ||
32 | |||
33 | if (c == 0) { | ||
34 | url = URL1; | ||
35 | } else if (c == 1) { | ||
36 | url = URL2; | ||
37 | } else { | ||
38 | url = URL3; | ||
39 | } | ||
40 | // refresh rate is not yet respected here, which is why we need the timer | ||
41 | osSetDynamicTextureURL(dynamicID, contentType ,url , "", refreshRate ); | ||
42 | } | ||
43 | } | ||