/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// integer Key2Number(key objKey) { return ((integer)("0x"+llGetSubString((string)objKey,-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF; } /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// integer wasMenuIndex = 0; list wasDialogMenu(list input, list actions, string direction) { integer cut = 11-wasListCountExclude(actions, [""]); if(direction == ">" && (wasMenuIndex+1)*cut+wasMenuIndex+1 < llGetListLength(input)) { ++wasMenuIndex; jump slice; } if(direction == "<" && wasMenuIndex-1 >= 0) { --wasMenuIndex; jump slice; } @slice; integer multiple = wasMenuIndex*cut; input = llList2List(input, multiple+wasMenuIndex, multiple+cut+wasMenuIndex); input = wasListMerge(input, actions, ""); return input; } /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// integer wasListCountExclude(list input, list exclude) { if(llGetListLength(input) == 0) return 0; if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); } /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// list wasListMerge(list l, list m, string merge) { if(llGetListLength(l) == 0 && llGetListLength(m) == 0) return []; string a = llList2String(m, 0); if(a != merge) return [ a ] + wasListMerge(l, llDeleteSubList(m, 0, 0), merge); return [ llList2String(l, 0) ] + wasListMerge(llDeleteSubList(l, 0, 0), llDeleteSubList(m, 0, 0), merge); } list tgtKeys = []; list tgtNames = []; list menu_items = []; integer comHandle = 0; default { touch_start(integer total_number) { if(llDetectedKey(0) != llGetOwner()) return; llSensor("", "", AGENT, 96, TWO_PI); } sensor(integer num) { --num; menu_items = []; do { tgtKeys += llDetectedKey(num); tgtNames += llGetSubString(llDetectedName(num), 0, 23); menu_items += llGetSubString(llDetectedName(num), 0, 23); } while(--num>-1); integer comChannel = (integer)("0x8" + llGetSubString(llGetOwner(), 0, 6)); comHandle = llListen(comChannel, "", llGetOwner(), ""); llDialog(llGetOwner(), "\nSelect target:\n", wasDialogMenu(menu_items, ["<= Back", "", "Next =>"], ""), comChannel); } listen(integer channel, string name, key id, string message) { if(message == "<= Back") { llSetTimerEvent(60); llDialog(id, "Please select an avatar to shoot from the list below:\n", wasDialogMenu(menu_items, ["<= Back", "", "Next =>"], "<"), channel); return; } if(message == "Next =>") { llSetTimerEvent(60); llDialog(id, "Please select an avatar to shoot from the list below:\n", wasDialogMenu(menu_items, ["<= Back", "", "Next =>"], ">"), channel); return; } llListenRemove(comHandle); llRezObject("*", llGetPos() + <0,0,3>, ZERO_VECTOR, ZERO_ROTATION, Key2Number(llList2Key(tgtKeys, llListFindList(tgtNames, (list)llGetSubString(message,0,23))))); } on_rez(integer num) { llResetScript(); } }