by Jessica Margetts
// Here is a menu based texture changing script, that has no limits on the number of pages textures it can support.
// PLEASE remember that textures MUST HAVE full permissions in order to be used with it.
integer INVENTORY_TYPE = INVENTORY_TEXTURE;
integer PAGES;
integer PAGE = 1;
integer COM_CHAN = -278976;
integer LISTENER;
integer NEEDED_PERMS;
list THIS_PAGE;
list LIST_NAV_X = ;
list LIST_NAV_A = ;
list LIST_NAV_B = ;
list LIST_NAV_C = ;
string PAGE_NAV_NULL = " ";
string PAGE_NAV_NEXT = "NEXT";
string PAGE_NAV_BACK = "BACK";
string PAGE_NAV_HOME = "HOME";
integer ptTestPerms(string item, integer needed)
{
integer perm = llGetInventoryPermMask(item, MASK_OWNER);
if ((perm & needed) == needed) { return(TRUE); }
return(FALSE);
}
ptDisplayPage(key theUser) {
integer TEXTURES = llGetInventoryNumber(INVENTORY_TYPE);
integer I;
integer START;
integer STOP;
string INTRO = "Page " + (string) PAGE + " of " + (string) PAGES;
string NEW_LINE;
string ITEM_NAME;
string T;
list MENU;
if (TEXTURES >= 1) {
PAGES = 1 + (llFloor((float) TEXTURES / 9.0));
INTRO = "Page " + (string) PAGE + " of " + (string) PAGES;
if (TEXTURES <= 9) {
MENU = [] + LIST_NAV_X;
for (I = 0; I < TEXTURES; ++I)
{
T = (string) (I + 1);
ITEM_NAME = llGetInventoryName(INVENTORY_TYPE, I);
if (ptTestPerms(ITEM_NAME, NEEDED_PERMS)) {
NEW_LINE = "\n" + T + "- " + ITEM_NAME;
INTRO = "" + INTRO + NEW_LINE;
MENU = [] + MENU + ;
} else {
NEW_LINE = "\n" + T + "- ~BLOCKED ~";
INTRO = "" + INTRO + NEW_LINE;
MENU = [] + MENU + ;
}
}
} else {
if ((PAGE == 1) || (PAGE > PAGES)) {
PAGE = 1;
MENU = [] + LIST_NAV_A;
} else if ((PAGE == PAGES) || (PAGE ><1)) {
MENU = [] + LIST_NAV_C;
} else {
MENU = [] + LIST_NAV_B;
}
START = ((PAGE - 1) * 9);
STOP = (PAGE * 9);
if (STOP > TEXTURES) { STOP = TEXTURES - 1; }
INTRO = "Page " + (string) PAGE + " of " + (string) PAGES;
for (I = START; I >