/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// string wasKeyValueSet(string k, string v, string data) { if(llStringLength(k) == 0) return ""; if(llStringLength(v) == 0) return ""; if(llStringLength(data) == 0) return k + "=" + v; integer i = llListFindList( llList2ListStrided( llParseString2List(data, ["&", "="], []), 0, -1, 2 ), [ k ]); if(i != -1) return llDumpList2String( llListReplaceList( llParseString2List(data, ["&"], []), [ k + "=" + v ], i, i), "&"); return data + "&" + k + "=" + v; } string DIALOG_PREAMBLE = "\n Welcome to the Javelin Range.\nCreated in 2014 by Wizardry and Steamworks\n 28 July 2014: Version: 1.0"; resetScripts() { integer i = llGetInventoryNumber(INVENTORY_SCRIPT)-1; do { string name = llGetInventoryName(INVENTORY_SCRIPT, i); if(name == llGetScriptName()) jump continue; llResetOtherScript(name); @continue; } while(--i>-1); } default { touch_start(integer total_number) { key agent = llDetectedKey(0); integer channel = (integer)("0x8" + llGetSubString(llGetKey(), 0, 6)); llListen(channel, "", agent, ""); if(agent == llGetOwner()) { llDialog(agent, DIALOG_PREAMBLE, ["⎌ Reset", "▽ Range", "⌕ Size", "⎚ Texture", "⌒ Item"], channel); return; } llDialog(agent, DIALOG_PREAMBLE, ["⌒ Item"], channel); } listen(integer channel, string name, key agent, string message) { if(message == "⌒ Item") { string item = llGetInventoryName(INVENTORY_OBJECT, 0); if(item == "") { llInstantMessage(agent, "An item is missing from the bullseye's inventory."); return; } llGiveInventory(agent, item); item = llGetInventoryName(INVENTORY_NOTECARD, 0); if(item == "") { llInstantMessage(agent, "An item is missing from the bullseye's inventory."); return; } llGiveInventory(agent, item); return; } if(message == "⎌ Reset") { llSetLinkPrimitiveParamsFast(2, [PRIM_DESC, ""]); llMessageLinked(LINK_SET, 0, "", (string)<1, 1, 1>); resetScripts(); return; } if(message == "▽ Range") { llDialog(agent, DIALOG_PREAMBLE, ["4m", "8m", "16m", "32m", "64m" ], channel); return; } if(message == "⌕ Size") { llDialog(agent, DIALOG_PREAMBLE, ["Normal", "Double"], channel); return; } if(message == "Normal") { llSetScale(<1, 1, .1>); return; } if(message == "Double") { llSetScale(<2, 2, .1>); return; } if(message == "⎚ Texture") { llDialog(agent, DIALOG_PREAMBLE, ["Black", "Red"], channel); return; } if(message == "Black") { llSetTexture("e87876bc-1814-1911-c8cc-f9c5e7ed895b", 0); return; } if(message == "Red") { llSetTexture("550d8640-4734-6a4f-117f-df4118af660e", 0); return; } if(llSubStringIndex(message, "m") == -1) return; llSetLinkPrimitiveParamsFast(3, [PRIM_DESC, wasKeyValueSet("range", (string)((integer)message), llList2String(llGetLinkPrimitiveParams(3, [PRIM_DESC]), 0))]); } on_rez(integer num) { llResetScript(); } }