Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script can't find Texture although it's in Object's inventory

Nilp Morris
Registered User
Join date: 7 Jan 2006
Posts: 13
11-24-2006 10:16
Hi
I was making a script that changes the texture of a object and stuff and it just won't work. Could someone please tell me why?

CODE

string let0 = "letter_0";



default
{
state_entry()
{
llListen( 9,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string m)
{
if (m=="texture-0-001")
{
llSetTexture(let0, ALL_SIDES);
}
}

}


When triggered it always says that it can't find the Texture but it's in the Object's inventory!
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
11-24-2006 11:26
Are the textures in the Root Prim, and the script in a Child Prim... in which case you might be interested in this earlier thread.

/54/6e/150451/1.html

:)
Nilp Morris
Registered User
Join date: 7 Jan 2006
Posts: 13
11-24-2006 11:53
From: Pale Spectre
Are the textures in the Root Prim, and the script in a Child Prim... in which case you might be interested in this earlier thread.

/54/6e/150451/1.html

:)

No, it is a one prim thing. Nothing more and stuff!
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-24-2006 13:12
Check for case sensitivity?
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
11-24-2006 13:20
When in doubt I get really testy. and test things like:

CODE
default {
state_entry() {
integer i;
integer n = llGetInventoryNumber( INVENTORY_TEXTURE );
for (i=0; i<n; i++ ) {
string name = llGetInventoryName( INVENTORY_TEXTURE, i)
if ( name == "letter_0" )
llOwnerSay( name + " MATCHES!");
else
llOwnerSay( name + " doesn't match.");
}
}
}



I'm assuming the name of the texture in your prim is letter_0... (that IS a letter, not a number right?)
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources.
Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas.
-
Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
Raeyan Aldrich
Registered User
Join date: 14 Oct 2006
Posts: 44
11-24-2006 17:15
this is un-tested, and simple... but it should work... when the state is entered the script builds a list of all the textures in it's inventory, then if you say the name of a texture it has, it changes to it... still uses channel 9 like before.

CODE

list availtexts = [];

default
{
state_entry()
{
availtexts = [];
integer i = 0;
string curtext;
while((curtext = llGetInventoryName( INVENTORY_TEXTURE, i)) != ""){
availtexts += [curtext];
i++;
}
llListen(9,"",NULL_KEY,"");
}
listen(integer channel, string name, key id, string m)
{
if (llListFindList(availtexts, [m]) != -1)
{
llSetTexture(m, ALL_SIDES);
}
}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
11-25-2006 23:54
I never manually type the actual inventory name into my sctipt. I go into the object inventory, right-click, choose 'Rename', then press CTRL-c to copy and then ESC to cancel renaming. Then paste into the script (CTRL-v or Edit -> Paste). That might help if the exact name is your problem.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-26-2006 10:12
I'd be inclined to use a script to check and see if the texture really is in the inventory.

CODE

string let0 = "letter_0";

integer Find(string name, integer requestedType)
{
integer type = llGetInventoryType(name);
if(type != requestedType) llOwnerSay("ERROR " + name + " is not the right type!");
return type ;
}

default
{
state_entry()
{
llListen( 9,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string m)
{
if (m=="texture-0-001")
{
integer type = Find(let0,INVENTORY_TEXTURE );
if(INVENTORY_TEXTURE == type) llSetTexture(let0, ALL_SIDES);
}
}
}
Primativo Sachertorte
Registered User
Join date: 18 Dec 2005
Posts: 1
Object: cannot find texture - none of the answers work for my issue
01-12-2007 10:52
The script below gives WEIRD results ... it properly displays the textures in the prim (one prim so no daughter issues) and then displays the can't find texture error ... I reduced the number of textures to two so I could accurately see that all the textures were displayed .. they were ... and then the error msg.

it seems to cycle once with no error, then the message appears.

I started with 13 textures with sequential names: image1, image2 ... image13 then wondered if there was a data type problem and so rename everything 1,2, ... 13

Same result.

Then I decreased the number of textures thinking there might be too many.

Same result.

any ideas??

============ script below ======


integer i;
default
{
state_entry ()
{
//change image every 5 secs
llSetTimerEvent (5.0);
}

timer ()
{

if (i<llGetInventoryNumber (INVENTORY_TEXTURE))
{
i++;

}
else
{
i = 0;
}
//set the texture on the "1" face of the object
llSetTexture (llGetInventoryName (INVENTORY_TEXTURE, i), 1);
}
}
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
01-12-2007 11:44
I think it's an index starts from 0 thing...

i needs to cycle from 0 to llGetInventoryNumber(INVENTORY_TEXTURE) - 1