Page 2 of 3

Re: Environmental Enhancements and Improved Scripting

Posted: Sat May 15, 2021 11:48 am
by Dot Matrix
Graham Mills wrote:
Fri May 14, 2021 6:02 pm
Of course, for anyone starting from scratch this would be a very useful resource, not least by virtue of the preview images, so many thanks to Dot for her efforts to date.
Thanks, Graham -- that's a good idea. I'll try to add the preview images to the preset folders from now on.

If anyone is wondering, the photos are taken from various viewpoints in Intersections and Paths, the latter being a layered compilation of ancient but classic OpenSim builds by Paislee Myrtle and Shenn Tao slowly being updated where necessary/possible -- you might recognise the plant tendrils in the previews for EEP: Places, and here’s a fresh photo using an EEP setting available from EEP: [TOR] skies

Paths-Illusion-[TOR]-MightyMoon_001.png
Paths-Illusion-[TOR]-MightyMoon_001.png (437.8 KiB) Viewed 49501 times

Re: Environmental Enhancements and Improved Scripting

Posted: Sat May 15, 2021 7:40 pm
by Graham Mills
Simple HUD for parcel-level daycycle image display (as per Dot's product albeit those aren't daycycles) and setting replacement. Feel free to improve.

Box prim <0.45000, 0.25000, 0.00100> tapered 0.3 on X axis to give three faces. I colour the left (face 2) and right (face 4) red and green respectively and leave the large central one white to display the image. You may need to play with the face values. Attach to HUD display and rotate/position to suit so you can see the three faces.

The image and daycycle setting need to be numbered in a similar manner, e.g. 01image, 01dc, 02image, 02dc, etc and added to the prim inventory along with the script below.

Select the red and green face to page through the images displayed on the middle face and select the middle face to change the parcel daycycle.

Code: Select all

integer p = 0;
integer count;
integer transition = 3;

default
{
    state_entry()
    {
        p = 0;
        count = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
    }
    
    touch_start(integer n)
    {
        integer face = llDetectedTouchFace(0);
        if (face == 4)
        {
            //next
            p++;
            if (p == count)
            {
                p = 0;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 2)
        {
            //prev
            p = p-1;
            if (p < 0)
            {
                p = count-1;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 0)
        {
            //replace
            osReplaceParcelEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p));
        }
    }
}

Re: Environmental Enhancements and Improved Scripting

Posted: Sun May 16, 2021 1:59 pm
by Graham Mills
Same HUD but this time extended for region daycycle replacement. If your avatar is on a standard parcel, parcel replacement is used. If the avatar is on a parcel with Region in its name then region replacement at ground level is used. However, it is also necessary to use the World|Parcel details|Environment|Use Region Settings button or nothing will happen. As ever, feel free to ignore/improve; this is very much a learning exercise for yours truly. As previously, you will need appropriate permissions for changes to take effect.

ps If you override region/parcel settings by setting, for example, Midday from the World|Environment menu, you will also need to enable Use Shared Environments from the same menu to enable the HUD.

PS Useful thread on the default daycycle viewtopic.php?f=8&p=30328#p30328

Code: Select all

integer p = 0;
integer count;
integer transition = 3;

default
{
    state_entry()
    {
        p = 0;
        count = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
    }
    
    on_rez(integer n)
    {
        p = 0;
        count = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
    }
    
    touch_start(integer n)
    {
        list details = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
        string flag = "";
        if (llSubStringIndex(llList2String(details ,0), "Parcel") > -1)
        {
            flag = "Parcel";
        }
        else if (llSubStringIndex(llList2String(details ,0), "Region") > -1)
        {
            flag = "Region";
        }    
        integer face = llDetectedTouchFace(0);
        if (face == 4)
        {
            //next
            p++;
            if (p == count)
            {
                p = 0;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 2)
        {
            //prev
            p = p-1;
            if (p < 0)
            {
                p = count-1;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 0)
        {
            //replace   
            if (flag == "Region")
            {
                llOwnerSay("Changing region daycycle");
                osReplaceRegionEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p), (float)(llGetRegionDayLength()/3600), (float)((llGetRegionDayOffset()/3600)-24.0), 0, 0, 0);
                osReplaceRegionEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p), 4.0, -8.0, 0, 0, 0);
            }
            else 
            {
                llOwnerSay("Changing parcel daycycle");
                osReplaceParcelEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p));
            }
                
        }
    }
}

Re: Environmental Enhancements and Improved Scripting

Posted: Sat May 22, 2021 9:18 pm
by Graham Mills
Modified HUD by adding taper value 0.3 in Y dimension to expose further faces at top (face 3) and bottom (face 1). Touching face 1 assigns currently displayed daycycle to avatar irrespective of location on that region, face 3 reverts to region default. Usual caveats.

Code: Select all

integer p = 0;
integer count;
integer transition = 3;

default
{
    state_entry()
    {
        p = 0;
        count = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
    }
    
    on_rez(integer n)
    {
        p = 0;
        count = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
    }
    
    touch_start(integer n)
    {
        list details = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
        string flag = "";
        if (llSubStringIndex(llList2String(details ,0), "Parcel") > -1)
        {
            flag = "Parcel";
        }
        else if (llSubStringIndex(llList2String(details ,0), "Region") > -1)
        {
            flag = "Region";
        }    
        integer face = llDetectedTouchFace(0);
        if (face == 4)
        {
            //next
            p++;
            if (p == count)
            {
                p = 0;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 2)
        {
            //prev
            p = p-1;
            if (p < 0)
            {
                p = count-1;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 0)
        {
            //replace   
            if (flag == "Region")
            {
                llOwnerSay("Changing region daycycle");
                osReplaceRegionEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p), (float)(llGetRegionDayLength()/3600), (float)((llGetRegionDayOffset()/3600)-24.0), 0, 0, 0);
                osReplaceRegionEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p), 4.0, -8.0, 0, 0, 0);
            }
            else 
            {
                llOwnerSay("Changing parcel daycycle");
                osReplaceParcelEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p));
            }    
        }
        else if (face == 1)
        {
            llOwnerSay("Changing avatar daycycle");
            osReplaceAgentEnvironment(llDetectedKey(0), transition, llGetInventoryName(INVENTORY_SETTING, p));
        }
        else if (face == 3)
        {
            llOwnerSay("Reverting avatar daycycle");
            osReplaceAgentEnvironment(llDetectedKey(0), transition, NULL_KEY);
        }
    }
}

Re: Environmental Enhancements and Improved Scripting

Posted: Sun May 23, 2021 1:14 pm
by Graham Mills
A rather inelegant mod, this both changes the avatar-specific daycycle and makes that daycycle accessible inworld by rezzing an object (daycycle sensor) that changes the daycycle for any avatar that touches it. It could, of course, respond to other events such as proximity or collision.

HUD

Code: Select all

integer p = 0;
integer count;
integer transition = 3;
key DC;

default
{
    state_entry()
    {
        p = 0;
        count = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
    }
    
    on_rez(integer n)
    {
        p = 0;
        count = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
    }
    
    object_rez(key k)
    {
        osMessageObject(k, DC);
    } 
        
    
    touch_start(integer n)
    {
        list details = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
        string flag = "";
        if (llSubStringIndex(llList2String(details ,0), "Parcel") > -1)
        {
            flag = "Parcel";
        }
        else if (llSubStringIndex(llList2String(details ,0), "Region") > -1)
        {
            flag = "Region";
        }    
        integer face = llDetectedTouchFace(0);
        if (face == 4)
        {
            //next
            p++;
            if (p == count)
            {
                p = 0;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 2)
        {
            //prev
            p = p-1;
            if (p < 0)
            {
                p = count-1;
            }
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, p), 0);
        }
        else if (face == 0)
        {
            //replace   
            if (flag == "Region")
            {
                llOwnerSay("Changing region daycycle");
                osReplaceRegionEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p), (float)(llGetRegionDayLength()/3600), (float)((llGetRegionDayOffset()/3600)-24.0), 0, 0, 0);
                osReplaceRegionEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p), 4.0, -8.0, 0, 0, 0);
            }
            else 
            {
                llOwnerSay("Changing parcel daycycle");
                osReplaceParcelEnvironment(transition, llGetInventoryName(INVENTORY_SETTING, p));
            }    
        }
        else if (face == 1)
        {
            llOwnerSay("Changing avatar daycycle");
            osReplaceAgentEnvironment(llDetectedKey(0), transition, llGetInventoryName(INVENTORY_SETTING, p));
            DC = llGetInventoryKey(llGetInventoryName(INVENTORY_SETTING, p));
            llRezObject("daycycle sensor", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, 0);
        }
        else if (face == 3)
        {
            llOwnerSay("Reverting avatar daycycle");
            osReplaceAgentEnvironment(llDetectedKey(0), transition, NULL_KEY);
        }
    }
}
daycycle sensor (needs to be added to prim and then taken into HUD inventory)

Code: Select all

key DC;

default
{    
    dataserver(key query_id, string data)
    {
        DC = data;
    }
    
    touch_start(integer n)
    {
        osReplaceAgentEnvironment(llDetectedKey(0), 3, DC);
    }
}

Re: Environmental Enhancements and Improved Scripting

Posted: Mon May 24, 2021 11:46 am
by Graham Mills
While there are a number of guides/tutorials on EEP, this is the most useful I've yet found on the role of the various options available under sky and water settings. It includes guidance on how to create a rainbow setting.

https://community.secondlife.com/knowle ... ditor-r24/

Inara Pey also has a number of relevant blogs

https://modemworld.me/2020/04/21/enviro ... -a-primer/

https://modemworld.me/2020/04/21/tutori ... oject-eep/

https://modemworld.me/2020/12/10/firest ... e-release/

Re: Environmental Enhancements and Improved Scripting

Posted: Fri Jun 11, 2021 1:52 pm
by Graham Mills
Worth noting that direct access to the old sky presets is available from the Quick Prefs button, bottom right. There are also a few daycycle options, plus any you add yourself.

Re: Environmental Enhancements and Improved Scripting

Posted: Sat Apr 09, 2022 6:32 pm
by Mike Lorrey
EEP is not functioning properly. As an estate manager and land group officer in the ISMuseum region I should be able to modify EEP at both region and parcel levels, but even though parcel level EEP modification is enabled in the region settings, the group settings do not show me being able to modify these settings.
kitelyEEPbug.png
kitelyEEPbug.png (106.74 KiB) Viewed 39792 times
EDIT: This problem only exists in the parcel in the southwest corner of the region. I am unable to subdivied this parcel as well, but I can subdivide the others in the region. All parcels are owned by the ISM Planning group, which I am an officer in and am empowered to modify parcels, subdivde and modifiy EEP.

Re: Environmental Enhancements and Improved Scripting

Posted: Sat Apr 09, 2022 6:38 pm
by Ilan Tochner
Hi Mike,

Is this working properly with the same Firestorm version on OSgrid?

Re: Environmental Enhancements and Improved Scripting

Posted: Sat Apr 09, 2022 7:22 pm
by Mike Lorrey
Ilan Tochner wrote:
Sat Apr 09, 2022 6:38 pm
Hi Mike,

Is this working properly with the same Firestorm version on OSgrid?
See edit to above comment. I do not have any regions or parcels in OSG to experiment with.