2 // huffware script: button pusher, by fred huffhines
4 // a simple API for reporting when buttons are pushed.
6 // this script is licensed by the GPL v3 which is documented at: http://www.gnu.org/licenses/gpl.html
7 // do not use it in objects without fully realizing you are implicitly accepting that license.
10 // this is a kludgy thing, but this must be hard-coded to have the right button
11 // name for what the rest of the device is expecting. it should vary depending on
12 // the actual button prim that this script is placed in.
13 string BUTTON_NAME = "next";
15 // the button pushing API.
17 integer BUTTON_PUSHER_HUFFWARE_ID = 10035;
18 // a unique ID within the huffware system for this script.
19 string HUFFWARE_PARM_SEPARATOR = "{~~~}";
20 // this pattern is an uncommon thing to see in text, so we use it to separate
21 // our commands in link messages.
22 string HUFFWARE_ITEM_SEPARATOR = "{|||}";
23 // used to separate lists of items from each other when stored inside a parameter.
24 // this allows lists to be passed as single string parameters if needed.
25 integer REPLY_DISTANCE = 100008; // offset added to service's huffware id in reply IDs.
27 string BUTTON_PUSHED_ALERT = "#btnp";
28 // this event is generated when the button is pushed. the number parameter will be
29 // the huffware id plus the reply distance. the id parameter in the link message will
30 // contain the name of the button that was pushed.
33 // generates our button pressed alert, when the user has finished clicking on the button.
36 //llOwnerSay("user clicked on button " + BUTTON_NAME);
37 llMessageLinked(LINK_SET, BUTTON_PUSHER_HUFFWARE_ID + REPLY_DISTANCE,
38 BUTTON_PUSHED_ALERT, BUTTON_NAME);
42 state_entry() { if (llSubStringIndex(llGetObjectName(), "huffotronic") < 0) state real_default; }
43 on_rez(integer parm) { state rerun; }
45 state rerun { state_entry() { state default; } }
53 touch_end(integer count) {
54 if (llDetectedLinkNumber(0) == llGetLinkNumber())