OsSetTerrainTexture
From OpenSimulator
osSetTerrainTexture(integer level, key texture)
| |
| Set the terrain texture of the estate to the texture given as key. The level can be 0, 1, 2 or 3. | |
| Threat Level | High |
| Permissions | ESTATE_MANAGER,ESTATE_OWNER |
| Extra Delay | 0 seconds |
| Example(s) | |
// Default Terrain Textures by djphil 2018
default
{
state_entry()
{
osSetTerrainTexture(0, "b8d3965a-ad78-bf43-699b-bff8eca6c975");
osSetTerrainTextureHeight(0, 10.0, 60.0);
osSetTerrainTexture(1, "abb783e6-3e93-26c0-248a-247666855da3");
osSetTerrainTextureHeight(1, 10.0, 60.0);
osSetTerrainTexture(2, "179cdabd-398a-9b6b-1391-4dc333ba321f");
osSetTerrainTextureHeight(2, 10.0, 60.0);
osSetTerrainTexture(3, "beb169c7-11ea-fff2-efe5-0f24dc881df2");
osSetTerrainTextureHeight(3, 10.0, 60.0);
}
}
// Random Terrain Texture
integer gTimerInterval = 300; // 300 seconds (5 minutes)
changeTextures()
{
// Get the number of terrain textures in the prim inventory
integer numTextures = llGetInventoryNumber(INVENTORY_TEXTURE);
// If there is at least one terrain texture
if (numTextures > 0)
{
// Loop through each corner
integer i;
for (i = 0; i < 4; ++i)
{
// Select a random terrain texture from the inventory
string randomTextureName = llGetInventoryName(INVENTORY_TEXTURE, llFloor(llFrand(numTextures)));
// Get the UUID
key randomTextureUUID = llGetInventoryKey(randomTextureName);
// Set the selected terrain texture for the current corner
osSetTerrainTexture(i, randomTextureUUID);
// Display the selected random texture UUID in chat
llOwnerSay("Selected random terrain texture" + (string)i + ": " + randomTextureName + " - " + randomTextureUUID);
}
}
else
{
llOwnerSay("No terrain textures found in the prim inventory.");
}
}
default
{
state_entry()
{
// Start the timer to change textures every xxx seconds
llSetTimerEvent(gTimerInterval);
// Initial texture change
changeTextures();
}
timer()
{
// Change textures when the timer fires
changeTextures();
}
}
| |
| Notes | |
| This function was added in 0.7.4-post-fixes | |