Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

NEED HELP: Texture script

Shayna Korobase
Registered User
Join date: 8 May 2007
Posts: 454
10-19-2008 13:52
I have a texture scrip here that works oncommands. I'd like to be able to change between two textures each usng its own command. I'm not much of a scriptor so I ask for assistance :-) Thanks


default
{

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

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

// set the texture
llSetTexture("full t",ALL_SIDES);

}
}

}
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
10-19-2008 15:11
I think you are on the right track. Just keep adding else if statements for the other commands. Like this:

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

// set the texture
llSetTexture("full t",ALL_SIDES);

}
else if (message == "command 2";)
{
llSetTexture ("texture 2",ALL_SIDES);
}
else if .......
}
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
10-20-2008 01:14
Or use the texture names as commands.

If texture name is draw say /777 draw,
and/or if texture name is tulip say /777 tulip

CODE


listen(integer channel, string name, key id, string message)
{
if (llGetInventoryType(message) == 0) llSetTexture (message, ALL_SIDES);
else llSay(0,message + " is not a texture in my inventory!");
}

Shayna Korobase
Registered User
Join date: 8 May 2007
Posts: 454
10-20-2008 11:18
Thank you VERY much!
Treat Rothschild
Registered User
Join date: 27 Apr 2006
Posts: 20
10-20-2008 18:08
From: Ron Khondji
Or use the texture names as commands.

If texture name is draw say /777 draw,
and/or if texture name is tulip say /777 tulip

CODE


listen(integer channel, string name, key id, string message)
{
if (llGetInventoryType(message) == 0) llSetTexture (message, ALL_SIDES);
else llSay(0,message + " is not a texture in my inventory!");
}

This one here is more efficient than the else if statements. Just my 2 cents worth.

Treat
TenshiSan Xue
Registered User
Join date: 28 Oct 2008
Posts: 1
im in the same situation
10-28-2008 03:56
im really new to scripting as well, i only have messed with some. i kinda build this one from scratch and used some of the advice in the previous post. but im still getting syntax errors what am i doing wrong?

default
{
state_entry()
{
key owner = llGetOwner();
llWhisper(0,"Cloaking ready";);
llListen(0,"",owner,"";);
}

listen( integer channel, string name, key id, string message )
{
if(llGetInventoryType(cloak) == 0)
{
llSetStatus(STATUS_PHANTOM, FALSE);
llWhisper(0,"Cloaking";);
llSetTexture (cloak, ALL_SIDES);
else llSay(0,message + " is not a texture in my inventory!";);
}
if(llGetInventoryType(uncloak) == 0)
{
llSetStatus(STATUS_PHANTOM, TRUE);
llWhisper(0,"Uncloaking";);
llSetTexture (uncloak, ALL_SIDES);
else llSay(0,message + " is not a texture in my inventory!";);
}
}
}


thanks for the help in advance


i went back and tried it with the else if approach that worked out
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
10-28-2008 04:07
Your closing braces for your if-blocks are in the wrong place. Move the brace that follows your else up above the else. You can put braces around the else-block, too, but you need to close the if-block.

Also, perhaps you cut some out, but cloak and uncloak are undefined.
_____________________
The Vengeance Studio Gadget Store is closed!