Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string notecard = "Access List"; //name of notecard to read
- integer counter;
- key query;
- list has_access;
- default {
- state_entry() {
- if (llGetInventoryType(notecard) != INVENTORY_NOTECARD) {
- llOwnerSay("Please put a notecard in me");
- return;
- }
- else {
- llOwnerSay("Please wait a moment while I read the card");
- query = llGetNotecardLine(notecard, counter); //ask for first line of notecard
- }
- }
- dataserver(key queryid, string data) {
- if (queryid == query) { //check it's a reply to this request, since there may be other dataserver things going on in the same object
- if (data != EOF) { //if it's not saying "nothing more to read"
- data = llStringTrim(data, STRING_TRIM); //chop off any leading and trailing spaces, which tend to cause problems
- if (data != "" && llGetSubString(data, 0, 1) != "//") { //if it's not an empty line and if it's not commented out in the notecard
- has_access +=[data]; //add the name to the list
- //nb -- and very important ... the data is a string, so if you are reading -- eg -- a list of colours, you have to say colour_list += (vector) data; or it won't work
- }
- counter++; //advance the counter
- query = llGetNotecardLine(notecard, counter); //ask for next line of notecard
- }
- }
- else {
- llOwnerSay("Finished reading the card now");
- }
- }
- touch_start(integer n) {
- key av = llDetectedKey(0);
- string name = llDetectedName(0);
- if (~llListFindList(has_access,[name])) { // is the name on the list? If so
- llInstantMessage(av, "You are on the access list, and so are the following people:");
- integer i;
- integer max = llGetListLength(has_access);
- for (i = 0; i < max; ++i) {
- llInstantMessage(av, llList2String(has_access, i));
- }
- }
- else { // it's not on the list
- llInstantMessage(av, "Sorry, but you aren't on the access list");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement