OsSetRegionWaterHeight

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 35: Line 35:
  
 
<source lang="lsl">
 
<source lang="lsl">
// Hochwasser - flooding
+
// flooding V1.0.1
  
 
integer waterstatus = TRUE;
 
integer waterstatus = TRUE;
Line 43: Line 43:
 
flooding()
 
flooding()
 
{
 
{
     while ( zaehler >= 20.00 )
+
     while (zaehler >= 20.00)
 
     {
 
     {
      llSleep(tspeed);
+
        llSleep(tspeed);
      osSetRegionWaterHeight(zaehler);
+
        osSetRegionWaterHeight(zaehler);
      zaehler = zaehler - 0.01;
+
        zaehler -= 0.01;
 
     }
 
     }
 
}
 
}
Line 53: Line 53:
 
drying()
 
drying()
 
{
 
{
     while ( zaehler <= 20.49 )
+
     while (zaehler <= 20.49)
 
     {
 
     {
      llSleep(tspeed);
+
        llSleep(tspeed);
      osSetRegionWaterHeight(zaehler);
+
        osSetRegionWaterHeight(zaehler);
      zaehler = zaehler + 0.01;
+
        zaehler += 0.01;
 
     }
 
     }
 
}
 
}
Line 63: Line 63:
 
default
 
default
 
{
 
{
     state_entry() {
+
     state_entry()
 +
    {
 
         osSetRegionWaterHeight(20.0);
 
         osSetRegionWaterHeight(20.0);
 
     }
 
     }
  
     touch_start(integer total_number) {
+
     touch_start(integer total_number)
         if ( waterstatus )
+
    {
 +
         if (waterstatus)
 
         {
 
         {
 
             waterstatus = FALSE;
 
             waterstatus = FALSE;
Line 78: Line 80:
 
             drying();
 
             drying();
 
         }
 
         }
         llSay(0, " Wasserstand Fertig!");
+
         llSay(0, "Water level finished!");
 
     }
 
     }
 
 
}
 
}
 
</source>
 
</source>
  
 
<source lang="lsl">
 
<source lang="lsl">
// Gezeiten Tide V1.0.1
+
// Tide V1.0.1
 
+
 
integer waterstatus = TRUE;
 
integer waterstatus = TRUE;
 
float zaehler = 20.00;
 
float zaehler = 20.00;
 
float tspeed = 0.1;
 
float tspeed = 0.1;
 
+
 
float gap = 2.0;
 
float gap = 2.0;
 
float counter = 0.0;
 
float counter = 0.0;
 
+
 
flooding()
 
flooding()
 
{
 
{
     while ( zaehler >= 20.00 )
+
     while (zaehler >= 20.00)
 
     {
 
     {
      llSleep(tspeed);
+
        llSleep(tspeed);
      osSetRegionWaterHeight(zaehler);
+
        osSetRegionWaterHeight(zaehler);
      zaehler = zaehler - 0.01;
+
        zaehler -= 0.01;
 
     }
 
     }
 
}
 
}
 
+
 
drying()
 
drying()
 
{
 
{
     while ( zaehler <= 20.15 )
+
     while (zaehler <= 20.15)
 
     {
 
     {
      llSleep(tspeed);
+
        llSleep(tspeed);
      osSetRegionWaterHeight(zaehler);
+
        osSetRegionWaterHeight(zaehler);
      zaehler = zaehler + 0.01;
+
        zaehler += 0.01;
 
     }
 
     }
 
}
 
}
 
+
 
default
 
default
 
{
 
{
     state_entry() {
+
     state_entry()
 +
    {
 
         osSetRegionWaterHeight(20.0);
 
         osSetRegionWaterHeight(20.0);
 
         llSetTimerEvent(gap);
 
         llSetTimerEvent(gap);
 
     }
 
     }
   
+
 
     timer()
 
     timer()
 
     {
 
     {
         counter = counter + gap;  
+
         counter += gap;  
         if ( waterstatus )
+
         if (waterstatus)
 
         {
 
         {
 
             waterstatus = FALSE;
 
             waterstatus = FALSE;
Line 136: Line 138:
 
     }
 
     }
 
}
 
}
 
 
</source>
 
</source>
 +
 
|description=Sets the water height for the current region.
 
|description=Sets the water height for the current region.
 
|
 
|
 
}}
 
}}

Latest revision as of 07:00, 10 September 2023

osSetRegionWaterHeight(float height)
Sets the water height for the current region.
Threat Level High
Permissions ESTATE_MANAGER,ESTATE_OWNER
Extra Delay 0 seconds
Example(s)
// Region Water Height utility
// I know, it's probably horribly inefficient and confusing, but it works.
// Arkaniad Exonar, '10
 
float g_WaterHeight; // <---- Storage Var
integer g_ListenChan = 0;
list g_ltmp; // <--------Temporary buffer
 
default
{
    state_entry()
    {
        llListen(g_ListenChan, "", llGetOwner(), ""); //Prepare listener
        llSay(0, "Ready for commands");
    }
    listen(integer channel, string name, key id, string message)
    {
        g_ltmp = llParseString2List(message, [" "], []); // Split the message into chunks
        if(llList2String(g_ltmp, 0) == "/waterheight") // Self explanatory
        {
            osSetRegionWaterHeight(llList2Float(g_ltmp, 1)); // Set the region water height to the specified value
            llSay(0, "Setting region water height to "+llList2String(g_ltmp, 1)+"m (In case anyone was wondering)");
            g_ltmp = []; // Flush buffers
        }
    }
}
// flooding V1.0.1
 
integer waterstatus = TRUE;
float zaehler = 20.00;
float tspeed = 0.25;
 
flooding()
{
    while (zaehler >= 20.00)
    {
        llSleep(tspeed);
        osSetRegionWaterHeight(zaehler);
        zaehler -= 0.01;
    }
}
 
drying()
{
    while (zaehler <= 20.49)
    {
        llSleep(tspeed);
        osSetRegionWaterHeight(zaehler);
        zaehler += 0.01;
    }
}
 
default
{
    state_entry()
    {
        osSetRegionWaterHeight(20.0);
    }
 
    touch_start(integer total_number)
    {
        if (waterstatus)
        {
            waterstatus = FALSE;
            flooding();
        }
        else
        {
            waterstatus = TRUE;
            drying();
        }
        llSay(0, "Water level finished!");
    }
}
// Tide V1.0.1
 
integer waterstatus = TRUE;
float zaehler = 20.00;
float tspeed = 0.1;
 
float gap = 2.0;
float counter = 0.0;
 
flooding()
{
    while (zaehler >= 20.00)
    {
        llSleep(tspeed);
        osSetRegionWaterHeight(zaehler);
        zaehler -= 0.01;
    }
}
 
drying()
{
    while (zaehler <= 20.15)
    {
        llSleep(tspeed);
        osSetRegionWaterHeight(zaehler);
        zaehler += 0.01;
    }
}
 
default
{
    state_entry()
    {
        osSetRegionWaterHeight(20.0);
        llSetTimerEvent(gap);
    }
 
    timer()
    {
        counter += gap; 
        if (waterstatus)
        {
            waterstatus = FALSE;
            flooding();
        }
        else
        {
            waterstatus = TRUE;
            drying();
        }
    }
}
Personal tools
General
About This Wiki