Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help on setting a texture script please

Elfeux Yeuxdoux
Registered User
Join date: 13 Oct 2006
Posts: 4
10-13-2006 10:15
Hi all,

I am writing a script to change the texture on a object based on a llListen command and then have that object shout across the room so that all the objects in the room will be changed as well. However, right now as soon as I enter the line "llListen( 1,"","", "" ) ;"
what happenes is that all the objects just keep changing back and forth between the two textures.
Bellow is the script that I am using so far.

Thanks for your help,
Elfeux

default
{
state_entry()
{
llListen( 0,"",llGetOwner(), "" ) ;
llListen( 1,"","", "" ) ;

}

listen( integer channel,string name,key id,string mes )
{
if( mes == "Privecy please" )
{
llSetTexture( "alhambra Arch Full", ALL_SIDES ) ;
llShout( 1, "Privecy please" ) ;
}
if( mes=="Can I see please" )
{
llSetTexture( "Alhambra Arch 1", ALL_SIDES ) ;
llShout( 1, "Can I see please"" ) ;
}
}
}
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
10-13-2006 10:40
Well, that certainly would generate an infinite loop, though why it's switching back and fourth I'm less sure.

To avoid looping crosstalk, the "main" prim would have a script like:

CODE
default
{
state_entry()
{
llListen( 0,"",llGetOwner(), "" ) ;
}

listen( integer channel,string name,key id,string mes )
{
if( mes == "Privacy please" )
{
llSetTexture( "alhambra Arch Full", ALL_SIDES );
llShout( 1, "Privacy please" ) ;
}
else if( mes == "Can I see please" )
{
llSetTexture( "Alhambra Arch 1", ALL_SIDES );
llShout( 1, "Can I see please" ) ;
}
}
}
and all the others:
CODE
default
{
state_entry()
{
llListen( 1,"",NULL_KEY, "" ) ;
}

listen( integer channel,string name,key id,string mes )
{
if( mes == "Privacy please" && llGetOwnerKey(id) == llGetOwner() )
{
llSetTexture( "alhambra Arch Full", ALL_SIDES );
}
else if( mes == "Can I see please" && llGetOwnerKey(id) == llGetOwner() )
{
llSetTexture( "Alhambra Arch 1", ALL_SIDES );
}
}
}
_____________________
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
10-14-2006 10:37
Minor change,

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

listen( integer channel,string name,key id,string mes )
{
if( llGetOwnerKey(id) == llGetOwner() )
{
if("Privacy please" == mes)
{
llSetTexture( "alhambra Arch Full", ALL_SIDES );
}
else if("Can I see please" == mes)
{
llSetTexture( "Alhambra Arch 1", ALL_SIDES );
}
}
}
}