| Scripting Discuss scripting for SL and other platforms |
| |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Mr. Mannonen ![]()
in love... ALWAYS!!!
Join Date: Jul 2009 Location: in the eyes of my soulmate...
Posts: 31
SL Join Date: 11/13/2007
Business: none
| Hide pictures while offline Ok I do not know if it is possible but I am looking for a script that only show the pictures on my walls when me and my partner are online, so when one of us is online they are shown, if we both are offline they should be replaced by let say a solid black texture... is this possible? I have seen temp rezzers that only work when the owner is online and maybe it works whit textures too? |
| | |
| | #2 (permalink) |
| Emergency Mustelid ![]() ![]() ![]() Join Date: Sep 2009
Posts: 1,073
| Avatar On/Offline Detection Not the whole script of course, but make a box and have it call llSetTexture() on face zero when you're detected. Or maybe llSetColor() the texture black when you're not. |
| | |
| | #3 (permalink) |
| Mr. Mannonen ![]()
in love... ALWAYS!!!
Join Date: Jul 2009 Location: in the eyes of my soulmate...
Posts: 31
SL Join Date: 11/13/2007
Business: none
| thanks but that would only work for me as the owner right? what if i wanted to have my parnter in there too so that it detects two avatars woudl that be possible too? Sorry I am a scripting impaired guy ;-) |
| | |
| | #4 (permalink) |
| aircraft manufacturer ![]() ![]()
in the clouds
Join Date: Aug 2007 Location: Vancouver, BC
Posts: 582
SLShopper Ads: 12 SL Join Date: September 2003
Business: Abbotts Aerodrome | Instead of using an online detector, maybe you instead want to see if the right people are present in the house? That way pictures are blacked out if you're online, but elsewhere. Here's my attempt. [Edit: I tested it... works ok.] Code: // PICTURE BLACKOUT
// LOOKS FOR PEOPLE ON A LIST
// IF NOBODY ON THE LIST IS PRESENT, IT TURNS THE PRIM BLACK
// Instructions:
// 1. Put this script in the same prim that has the picture on it.
//
// 2. In that prim's Description field, list all the people who the picture should show itself to. Separate names with a comma, no spaces.
// example:
// Cubey Terra,Beowulf Blackburn,Philip Linden,Cristiano Midnight,Aimee Weebler
float INTERVAL = 60; // how often in seconds to check for people on whitelist
float RANGE = 90; // range of sensor
vector CLR_ON = <1,1,1>;
vector CLR_OFF = <0,0,0>;
integer isOnList(string name)
{
list people = llCSV2List(llGetObjectDesc());
integer num = llGetListLength(people);
integer i;
for (i=0;i<num;i++)
{
if (llToLower(name) == llToLower(llList2String(people,i))) // compare names in lower case because SL names are often mistyped
{
return TRUE;
}
}
return FALSE;
}
default
{
state_entry()
{
llSetTimerEvent(INTERVAL);
}
timer()
{
llSensor("","",AGENT,RANGE,TWO_PI); // Scans for all agent in RANGE
}
sensor(integer num_detected)
{
integer i;
integer detected;
for (i=0;i<num_detected;i++)
{
string name = llDetectedName(i);
if (isOnList(name)) // if a detected agent is on the list...
{
detected = TRUE;
}
}
if (detected)
{
if (llGetColor(0) != CLR_ON) llSetColor(CLR_ON,ALL_SIDES);
}
else
{
if (llGetColor(0) != CLR_OFF) llSetColor(CLR_OFF,ALL_SIDES);
}
}
}
__________________ . . . . . Cubey Terra Terra Aeronautics @ Abbotts Aerodrome Terra Aeronautics @ XStreetSL www.cubeyterra.com Last edited by Cubey Terra; 11-06-2009 at 07:08 PM. |
| | |
| | #7 (permalink) |
| exp(ln(Gearhead)) ![]() ![]() ![]() ![]() ![]() | Sensors are heavy loads on sims when a lot of people are in range, so it's best to reduce the frequency and range to what is necessary. The 60 sec interval is good. float RANGE = 90; // range of sensor Change the 90 to whatever range from which you still wish to be able to view the pic. |
| | |
| 1 User Agreed: |
| | #8 (permalink) |
| The Purple ![]() ![]() ![]() ![]()
Kinda at work. Somewhat.
Join Date: Dec 2007 Location: Somewhere purple, Germany
Posts: 3,096
My Mood: | I'd not use sensors for this..after all, you can be online without being in sensor range. :3 Code: list AVATARS=["Youravatarkey","anotheravatarkey","yetanotheravatarkey"];
list lImageLinks;
integer iPrimAmount;
integer iAvatarListLength;
integer iTemp;
integer iTemp2;
integer iTemp3;
key kQuery;
string sTemp;
getPrims()
{
llSetTimerEvent(0);
kQuery=NULL_KEY;
iTemp=iPrimAmount=llGetNumberOfPrims();
lImageLinks=[];
do
{
if(llListFindList(AVATARS,[sTemp=llGetLinkName(iTemp)]) != -1)
{
lImageLinks+=sTemp;
lImageLinks+=iTemp;
lImageLinks+=0;
llSetLinkColor(iTemp,<0,0,0>,2);
}
}
while(iTemp=~-iTemp);
llSetTimerEvent(60);
}
default
{
state_entry()
{
iAvatarListLength=AVATARS != [];
getPrims();
//if(lImageLinks != [])
llSetTimerEvent(0.01);
}
changed(integer change)
{
if(change & CHANGED_LINK)
getPrims();
}
timer()
{
llSetTimerEvent(0);
iTemp2=llListFindList(lImageLinks,[sTemp=llList2String(AVATARS,iTemp=0)]);
kQuery=llRequestAgentData((key)sTemp,DATA_ONLINE);
}
dataserver(key query, string data)
{
if(kQuery==query)
{
if((integer)data)
{
if(!(llList2Integer(lImageLinks,iTemp3=iTemp2+2)))
{
llSetLinkColor(llList2Integer(lImageLinks,iTemp2+1),<1,1,1>,2);
llListReplaceList(lImageLinks,[1],iTemp3,iTemp3);
}
}
else
{
if(llList2Integer(lImageLinks,iTemp3=iTemp2+2))
{
llSetLinkColor(llList2Integer(lImageLinks,iTemp2+1),<0,0,0>,2);
llListReplaceList(lImageLinks,[0],iTemp3,iTemp3);
}
}
if((iTemp=-~iTemp) < iAvatarListLength)
{
iTemp2=llListFindList(lImageLinks,[sTemp=llList2String(AVATARS,iTemp)]);
kQuery=llRequestAgentData(sTemp,DATA_ONLINE);
}
else
{
iTemp=iTemp2=0;
kQuery=NULL_KEY;
llSetTimerEvent(60);
}
}
}
}
1. Have a single, linked object. 2. Give the prims that are supposed to show the pictures the UUIDs/Keys of the avatars as names. 3. Put the pictures on the front of the prims. For example on a cube, put the texture on the face on the positive X axis 4. Put the avatar keys at the top of this script 5. Slip the script into the root prim. 6. Voila. It will now show the images if the avatars are online, or turn them black if they are offline, no matter if they are in the same sim or across the grid. No sensors involved. It checks every 60 seconds. You only need this single script in the whole build. You can unlink and relink the whole object anytime. If you want to add people, just give another prim the new avatar key, add the key to the list at the top of the script, and save it.
__________________ "Have you ever noticed that anybody driving slower than you is an idiot, and anyone going faster than you is a maniac?" - George Carlin Last edited by Chalice Yao; 11-10-2009 at 08:28 PM. |
| | |
| | #10 (permalink) | |
| The Purple ![]() ![]() ![]() ![]()
Kinda at work. Somewhat.
Join Date: Dec 2007 Location: Somewhere purple, Germany
Posts: 3,096
My Mood: | Quote:
Actually, what the thing is missing is a way to set oneself on/offduty via click. I guess that'd make more sense than anything, and would require the item to only check if somebody clicked it, is 'on duty' but then went offline, and turns off their image. It shoudn't actually check if people come online, only enable the image after a click on it by the person. After all, not everybody wants to instantly get shown as available after login, nor when they merely hang at the place. I'll write that up later. *Pokes Beowulf* Up to your preferences of course. Last edited by Chalice Yao; 11-09-2009 at 05:05 AM. | |
| | |
| | #12 (permalink) |
| The Purple ![]() ![]() ![]() ![]()
Kinda at work. Somewhat.
Join Date: Dec 2007 Location: Somewhere purple, Germany
Posts: 3,096
My Mood: | Oh, they are handy if the store has employees. I've done customer support for TOC for a while, and the board was quite frequently used by the customers. |
| | |
| | #13 (permalink) | |
| Junior Member ![]() Join Date: Oct 2009
Posts: 19
Business: ab's Emporium
| Quote:
Many people don't realise for these devices to work while the owner is offline, the owner of the object needs to have offline building rights on the land. This is automatic if the owner also owns the land, or if the land is owned by a group and the object is deeded to the group. Alternatively if it is group owned land, and group members are allowed to build, and the owner of the object is a member of the group, the object needs to be set to the group.
__________________ Vendors, clocks, timers, neon signs, donation boxes and other gadgets Xstreet: https://www.xstreetsl.com/modules.ph...rchantID=45738 In-world: http://slurl.com/secondlife/Monowai/237/111/68 Web: http://www.absemporium.com | |
| | |
| | #15 (permalink) |
| Mr. Mannonen ![]()
in love... ALWAYS!!!
Join Date: Jul 2009 Location: in the eyes of my soulmate...
Posts: 31
SL Join Date: 11/13/2007
Business: none
| I just found the replies, yes I am old and yes I can be ridicously slow at times, thanks for the Code Chalice, I was going for a pure home use for this. As I have some pictures that are more pricate and should not be shown to random avatars that happen to come into our house when we are not there ;-) I will try out your code too, but couldn't really inspect any additional lag in my home so far with Cubeys Code.... |
| | |
| | #17 (permalink) |
| aircraft manufacturer ![]() ![]()
in the clouds
Join Date: Aug 2007 Location: Vancouver, BC
Posts: 582
SLShopper Ads: 12 SL Join Date: September 2003
Business: Abbotts Aerodrome | It's true, sensors cause lag. If you have a lot of pictures, may I suggest this much shorter script? This one uses llKey2Name to discover if the picture's owner is in the sim (or has been in the sim recently). If not, llKey2Name returns a null string, otherwise, it returns the owner's name. Very simple, very short, no sensors. Code: // PICTURE BLACKOUT BY OWNER
// CHECKS IF PRIM'S OWNER IS PRESENT IN THE SIM. IF NOT, IT TURNS THE PRIM BLACK
// Instructions: Put this script in the same prim that has the picture on it.
float INTERVAL = 15; // how often in seconds to check if owner is present in the sim
vector CLR_ON = <1,1,1>;
vector CLR_OFF = <0,0,0>;
default
{
state_entry()
{
llSetTimerEvent(INTERVAL);
}
timer()
{
if (llKey2Name(llGetOwner()) == "") llSetColor(CLR_OFF,ALL_SIDES);
else llSetColor(CLR_ON,ALL_SIDES);
}
}
|
| | |
| 1 User Said Thanks: |
![]() |
| Thread Tools | |
| Display Modes | |
| |