Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looping through Scripts in an Object

Edgar Ellison
Registered User
Join date: 18 Sep 2006
Posts: 13
10-23-2006 17:49
I would like to select all the scripts in an object, one at a time, by name.

For instance, how would I write a script that would llSay the names of each script in the object in turn?
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
10-23-2006 18:12
From: Edgar Ellison
... how would I write a script that would llSay the names of each script in the object in turn?


CODE
default {
state_entry() {
integer x;
integer total = llGetInventoryNumber(INVENTORY_SCRIPT);
for (x = 0; x < total; x++) llOwnerSay(llGetInventoryName(INVENTORY_SCRIPT, x));
}
}


I think that'll work.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
10-23-2006 18:45
same thing with a while loop instead of a for loop

CODE

default
{
touch_start(integer total_number)
{
integer total = llGetInventoryNumber(INVENTORY_SCRIPT);
integer x;
while (x < total)
{
llOwnerSay(llGetInventoryName(INVENTORY_SCRIPT,x) );
++x;
}
}
}