Jump to content

Zopf

Resident
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Zopf

  1. i modified that script a bit... but i'm still not satisfied //modified by Ray Zopf (Raz): notecard//17. Sept 2013 v0.7//todo: change notecard format from line each value to single line for group (place + group)//list settings=[// "sim 1", "group 1",// "sim 2", "group 2"// ];string SETTINGS_NC = "PlaceGroupNC";integer setChannel = 11;//string unlockedgroup="default group";string unlockedgroup="none";//friends//string scanner_target_avatar = "MyBestFriend Resident";//string group_on_scanner = "His Favourite Group";//internal variables//integer scanInterval = 256;//integer scanRange = 20;string NOGROUP="none";list PlaceGroupList = [ ]; integer comHandle = 0;integer comChannel = 0;key aQuery = NULL_KEY;integer msgchan=614523;integer locked=0;integer groupwait=0;//PREDEFINED FUNCTIONS//where is that used?//restoregroup() {// llOwnerSay("@setgroup=y,setgroup:"+NOGROUP+"=force");//}setgroup(string g) { setlock(1); llOwnerSay("@setgroup=y,setgroup:"+g+"=force");}cleargroup() { setlock(0); llOwnerSay("@setgroup=y,setgroup:"+unlockedgroup+"=force"); llOwnerSay("You are free to change your group now. (use '\\"+(string)setChannel+ " lockgroup' to lock-in the group for this sim)");}//where is that used?//unlockgroup() {// setlock(2);// llOwnerSay("@setgroup=y");//}setlock(integer i) { if (locked==i) return; if (i==1) { groupwait=1; llOwnerSay("@getgroup="+(string)msgchan); } locked=i;}update() { string region = llGetRegionName(); integer i = llListFindList(PlaceGroupList, (list)region); if (i > -1) { string group = llList2String(PlaceGroupList, i+1); setgroup(group); llOwnerSay("setting group '" + group + "' for region " + region); return; } if (locked) cleargroup();}slist() { string str="list settings=[\n"; integer i; integer lenght = llGetListLength(PlaceGroupList); for (i=0; i<lenght; i+=2) { str+=llList2String(PlaceGroupList, i)+" , "+llList2String(PlaceGroupList, i+1)+"\n"; } str+="];"; llOwnerSay("------ Region, Group ------"); llOwnerSay(str);}//MAINdefault{ state_entry() { aQuery = llGetNotecardLine(SETTINGS_NC,comHandle); llListen(msgchan, "", llGetOwner(), ""); llListen(setChannel, "", llGetOwner(), ""); llOwnerSay("###### Automatic Group Changer started ######"); // llSensorRepeat("", NULL_KEY, AGENT, scanRange, PI, scanInterval); } on_rez(integer i) { update(); } changed(integer change) { if (change & CHANGED_INVENTORY) { llOwnerSay("old settings:"); slist(); PlaceGroupList = []; comHandle = 0; aQuery = llGetNotecardLine(SETTINGS_NC,comHandle); llOwnerSay("Rereading settings-notecard "+(string)SETTINGS_NC+":"); } if (change & CHANGED_REGION) update(); if (change & CHANGED_OWNER) llResetScript(); } listen(integer channel, string name, key sender, string msg) { if (channel==setChannel) { if (msg=="help") { llOwnerSay("help; lockgroup, list, unlockgroup, setdefault 'group'"); jump zout; } if (msg=="lockgroup" && !locked) { locked=1; groupwait=2; llOwnerSay("Group fixed for "+llGetRegionName()+"!"); llOwnerSay("@getgroup="+(string)msgchan); } if (msg=="list") { slist(); jump zout; } if (msg == "unlockgroup") { cleargroup(); jump zout; } if (llSubStringIndex(msg, "setdefault") >= 0) { unlockedgroup = llGetSubString(msg, llSubStringIndex(msg, " ")+1, llStringLength(msg)-1); cleargroup(); update(); llOwnerSay("Defaultgroup set to: "+unlockedgroup); jump zout; } } else if (groupwait) { if (groupwait==2) PlaceGroupList+=[llGetRegionName(), msg]; groupwait=0; } @zout; }// sensor(integer num) {// integer i = -1;// while (num > ++i) {//friends// if (llToLower(llDetectedName(i)) == llToLower(scanner_target_avatar)) {// setgroup(group_on_scanner);// return;// }// }// } //get presets from notecard dataserver(key query_id,string data) { if (query_id != aQuery) return; if (data == EOF) { slist(); update(); return; } PlaceGroupList += (list)data; aQuery = llGetNotecardLine(SETTINGS_NC,++comHandle); }}
×
×
  • Create New...