Don't click here unless you want to be banned.

LSL Wiki : LibraryThermometer

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl411.us.archive.org

Thermometer


This script will calculate temperature at the objects vector.

float base;
float pascal;
float sealevel = 101.32500;
float temperatureF;
vector sun;
vector pos;
default
{
    touch_start(integer total_number)
    {
        sun = llGetSunDirection();
        pos = llGetPos();
        base = llLog10(5- ((pos.z - llWater(ZERO_VECTOR))/15500));
        pascal = (sealevel + base);
        temperatureF = ((((pascal * (2 * llPow(10,22)))/ (1.8311*llPow(10,20))/ 8.314472)/19.85553747) + (sun.z * 10));
        llSay(0,"Current Temperature is "+ (string)temperatureF +" Degrees Fahrenheit");
        llSleep(1);
        llSay(0,"Current Temperature is "+ (string)((temperatureF + 459.67) * 5/9) +" Degrees Kelvin");
        llSleep(1);
        llSay(0,"Current Temperature is "+ (string)((temperatureF - 32) * 5/9) +" Degrees Celsius");
    }
}
Comments [Hide comments/form]
I don't suppose this function takes shade into consideration? but it is interesting, and makes me currious where you find the math to figure this.
-- AakanaarLaSalle (2006-11-03 03:15:44)
Wow, how did you figure the math todo this?

And yes as Aakanaar said it would be a useful function if we could also detect it for shades also.
-- ZeeraXi (2006-11-06 16:52:30)
T = (((P*V)/N)/R) (+-S)
Temperature = (((pressure * volume)/molar mass)/gas constant) (+-) (sun offset)

T = (((((log^10(P) = H/15500) + SL) * V)/N)/R) (+-S)
Temperature = (((((log^10(Pressure) = Height/15500) + SeaLevel) * Volume)/Molar Mass)/Gas Constant) (+-Sun Offset)

This function does not take shade into consideration, shade in the sense of being in the shadow of an object, it does take shade in the sense of the sun being low or high into consideration though.
-- CidJacobs (2006-11-20 02:35:22)
... at some point in there, you could decrease your sun's radiation by llCloud().
-- ChambersCharles (2006-11-20 05:07:43)
I thought about that, but I didn't feel like working out the equation for it. If you decide to write up that snippet, please let me know in world (I would like to check it before adding it here), and be sure to use an offset to check for the cloud value at around 200 meters above the ground, and 0 cloud value if above 200 meters (although redundent because anything over that would return 0). Actually, you may want to use the angle of the sun to figure out the *exact* offset that you need to check the cloud value at, if the sun was almost set you wouldn't check the cloud value directly above it for example. *sigh* I hope you haven't inspired me to try and write this tonight.
-- CidJacobs (2006-11-21 23:42:23)
Could also add in wind chill ^_^
-- KokiriSaarinen (2007-05-05 03:17:02)
Attach a comment to this page: