|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-04-2007 03:07
One more quickie - I hope  I have a script that is a picture giver (just the same as a NoteCard giver) the prim in which the script sits contains three pics - two have known names (eg. online_pic, offline_pic) the third can be called anything. How do I get the script to forget the two pics with known names and give only the unknown named pic?
|
|
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
|
10-04-2007 03:23
From: Tarak Voss One more quickie - I hope  I have a script that is a picture giver (just the same as a NoteCard giver) the prim in which the script sits contains three pics - two have known names (eg. online_pic, offline_pic) the third can be called anything. How do I get the script to forget the two pics with known names and give only the unknown named pic? list known_textures = ["texture1", "texture2"];
integer num_textures = llGetInventoryNumber (INVENTORY_TEXTURE); integer i; string texture_name; for (i=0; i < num_textures; i++) { texture_name = llGetInventoryName (INVENTORY_TEXTURE, i); if (llFindListFind (known_textures, texture_name) == -1) { // The texture wasn't in our list of known textures, so give it MyGiveFunction... } }
That should do it - use your existing code to give the inventory under the comment. It will actually give all of the textures in the prim that aren't listed in known_textures - so it's not restricted to 2 known and 1 unknown.
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-04-2007 04:05
thanks again
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-05-2007 06:57
I tried this but it doesn't seem to work: list known_textures = ["online", "offline"]; integer num_textures = 0; string texture_name;
integer i; num_textures = llGetInventoryNumber (INVENTORY_TEXTURE); for (i=0; i < num_textures; i++) { texture_name = (string)llGetInventoryName (INVENTORY_TEXTURE, i); if (llListFindList (known_textures, [texture_name]) == -1) { // The texture wasn't in our list of known textures, so give it llGiveInventory(whotocheck,llGetInventoryName(INVENTORY_TEXTURE, i));
} }
|
|
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
|
10-05-2007 07:05
From: Tarak Voss I tried this but it doesn't seem to work: list known_textures = ["online", "offline"]; integer num_textures = 0; string texture_name;
integer i; num_textures = llGetInventoryNumber (INVENTORY_TEXTURE); for (i=0; i < num_textures; i++) { texture_name = (string)llGetInventoryName (INVENTORY_TEXTURE, i); if (llListFindList (known_textures, [texture_name]) == -1) { // The texture wasn't in our list of known textures, so give it llGiveInventory(whotocheck,llGetInventoryName(INVENTORY_TEXTURE, i));
} }
What happens when you try it? Does it give textures it's not supposed to, or does it not give the ones it should?
|
|
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
|
10-05-2007 18:12
From: Tarak Voss I tried this but it doesn't seem to work: list known_textures = ["online", "offline"]; integer num_textures = 0; string texture_name;
integer i; num_textures = llGetInventoryNumber (INVENTORY_TEXTURE); for (i=0; i < num_textures; i++) { texture_name = (string)llGetInventoryName (INVENTORY_TEXTURE, i); if (llListFindList (known_textures, [texture_name]) == -1) { // The texture wasn't in our list of known textures, so give it llGiveInventory(whotocheck,llGetInventoryName(INVENTORY_TEXTURE, i));
} }
I've just tested it with 3 textures, online, offline and another one and it worked fine for me - I only got the other one. It works with a couple of unknown ones too.
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-07-2007 05:42
Sorry for the delay - yes it worked for me the second time ?? - I must have changed something - thanks.
|