Hi, I been working on trying to create a simple texture change script with a whitelist but for some reason no matter how hard I try I cannot get it to work just right. The whitelist isnt picking up or something. Here is what I have been working with: // Generic Whitelist Script -- Rolig Loon -- March 2011
// Put login names (NOT Display names) of avatars to be whitelisted in a notecard, one per line
// Spelling and capitalization count
list gWhiteList = [];
string gCard;
integer gLine;
key gQuery;
list gWho = ["Me Only","Group","List","Group+List","Everyone"];
integer gAccess;
integer gDChnl;
default // Read Whitelist from notecard, one name per line
{
state_entry()
{
if(llGetInventoryNumber(INVENTORY_NOTECARD) == 1)
{
gCard = llGetInventoryName(INVENTORY_NOTECARD,0);
gQuery = llGetNotecardLine(gCard, 0);
}
else
{
llOwnerSay("The whitelist notecard is missing.");
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
llResetScript();
}
}
dataserver(key QID, string data)
{
if(gQuery == QID)
{
if (data != EOF)
{
gWhiteList += [llStringTrim(data,STRING_TRIM)];
gQuery = llGetNotecardLine(gCard, ++gLine);
}
else
{
llOwnerSay("Initialized");
state running;
}
}
}
}
state running
{
state_entry()
{
gDChnl = (integer) ("0xF" + llGetSubString(llGetOwner(),0,6));
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
llResetScript();
}
}
touch_start(integer total_number)
{
llResetTime();
integer idx = llListFindList(gWhiteList,[llDetectedName(0)]);
if (llDetectedKey(0) != llGetOwner())
{
if ((gAccess == 4) ||
((gAccess == 3) && (~idx || llSameGroup(llDetectedKey(0)))) ||
((gAccess == 2) && (~idx)) ||
((gAccess == 1) && (llSameGroup(llDetectedKey(0)))))
{
llSay(0,"Access granted.");
state OK;
}
else
{
llSay(0,"Access denied.");
}
}
}
touch_end(integer num) //Mouse button released
{
if(llDetectedKey(0) == llGetOwner())
{
if (llGetTime() < 3.0 ) //Less than 3 seconds after mouse button down
{
llSay(0,"Access granted.");
state OK;
}
else if (llGetTime() >= 3.0 ) // Owner set access permissions
{
llListen(gDChnl,"","","");
llDialog(llGetOwner(),"Who should have access?",gWho,gDChnl);
}
}
}
listen(integer channel, string name, key id, string msg)
{
gAccess = llListFindList(gWho,[msg]);
string temp;
if (gAccess == 0)
{
temp = "you only.";
}
else if (gAccess == 1)
{
temp = "group members only.";
}
else if (gAccess == 2)
{
temp = " \n" + llDumpList2String(gWhiteList," \n");
}
else if (gAccess == 3)
{
temp = "this group and " + " \n" +llDumpList2String(gWhiteList, " \n");
}
else
{
temp = "everyone.";
}
llOwnerSay("Access has been granted to " + temp);
}
}
state OK
{
state_entry()
{
llSetTimerEvent(10.0);
llSay(0,"You're in!");
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
llResetScript();
}
}
touch_start(integer total_number)
{
integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
float rand = llFrand(number);
integer choice = (integer)rand;
string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (name != "")
llSetTexture(name, ALL_SIDES);
}
}
Thanks for any input and please be aware, Im extremely new to this and have been stumbling through it so ... yea