/* button_display.lslp * * Part of the Sloodle project (www.sloodle.org) * * Copyright (c) 2011-06 contributors (see below) * Released under the GNU GPL v3 * ------------------------------------------- * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * All scripts must maintain this copyrite information, including the contributer information listed * * As mentioned, this script has been licensed under GPL 3.0 * Basically, that means, you are free to use the script, commercially etc, but if you include * it in your objects, you must make the source viewable to the person you are distributuing it to - * ie: it can not be closed source - GPL 3.0 means - you must make it open! * This is so that others can modify it and contribute back to the community. * The SLOODLE github can be found here: https://github.com/sloodle * * Enjoy! * * Contributors: * Paul Preibisch * * DESCRIPTION * The main purpose of this script is to power a button prim that sits on the edge of a hexagon quizzer's pie slice. A user can request that a * new hexagon be joined to this edge by clicking on the horizontal rod, or vertical rod * When the horizontal rod or vertical rod is touched, this script will send a linked message to the hexagon rezzer script telling * it who touched * it. It will also set the prims properties so that the orb reshapes itself small enough to be hidden (close) when needed. * */ integer SLOODLE_CHANNEL_ANIM= -1639277007; integer DELAY; integer my_num; key root_key; string my_state; float edge_length; float tip_to_edge; float sensor_range; integer SLOODLE_OBSTRUCTION=1639277021; integer OBSTRUCTED=FALSE; integer SLOODLE_CHANNEL_USER_TOUCH = -1639277002;//user touched object string SLOODLE_TRANSLATE_HOVER_TEXT_LINKED_PRIM= "hovertext_linked_prim"; // 3 output parameters: colour , alpha value, link number string SLOODLE_TRANSLATE_HOVER_TEXT = "hovertext"; // 2 output parameters: colour , and alpha value string SLOODLE_TRANSLATE_WHISPER = "whisper"; // 1 output parameter: chat channel number string SLOODLE_TRANSLATE_SAY = "say"; // 1 output parameter: chat channel number string SLOODLE_TRANSLATE_OWNER_SAY = "ownersay"; // No output parameters string SLOODLE_TRANSLATE_DIALOG = "dialog"; // Recipient avatar should be identified in link message keyval. At least 2 output parameters: first the channel number for the dialog, and then 1 to 12 button label strings. string SLOODLE_TRANSLATE_LOAD_URL = "loadurl"; // Recipient avatar should be identified in link message keyval. 1 output parameter giving URL to load. string SLOODLE_TRANSLATE_IM = "instantmessage"; // Recipient avatar should be identified in link message keyval. No output parameters. integer SLOODLE_CHANNEL_TRANSLATION_REQUEST = -1928374651; debug (string message ){ list params = llGetPrimitiveParams ([PRIM_MATERIAL ]); if (llList2Integer (params ,0)==PRIM_MATERIAL_FLESH){ llOwnerSay("memory: "+(string)llGetFreeMemory()+" Script name: "+llGetScriptName ()+": " +message ); } } // Send a translation request link message sloodle_translation_request(string output_method, list output_params, string string_name, list string_params, key keyval, string batch){ llMessageLinked(LINK_THIS, SLOODLE_CHANNEL_TRANSLATION_REQUEST, output_method + "|" + llList2CSV(output_params) + "|" + string_name + "|" + llList2CSV(string_params) + "|" + batch, keyval); } hide(integer orb){ my_state="hide"; debug("*******************************************************hiding"); if (myType=="orb"){ llSetPrimitiveParams([9,3,0,<0.730000, 0.750000, 0.0>,0.0,<0.0, 0.0, 0.0>,<0.0, 1.0, 0.0>]); }else if (myType=="rod_hor"){ llSetPrimitiveParams([9,4,0,<0.505000, 0.525000, 0.0>,0.0,<0.0, 0.0, 0.0>,<1.0, 0.500000, 0.0>,<0.0, 0.0, 0.0>,<0.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,1.0,0.0,0.0]); }else if (myType=="rod_ver"){ llSetPrimitiveParams([9,4,0,<0.505000, 0.525000, 0.0>,0.0,<0.0, 0.0, 0.0>,<1.0, 0.500000, 0.0>,<0.0, 0.0, 0.0>,<0.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,1.0,0.0,0.0]); } llSetText("", <0,0,0>, 1); } show(integer orb){ my_state="show"; debug("*******************************************************showing"); if (myType=="orb"){ llSetPrimitiveParams([9,3,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<0.0, 1.0, 0.0>]); }else if (myType=="rod_hor"){ llSetPrimitiveParams([9,4,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<1.0, 0.500000, 0.0>,<0.0, 0.0, 0.0>,<0.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,1.0,0.0,0.0]); }else if (myType=="rod_ver"){ llSetPrimitiveParams([9,4,0,<0.0, 1.0, 0.0>,0.0,<0.0, 0.0, 0.0>,<1.0, 0.500000, 0.0>,<0.0, 0.0, 0.0>,<0.0, 1.0, 0.0>,<0.0, 0.0, 0.0>,1.0,0.0,0.0]); } } /* Search through all linked prims, and returns the prims link number which matches the name */ integer get_prim(string name){ integer num_links=llGetNumberOfPrims(); integer i; integer prim=-1; for (i=0;i<=num_links;i++){ if (llGetLinkName(i)==name){ prim=i; }else{ } } return prim; } list myFamily; string myType; init(){ //determine the edge length integer pie_slice6 = get_prim("pie_slice6"); list pie_slice_data = llGetLinkPrimitiveParams(pie_slice6, [PRIM_SIZE] ); vector pie_slice_size=llList2Vector(pie_slice_data, 0); tip_to_edge = pie_slice_size.z+2;//since we are looking for the length starting from the tip of the pie_slice to the middle of the edge, we need to choose the z dimension for this particular pie slice edge_length= pie_slice_size.y;//since we are looking for the length of an edge we need to choose the y dimension for this particular pie slice sensor_range=tip_to_edge; myType = llGetSubString(llGetObjectName(), 0, -2); string name = llGetObjectName(); integer len = llGetNumberOfPrims(); integer k=0; for (k=0;k