Configurable Wind System
De DigiWiki.
Version du 9 mai 2015 à 18:49 par Djphil (discuter | contributions)
// Configurable Wind System v0.1 by djphil (CC-BY-NC-SA 4.0) // Simple Wind float defStrength = 0.0; // Force du vent float newStrength = 1.0; // Force du vent float strength; // Configurable Wind float defAvgStrength = 0.0; // Force moyenne float defAvgDirection = 0.0; // Direction moyenne float defVarStrength = 0.0; // Ecrat de force float defVarDirection = 0.0; // Ecart de direction float defRateChange = 0.0; // Taux de changement float newAvgStrength = 1.0; // Force moyenne float newAvgDirection = 0.0; // Direction moyenne float newVarStrength = 1.0; // Ecrat de force float newVarDirection = 270.0; // Ecart de direction float newRateChange = 300.0; // Taux de changement float avgStrength; float avgDirection; float varStrength; float varDirection; float rateChange; // Activator integer GET = TRUE; integer SET = TRUE; integer SAY = TRUE; // Others integer power; string text; string module; // Functions get_Simple_Wind() { strength = osGetWindParam("SimpleRandomWind", "strength"); } set_Simple_Wind() { osSetWindParam("SimpleRandomWind", "strength", newStrength); } get_Configurable_Wind() { avgStrength = osGetWindParam("ConfigurableWind", "avgStrength"); avgDirection = osGetWindParam("ConfigurableWind", "avgDirection"); varStrength = osGetWindParam("ConfigurableWind", "varStrength"); varDirection = osGetWindParam("ConfigurableWind", "varDirection"); rateChange = osGetWindParam("ConfigurableWind", "rateChange"); } set_Configurable_Wind() { osSetWindParam("ConfigurableWind", "avgStrength", newAvgStrength); osSetWindParam("ConfigurableWind", "avgDirection", newAvgDirection); osSetWindParam("ConfigurableWind", "varStrength", newVarStrength); osSetWindParam("ConfigurableWind", "varDirection", newVarDirection); osSetWindParam("ConfigurableWind", "rateChange", newRateChange); } say_Simple_Wind() { text = "\nACTIVE WIND MODULE = [" + module + "]"; text += "\nwind strength(strength) = " + (string)strength; text += "\nwind strength(strength) is changed to " + (string)newStrength; llSay(PUBLIC_CHANNEL, text); } say_Configurable_Wind() { text = "\nACTIVE WIND MODULE = [" + module + "]"; text += "\naverage wind strength(avg_strength) = " + (string)avgStrength; text += "\naverage wind direction in degrees(avg_direction) = " + (string)avgDirection; text += "\nallowable variance in wind strength(var_strength) = " + (string)varStrength; text += "\nallowable variance in wind direction in +/- degrees(var_direction) = " + (string)varDirection; text += "\nrate of change(rate_change) = " + (string)rateChange; llSay(PUBLIC_CHANNEL, text); } initialisation() { module = osWindActiveModelPluginName(); if (module == "SimpleRandomWind") { if (GET) get_Simple_Wind(); if (SAY) say_Simple_Wind(); if (SET) set_Simple_Wind(); if (GET) get_Simple_Wind(); if (SAY) say_Simple_Wind(); } else if (module == "ConfigurableWind") { if (GET) get_Configurable_Wind(); if (SAY) say_Configurable_Wind(); if (SET) set_Configurable_Wind(); if (GET) get_Configurable_Wind(); if (SAY) say_Configurable_Wind(); } } // Program default { state_entry() { initialisation(); } touch_start(integer number) { power = !power; if (power) { newStrength = defStrength; newAvgStrength = defAvgStrength; newAvgDirection = defAvgDirection; newVarStrength = newVarStrength; newVarDirection = defVarDirection; newRateChange = defRateChange; initialisation(); } else llResetScript(); } }