Terrain Test Script

Kayaker Magic, April 2017


  • Rez this prim on your land to test the terrain functions
  • Use to find out if other terrain scripts will work on your land
  • Terrain functions may be disabled on your region
  • Your region may have the “Threat Level” set too low
  • Terrain functions require land ownership or estate managers
  • This prim will turn green if everything works for you
  • Also tests for an OpenSim slow list bug in your server
  • Full perm so you can share it with grid admins if needed

    I am writing a series of scripted objects that edit the terrain. A bulldozer that actually works, high speed terrain loaders, fractal terrain maps, region border smoothers, etc. To run, these scripts require the OSSL function osSetRegionHeight but this function can fail for a variety of reasons. First of all, it has a “Threat Level” of HIGH. Many grid managers set the threat level low for fear of griefing. Many OSSL functions only work for region owners or estate managers. It is possible for a grid manager to disable certain OSSL functions indizidually.

    How do you know if you can use my new terraforming tools? Get a copy of this Terrain Test prim and rez it on your ground. It will perform several tests and turn RED if you cannot set the terrain. It will turn yellow if the terrain functions work but run slowly. It will turn GREEN if everything is good to go!

    I am selling this script on the Kitely Market here at the lowest possible price for convenience, but I also have a free copy you can pick up my Kitely world Fractalis. You can hypergrid there with this address: grid.kitely.com:8002:Fractalis . In all the versions, I made the script full perm, so if it finds a problem with your region, you can share the script with your grid manager when you ask them to change permissions to allow it to run. So I'll just include a copy of the Terrain Test script below. You can cut it out, paste it into a sript in a prim and make your own Terrain Test Prim:

      //*************************
     //Terrain test:
    //test to see if the terrain programs will work for a specific person in a specific location
    // The terrain functions can be disabled for many reasons:
    //The region may have Threat Level set too low for osSetTherainHeight to run
    //The osSetTerrainHeight call could be specifically disabled.
    //The owner of this script may not be the land owner or estate manager
    //If the functions cannot be called, this prim will turn red and stay red
    //
    //Some of my terrain programs depend on being able to store and fetch values from lists
    //on some servers, this takes 10ms or more, and the scripts run incredibly slow.
    //(It looks like this only happens on regions running on Microsoft servers)
    //The prim turns yellow while it measures this speed of lists
    //if they are too slow, the prim stays yellow.
    //
    //after a minute of testing, if everything is AOK the prim turns green!
    //
    
    integer count=0;    //number of samples summed so far
    float sum=0;        //sum for calculating avarage time
    list rans;      //a table for testing list speed
    
    default
    {
        state_entry()
        {
            llSay(0,"First test to see if you can call the terrain functions at all");
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,0,0>,1.0]);
            float height = osGetTerrainHeight(0,0); //fetch one terrain value
            osSetTerrainHeight(0,0,height+10.0);    //store a new number there
            llSay(0,"Yes! Then see if the terrain calls work");
            if (osGetTerrainHeight(0,0)<(height+9.0))   //did it succeed
            {
                llOwnerSay("No, You can't change the terrain");
                return;
            }
            osSetTerrainHeight(0,0,height);    //put it back the way you found it
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<1,1,0>,1.0]);
            llSay(0,"Yes! Now test to see if list fetches are fast enough (this will take a minute)");
            integer i;      
            for (i=0;i<1024;i++)
                rans += [llFrand(1.0)];
            llSetTimerEvent(0.5);
        } //state_entry
        on_rez(integer param)
        {
            llResetScript();
        } //on_rez
        timer()
        {
            integer i=(integer)llFrand(1024.0);
            llResetTime();
            float test=llList2Float(rans,i);
            sum += llGetTime();
            if (++count >50)   //50 samples should be enough
            {
                llSetTimerEvent(0.0);
                sum = 1000.0*sum/(integer)count;
                if (sum>1.0)      //greater than 1 ms is discustingly slow
                {
                    llSay(0,"NO! List functions take "+(string)sum+" miliseconds!"+
                            "\nThis is dusgustingly slow! Go to http://opensimulator.org/mantis/view.php?id=8127 and"+
                            "\nadd a note to the bug report. Tell them this needs to be fixed!"+
                            "\nThe terrain programs will work for you but will be very slow.");
                    return;
                }
                llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,<0,1,0>,1.0]);
                llSay(0,"YES! Everything works well! The terrain programs will work for you!");
            }
        } //timer
    }
    

    Terrain Home, back to the list of other terrain programs.