Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple Drop Texture Display

Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
10-19-2004 22:48
CODE
integer gTimeout        = 1800;
key gDefaultKey = "";
//insert ur uuid for your defualt texture between ""


Texture( key id, string name )
{
llSetTexture( id, ALL_SIDES );
llSetTimerEvent( gTimeout );
llSay( 0, "New Picture: "+ name );
llSetText( name+"\n\n\n\n", <1,1,1>, 1 );
}



default
{
state_entry()
{
llAllowInventoryDrop( TRUE );
Texture( gDefaultKey, "" );
}


changed( integer change )
{
if ( ( change & CHANGED_ALLOWED_DROP ) || ( change & CHANGED_INVENTORY ) )
{
string inv_name = llGetInventoryName( INVENTORY_TEXTURE, llGetInventoryNumber( INVENTORY_TEXTURE ) - 1 );
key id = llGetInventoryKey( inv_name );

if ( id != NULL_KEY )
{
string name = inv_name;
while ( name != "" )
{
llRemoveInventory( name );
name = llGetInventoryName( INVENTORY_TEXTURE, 0 );
};
Texture( id, inv_name );
}
}
}


timer()
{
Texture( gDefaultKey, "" );
llSetTimerEvent( 0 );
}
}
Dan Medici
Registered User
Join date: 25 Jan 2004
Posts: 132
11-22-2004 07:06
Just a thought, couldn't you replace the line:
CODE
string inv_name = llGetInventoryName( INVENTORY_TEXTURE, llGetInventoryNumber( INVENTORY_TEXTURE ) - 1 );


With:

CODE

string inv_name = llGetInventoryName( INVENTORY_TEXTURE, llGetInventoryNumber(0));


Since you only have one texture in the object's inventory at any given point in time?