Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string ncName = "config";
- key ncKey;
- integer nLine;
- key queryNC;
- nextLine()
- {
- ++nLine;
- queryNC = llGetNotecardLine(ncName, nLine);
- }
- default
- {
- state_entry()
- {
- ncKey = llGetInventoryKey(ncName);
- nLine = 0;
- queryNC = llGetNotecardLine(ncName, nLine);
- }
- link_message(integer sender, integer num, string msg, key id)
- {
- if(msg == "Reset_Notecard")
- {
- llResetScript();
- }
- }
- dataserver(key query, string data)
- {
- if(query == queryNC)
- {
- if(nLine == 0)
- {
- llOwnerSay("Reading config notecard for settings. Please wait.");
- }
- if(data != EOF)
- {
- if(llSubStringIndex(data, "\\") != 0 && data !="")
- {
- list tmp = llParseString2List(data, ["="],[]);
- string cmd = llStringTrim(llToLower(llList2String(tmp,0)), STRING_TRIM);
- string ref = llStringTrim(llList2String(tmp,1), STRING_TRIM);
- if(cmd == "admin_id")
- {
- llMessageLinked(LINK_SET,0,"Add_To_Admins",(key)ref);
- nextLine();
- }
- else if(cmd == "access_id")
- {
- llMessageLinked(LINK_SET,0,"Add_To_Access",(key)ref);
- nextLine();
- }
- else
- {
- nextLine(); // unrecognized command
- }
- }
- else
- {
- nextLine(); // line is a comment or blank
- }
- }
- else // (data == EOF)
- {
- llMessageLinked(LINK_SET,0,"End_of_Notecard","");
- }
- }
- }
- changed(integer change)
- {
- if(change & CHANGED_INVENTORY)
- {
- if(llGetInventoryKey(ncName) != ncKey)
- {
- llResetScript();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment