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

LSL Wiki : llGetRegionTimeDilation

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
float llGetRegionTimeDilation()

Returns the time dilation of the current region (simulator) as a float between 0 and 1.

Time dilation occurs when the sim can't keep up with the processing of its tasks even after reducing the time allocated to scripts and physics. Avatars will experience this as slowed-down (slow-motion, "bullet-time") movement.

If you have many scripts running in a sim (or physical objects), it would be considerate to pause them when the time dilation drops below a certain threshold (0.8 - 0.9).

See llGetRegionFPS and lag.

This is a script that will automatically pause all scripts once dilation drops below 0.65:

integer running;

string giv(integer type,integer i) {
    return llGetInventoryName(type,i);
}

default
{
    on_rez(integer s) { llResetScript();} //Habit - llGetOwner() has a habit of returning the old owner's name when given to another person.

    state_entry()
    {
        llSetTimerEvent(0.3); //Repeat every 3/10th of a second.
        running = TRUE;
    }

    timer() {
        float dilation = llGetRegionTimeDilation(); //Get the dilation
        if(dilation < 0.65 && running) {  //If the dilation is less than 65%
            llOwnerSay("Time Dilaton is critical! Pausing scripts!"); //Say to the owner that message
            integer x;
            for(x=0;x<llGetInventoryNumber(INVENTORY_SCRIPT);x++) {
                if(giv(INVENTORY_SCRIPT,x) != llGetScriptName()) { //If the script number x is not this script
                    llSetScriptState(giv(INVENTORY_SCRIPT,x),FALSE); //Pause it
                }
            }
            running = FALSE;
            llOwnerSay("Done.");
        }
        else
        if (!running)
        { //If the dilation is more than 65%
            integer x;
            for(x=0;x<llGetInventoryNumber(INVENTORY_SCRIPT);x++) {
                if(giv(INVENTORY_SCRIPT,x) != llGetScriptName()) {
                    llSetScriptState(giv(INVENTORY_SCRIPT,x),TRUE); //Enable all scripts
                }
            }
            running = TRUE;
        }
    }
}


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Simulator | Time | Lag Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah
Comments [Hide comments/form]
Could one say, very broadly, that time dilation is the percentage of one second's work a sim is actually doing in a second?
-- cpe-24-193-7-143.nyc.res.rr.com (2007-04-08 07:50:14)
On that sample script I'd like to comment that is seems that it is only effective in a demanding gadget. It checks every 0.3 seconds for lag, and that adds even more to the lag, so it would be logical to add the script only if your main scripts in the item are even more lag generating. For example no reason to add this in a lamp that turns on/off at touch. (I edited the script to make it a little lag friendly, the old one was actually stopping/starting scripts every 0.3 seconds :o)
-- MerothJunge (2007-04-10 06:41:29)
I'd suggest-
Checking less often....as mentioned above, every third of a second seems excessive.
Keep a count of "good" results and "bad" results...and only switch on/off your scripts when you get several of the same type in a row.
You don't want to be switching on brief spikes, only on sustained good/bad dilation.
-- n198-169-189-000.static.online-age.net (2007-10-09 15:02:04)
Attach a comment to this page: