Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need Help Scripting - Colors / Invsable

Goldenstar Sands
Registered User
Join date: 23 May 2008
Posts: 18
09-23-2008 17:58
Random Hello~

I'm new to scriping so i have been having a few bumping along the way.. right now i have two questions i was going to ask:

Color changing scripting, I have been trying to make a scrip where then i say /1 red it changes the whole object red. I have tired llSetColor wich only removed the master prim. and llSetLinkColor wich does work... if i about 144 lines..

My question is there a way to have my script tell my object to change the color of all it's prims without having a long winded scripting line?

default
{
state_entry()
{
llListen(1,"","","red";);
llSay(0, "Say /1 red";);
}

listen(integer channel, string name, key id, string message)
{
if (message == "red";)
llSetLinkColor(1, <1,0,0>, ALL_SIDES);


}


Another thing I have been looking at is a very popular Invisable object script.

I was wonder if there is a way to tell this script to turn off when i say /1 Invisable off and a way to turn it back on when i say /1 invsable on

//from Chris Knox
refresh()
{
llSetTexture("38b86f85-2575-52a9-a531-23108d8da837", ALL_SIDES);
llOffsetTexture(0.468, 0, ALL_SIDES);
llScaleTexture(0, 0, ALL_SIDES);
llSleep(30);
llSetTexture("e97cf410-8e61-7005-ec06-629eba4cd1fb", ALL_SIDES);
llOffsetTexture(0.468, 0, ALL_SIDES);
llScaleTexture(0, 0, ALL_SIDES);
}

default
{
state_entry()
{
refresh();
llSetTimerEvent(5);
}

timer()
{
if ((integer)llGetWallclock() % 60 < 10)
{
refresh();
}
}
}

AND if someone whould tell me how to cylce glow effects that whould be great too
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
09-23-2008 19:50
Since you're new in the business, here is an URL you'll find interesting:

http://wiki.secondlife.com/wiki/LSL_Portal

In there you will find that llSetLinkColor() supports a special constant to change all the prims of an object: LINK_SET.

llSetLinkColor(LINK_SET, <1.0, 0.0, 0.0>, ALL_SIDES);

And a piece of advice, unless you want it otherwise, make your objects listen and talk only to you.

default
{
state_entry()
{
llListen(1, "", llGetOwner(), "";);
llOwnerSay("Say /1 red";);
}

listen(integer channel, string name, key id, string msg)
{
if (llToLower(msg) == "red";)
{
llSetLinkColor(LINK_SET, <1.0, 0.0, 0.0>, ALL_SIDES);
}
}
}

Second advice to everybody: Please drop that very very very old script. If you want to make an invisiprim:

default
{
state_entry()
{
llSetTexture("e97cf410-8e61-7005-ec06-629eba4cd1fb", ALL_SIDES);
llSleep(1.0);
llInventoryRemove(llGetScriptName()); // No timer, no script, just the texture!
}
}

And to switch it on and off, use llSetAlpha().

default
{
state_entry()
{
llSetLinkTexture(LINK_SET, "e97cf410-8e61-7005-ec06-629eba4cd1fb", ALL_SIDES);
llListen(1, "", llGetOwner(), "";);
llOwnerSay("Say /1 invisible ON (or) OFF";);
}

listen(integer channel, string name, key id, string msg)
{
list tempo = llParseString2List(llToLower(msg), [" "], []);
if (llList2String(tempo, 0) == "invisible";)
{
msg = llList2String(tempo, 1);
if (msg == "on";) { llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); }
else if (msg == "off";) { llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); }
}
}
}

Your homework for tomorrow will be to write the glow cycle script using llSetTimerEvent() and llSetPrimitiveParams([PRIM_GLOW, ...]).

:P
Yksrep Xue
Registered User
Join date: 23 Sep 2008
Posts: 4
Texture scripting help
09-23-2008 20:54
hay i got this script
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
// Note: You will need to copy both this script and a texture into your object


default
{

state_entry() {
llListen(1,"", NULL_KEY, "";);
}

listen(integer channel, string name, key id, string message) {
if (message == "angery";) {

// set the texture
llSetTexture("angery",ALL_SIDES);

}
}

}
ok so it dose what i want it to do. But is there anyway i can change the
Repeats per face
Rotation
and offset.

what i need is it set to is how i set up the last texture was that is

Repeats per face
Horzontal (U) 0.700
Vertical (V) 1.600

Rotation (degrees) 180.1

Offset
Horzontal (U) 0.000
Vertical (V) -0.050
Goldenstar Sands
Registered User
Join date: 23 May 2008
Posts: 18
09-23-2008 21:53
Aww thanks Kaluura Boa that color thing did the trick, However... the Invisable thing didnt work out... I was aiming to beable to use the inviable prim to make body parts dissapeer and reapeer, not just play with alpha...

Ohh~ and i'll play with the glow thing \o/

scripting is hard @.@ but fun :)
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
09-23-2008 22:42
@Ykserp: Check llSetPrimitiveParams([PRIM_TEXTURE, ...]) on the wiki.

http://wiki.secondlife.com/wiki/LlSetPrimitiveParams

Eventually...

http://wiki.secondlife.com/wiki/LlSetLinkPrimitiveParams

llSetPrimitiveParams() give you access to all the parameters of the texture.
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
09-23-2008 22:48
@Goldenstar: Hmmm... Did you test the script in-world? Do it and you'll see that it does what you want.

The explanations: When you add just a little bit of transparency to the texture of an invisiprim, the texture just behaves like a normal one and become (partially) visible. So with no transparency you have an invisiprim that hides the avatar... And with full transparency, you have an invisible prim that hides... nothing.
Goldenstar Sands
Registered User
Join date: 23 May 2008
Posts: 18
09-24-2008 02:16
From: Kaluura Boa
@Goldenstar: Hmmm... Did you test the script in-world? Do it and you'll see that it does what you want.

The explanations: When you add just a little bit of transparency to the texture of an invisiprim, the texture just behaves like a normal one and become (partially) visible. So with no transparency you have an invisiprim that hides the avatar... And with full transparency, you have an invisible prim that hides... nothing.



Ohh doh! I see it now haha

Just have i think one more think left to deal with...

Two scripts in one prim... but they wont work...

default
{
state_entry()
{
llListen(1,"","","red";);
llListen(1,"","","white";);
llSay(0, "Say /1 red or white";);
llSetLinkColor(LINK_SET, <1,1,1>,ALL_SIDES);
}

listen(integer channel, string name, key id, string message)
{
if (message == "red";)
llSetLinkColor(LINK_SET, <1,0,0>, ALL_SIDES);

if (message == "white";)
llSetLinkColor(LINK_SET, <1,1,1>, ALL_SIDES);

}

}
However when I set it up with a menu like this, it doesnt work:

list Choices = ["Red","White"];

default
{
touch_start(integer x)
{
if (llDetectedOwner(0) == llGetOwner())
llDialog(llDetectedKey(0),"Pick a Color",Choices,1);
llListen(1,"","","";);
}

listen(integer channel, string name, key id, string message)
{
if (message == "Red";)
{
llWhisper(1, "red";);
}
else if (message == "White";)
{
llWhisper(1, "white";);
}
}
}


I understand there is somekind of block keeping a object from talking to it's self, BUT somehow i'v seen objects do it... I could easly make it where if i menu it whould just to the updates, but this whouldnt be such a good idea for the longer tiggers i want to put in... so my question.. is how to i get my object to talk to it's self?
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
09-24-2008 03:10
From: Goldenstar Sands
how to i get my object to talk to it's self?
http://wiki.secondlife.com/wiki/LlMessageLinked instead of llWhisper() and http://wiki.secondlife.com/wiki/Link_message instead of listen().

(Although, in this example, there's no need for two scripts. The one that's handling the dialog could just do the color changing itself, instead of telling another script to do it. As I see you've noted... but I don't know what the "long tiggers" means.)
Goldenstar Sands
Registered User
Join date: 23 May 2008
Posts: 18
09-24-2008 04:10
well as i said i'm still new to scripting, but not to the conspect of it.

my main reason for wanting my prim to talk to it's self is it will be talking to a few of the child prims... and I looked on wiki.. and I just dont get how it works..

Simpley replacing the two just gives me errors.

basicaly I have a script that when you say /1 red it turns the prim red.

what i want to do is stick a another script in it for a blue menu, so when you click the button it says /1 red and turns the prim red for me.. However.. i cant figure out how to get the two to talk.

till then I'll keep exporing trying to find expamles, so far i'm comming empty handed in finding an exsample that does what i'm trying for...

maybe it's some simple ("";) >< /pi - thing i'm overlooking x)