Files
opengenesislinkserver/addons/OGLWeather/WeatherCurrentSign.lsl
T
OpenGenesis (MPL 2.0) b40d8713d1 feat(gen1): complete inworld LSL companion packs for NexTraffic, NexTransit, NexSmartLight and OGLWeather (#340)
* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* feat(lsl): add practical city and weather inworld companion script

* fix(nextraffic): update countdown every second without changing lamp prims; fail-safe on stale signal

* fix(lsl): correct NexTraffic multiline hovertext newline escape

* fix(nextransit): validate full timetable and correctly handle empty route broadcasts before dynamic texture rendering

* docs(gen1): complete 13-script traffic, transit, lighting and weather inworld setup guide

* test(gen1): static protocol, safety and LSL API checks for all 13 companion scripts

* ci(gen1): verify 13 inworld LSL scripts in default NexVerse CI

* ci(gen1): guard registration of all Inworld LSL script checks

* docs(nextraffic): link complete 13-script inworld installation manual

* docs(nextransit): link complete 13-script inworld installation manual

* docs(nexsmartlight): link complete 13-script inworld installation manual

* docs(oglweather): link complete 13-script inworld installation manual

* fix(ci): use existing OglWeatherRegionModule class path for LSL protocol verification

* fix(nextraffic): replace signal script with forward-safe portable LSL and authoritative countdown
2026-10-28 20:32:07 +01:00

71 lines
2.2 KiB
Plaintext

// OGLWeather - compact, standard LSL weather sign with temperature.
// Not a weather emitter; rain/snow is managed by server-side C#.
integer CHANNEL = -835311;
integer LAST = 0;
string gStatus = "";
integer gTemperature;
integer gWind;
integer gIntensity;
string gForecastTime;
string weatherName(string code)
{
if (code == "sun") return "Sonnig";
if (code == "cloud") return "Bewoelkt";
if (code == "rain") return "Regen";
if (code == "snow") return "Schnee";
return "Unbekannt";
}
render()
{
if (LAST == 0 || llGetUnixTime() - LAST > 240)
{
llSetText("OGLWeather\nWetterdienst nicht erreichbar",
<1.0, 0.4, 0.25>, 1.0);
return;
}
vector tint = <0.65, 0.9, 1.0>;
if (gStatus == "sun") tint = <1.0, 0.9, 0.4>;
if (gStatus == "snow") tint = <0.85, 0.95, 1.0>;
string textValue = "STADT NEXVERSE\n" + weatherName(gStatus) +
" " + (string)gTemperature + " C\n" +
"Wind " + (string)gWind + " km/h";
if (gStatus == "rain" || gStatus == "snow")
textValue += " | " + (string)gIntensity + "%";
llSetText(textValue, tint, 1.0);
}
default
{
state_entry()
{
llListen(CHANNEL, "OGLWeather", NULL_KEY, "");
llSetTimerEvent(60.0);
render();
}
listen(integer ch, string name, key id, string message)
{
if (ch != CHANNEL || name != "OGLWeather" || id != NULL_KEY) return;
list f = llParseStringKeepNulls(message, ["|"], []);
if (llGetListLength(f) != 8 || llList2String(f, 0) != "OGLWX" ||
llList2String(f, 1) != "1" || llList2String(f, 2) != "NOW")
return;
string status = llList2String(f, 4);
if (status != "sun" && status != "cloud" &&
status != "rain" && status != "snow") return;
integer intensity = llList2Integer(f, 6);
integer wind = llList2Integer(f, 7);
if (intensity < 0 || intensity > 100 || wind < 0 || wind > 150)
return;
gStatus = status;
gTemperature = llList2Integer(f, 5);
gIntensity = intensity;
gWind = wind;
gForecastTime = llList2String(f, 3);
LAST = llGetUnixTime();
render();
}
timer() { render(); }
on_rez(integer param) { llResetScript(); }
}