Sie befinden sich hier

Inhalt

Fenster einfärben oder "dimmen"

Mit dem folgenden Skript kann ein Objekt generiert werden, dass bei Berührung ein Menü öffnet, mit dem die Transparanz anderer Objekte kontrolliert werden können.

Kontrollobjekt

Das folgende Script muss in das Objekt, das quasi als Fernbedienung dienen soll. Die Namen werden dabei im Array WALL_OPTIONS festgelegt.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// (C) 2007 Abba Thiebaud>SecondLifer 
// Please remember, I do not offer support for this script; your use of
// this script is your acknowledgement and agreement to the above
// terms.
//
// DO NOT REMOVE THE ABOVE HEADER FOR ANY REASON WHATSOEVER.
 
// Window Controller Script (put into controller prim)
list TINT_OPTIONS = ["40%", "20%", "None", "100%", "80%", "60%"];
list WALL_OPTIONS = ["Lower Front", "Lower Back", "Lower Sides", "Upper Front", "Upper Back", "Upper Sides", "Ceiling", "All"];
integer UPPER_FRONT = -28394;
integer LOWER_FRONT = -28395;
integer UPPER_BACK  = -28396;
integer LOWER_BACK  = -28397;
integer UPPER_SIDE  = -28398;
integer LOWER_SIDE  = -28399;
integer CEILING     = -28400;
integer CHANNEL     = -28393;
integer wallChannel;
integer allWalls;
 
PaintAllWalls(string tintLevel)
{
    integer i;
    integer j;
   
    j = -28394;
 
    for (i = 0; i < 7; i++)
    {
        llSay(j, tintLevel);
        j--;
    } // end for
} // end PaintAllWalls
  
default {
    state_entry()
    {
        llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
    } // end state_entry()
 
    touch_start(integer total_number)
    {
        llDialog(llDetectedKey(0), "Which wall would you like to tint?", WALL_OPTIONS, CHANNEL); // present dialog on click
        allWalls = 0;
    } // end touch_start()
 
    listen(integer channel, string name, key id, string message)
    {
        if (llListFindList(TINT_OPTIONS + WALL_OPTIONS, [message]) != -1)  // verify dialog choice
        {
            if (message == "Upper Front")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                wallChannel = UPPER_FRONT;
            }
            else if (message == "Upper Back")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                wallChannel = UPPER_BACK;
            }
            else if (message == "Upper Sides")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                wallChannel = UPPER_SIDE;
            }
            else if (message == "Lower Front")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                wallChannel = LOWER_FRONT;
            }
            else if (message == "Lower Back")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                wallChannel = LOWER_BACK;
            }
            else if (message == "Lower Sides")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                wallChannel = LOWER_SIDE;
            }
            else if (message == "Ceiling")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                wallChannel = CEILING;
            }
            else if(message == "All")
            {
                llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL);
                allWalls = 1;
             }
 
            if (message == "100%")
            {
                if(allWalls == 1)
                {
                    PaintAllWalls("100");
                }
                else
                {
                    llSay(wallChannel, "100");
                }
             }
            else if (message == "80%")
            {
                if(allWalls == 1)
                {
                    PaintAllWalls("80");
                }
                else
                {
                    llSay(wallChannel, "80");
                }
             }
            else if (message == "60%")
            {
                if(allWalls == 1)
                {
                    PaintAllWalls("60");
                }
                else
                {
                    llSay(wallChannel, "60");
                }
             }
            else if (message == "40%")
            {
                if(allWalls == 1)
                {
                    PaintAllWalls("40");
                }
                else
                {
                    llSay(wallChannel, "40");
                }
             }
            else if (message == "20%")
            {
                if(allWalls == 1)
                {
                    PaintAllWalls("20");
                }
                else
                {
                    llSay(wallChannel, "20");
                }
             }
            else if (message == "None")
            {
                if(allWalls == 1)
                {
                    PaintAllWalls("0");
                }
                else
                {
                    llSay(wallChannel, "0");
                }
             }
          } // end if (valid message)
    }  // end listen
} // end default 

Script für zu färbende Objekte

Dieses Script muss in alle wählbaren Objekte. Dabei muss ein Channel durch Entfernen des "//" aktiviert werden, wodurch das Objekt durch das Kontrollscript ansprechbar wird.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// (C) 2007 Abba Thiebaud>SecondLifer 
// Please remember, I do not offer support for this script; your use of
// this script is your acknowledgement and agreement to the above
// terms.
//
// DO NOT REMOVE THE ABOVE HEADER FOR ANY REASON WHATSOEVER.
//
//
//
//Here the target (aka Windows), put this script into them.
//integer chan = -28394; // uncomment for UPPER_FRONT
//integer chan = -28395; // uncomment for LOWER_FRONT
//integer chan = -28396; // uncomment for UPPER_BACK
//integer chan = -28397; // uncomment for LOWER_BACK
//integer chan = -28398; // uncomment for UPPER_SIDE
//integer chan = -28399; // uncomment for LOWER_SIDE
//integer chan = -28400; // uncomment for CEILING
 
//START SCRIPT
default
{
        state_entry()
        {
                llListen(chan, "", NULL_KEY, "" );
        }
 
        listen( integer channel, string name, key id, string message )
        {
                if ( message == "100" )
                {
                        llSetAlpha(1.0, ALL_SIDES);
                }
                else if ( message == "80" )
                {
                        llSetAlpha(0.8, ALL_SIDES);
                }
                else if ( message == "60" )
                {
                        llSetAlpha(0.6, ALL_SIDES);
                }
                else if ( message == "40" )
                {
                        llSetAlpha(0.4, ALL_SIDES);
                }
                else if ( message == "20" )
                {
                        llSetAlpha(0.2, ALL_SIDES);
                }
                else if ( message == "0" )
                {
                        llSetAlpha(0.0, ALL_SIDES);
                }
        }
}
//////END SCRIPT

Kontextspalte

Kegelspiele