From 2558f8ac3122f2721c9f47500626f781ff548bbe Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Fri, 18 Jul 2008 04:51:36 +0000 Subject: Make scripts LSL compliant. --- bin/assets/ScriptsAssetSet/GrafittiBoard.lsl | 58 ++++++++++++++-------------- bin/assets/ScriptsAssetSet/osTextBoard.lsl | 53 ++++++++++++------------- bin/assets/ScriptsAssetSet/osWeatherMap.lsl | 50 ++++++++++++------------ 3 files changed, 81 insertions(+), 80 deletions(-) (limited to 'bin/assets') diff --git a/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl b/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl index 954e3ea..83adfb1 100644 --- a/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl +++ b/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl @@ -6,13 +6,40 @@ string text = ""; -int LISTENING_CHANNEL = 43; +integer LISTENING_CHANNEL = 43; // XXX Only putting this here as well to get around OpenSim's int -> string casting oddness string LISTENING_CHANNEL_STRING = "43"; // FIXME: Should be dynamic! -int CHARS_WIDTH = 42; +integer CHARS_WIDTH = 42; + +// Add some additional graffiti +addGraffiti(string message) +{ + while (llStringLength(message) > CHARS_WIDTH) + { + text += "\n\n" + llGetSubString(message, 0, CHARS_WIDTH - 1); + message = llDeleteSubString(message, 0, CHARS_WIDTH - 1); + } + + text += "\n\n" + message; +} + +// Clear the existing graffiti +clearGraffiti() +{ + text = ""; +} + +// Actually fires the graffiti out to the dynamic texture module +draw() +{ + //llSay(0, text); + string drawList = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";"; + + osSetDynamicTextureData("", "vector", drawList, "1024", 0); +} default { @@ -45,30 +72,3 @@ default draw(); } } - -// Add some additional graffiti -void addGraffiti(string message) -{ - while (llStringLength(message) > CHARS_WIDTH) - { - text += "\n\n" + llGetSubString(message, 0, CHARS_WIDTH - 1); - message = llDeleteSubString(message, 0, CHARS_WIDTH - 1); - } - - text += "\n\n" + message; -} - -// Clear the existing graffiti -void clearGraffiti() -{ - text = ""; -} - -// Actually fires the graffiti out to the dynamic texture module -void draw() -{ - //llSay(0, text); - string drawList = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";"; - - osSetDynamicTextureData("", "vector", drawList, "1024", 0); -} diff --git a/bin/assets/ScriptsAssetSet/osTextBoard.lsl b/bin/assets/ScriptsAssetSet/osTextBoard.lsl index bb5ae81..7aacab4 100644 --- a/bin/assets/ScriptsAssetSet/osTextBoard.lsl +++ b/bin/assets/ScriptsAssetSet/osTextBoard.lsl @@ -4,6 +4,33 @@ string text = ""; string add = ""; integer channel = 0; // if this is >= 0, llSay on that channel on updates +push_text() +{ + compile_text(); + draw_text(); +} + +compile_text() +{ + title = "Some Title"; + subtitle = "Some subtitle"; + + text = "Plenty of text for the main body.\n"; + text += "You need to manual do line breaks\n"; + text += "here. No word wrap yet."; + + add = "Additional text at the bottom"; +} + +draw_text() +{ + string drawList = "MoveTo 40,80; PenColour RED; FontSize 48; Text " + title + ";"; + drawList += "MoveTo 160,160; FontSize 32; Text " + subtitle + ";"; + drawList += "PenColour BLACK; MoveTo 40,220; FontSize 24; Text " + text + ";"; + drawList += "PenColour RED; FontName Times New Roman; MoveTo 40,900; Text " + add + ";"; + osSetDynamicTextureData("", "vector", drawList, "1024", 0); +} + default { state_entry() { @@ -18,30 +45,4 @@ default { } } - void push_text() - { - compile_text(); - draw_text(); - } - - void compile_text() - { - title = "Some Title"; - subtitle = "Some subtitle"; - - text = "Plenty of text for the main body.\n"; - text += "You need to manual do line breaks\n"; - text += "here. No word wrap yet."; - - add = "Additional text at the bottom"; - } - - void draw_text() - { - string drawList = "MoveTo 40,80; PenColour RED; FontSize 48; Text " + title + ";"; - drawList += "MoveTo 160,160; FontSize 32; Text " + subtitle + ";"; - drawList += "PenColour BLACK; MoveTo 40,220; FontSize 24; Text " + text + ";"; - drawList += "PenColour RED; FontName Times New Roman; MoveTo 40,900; Text " + add + ";"; - osSetDynamicTextureData("", "vector", drawList, "1024", 0); - } } diff --git a/bin/assets/ScriptsAssetSet/osWeatherMap.lsl b/bin/assets/ScriptsAssetSet/osWeatherMap.lsl index 7dda87b..8fc6007 100644 --- a/bin/assets/ScriptsAssetSet/osWeatherMap.lsl +++ b/bin/assets/ScriptsAssetSet/osWeatherMap.lsl @@ -1,13 +1,30 @@ -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"; + +void refresh_texture() { - 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"; + 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(); @@ -23,21 +40,4 @@ default { 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 ); - } } -- cgit v1.1