35445c83c1139811e36241df8d133e44f9c2f2de
[feisty_meow.git] / huffware / huffotronic_scripts / sit_testing_v0.6.txt
1 
2 // testing of an opensim bug, where there was a new requirement that
3 // the object have a sit target before any changed events will be fired.
4 //
5 //   this script is licensed by the GPL v3 which is documented at: http://www.gnu.org/licenses/gpl.html
6 //   do not use it in objects without fully realizing you are implicitly accepting that license.
7 //
8
9 integer link_changes = 0;
10
11
12 default {
13     state_entry() { if (llSubStringIndex(llGetObjectName(), "huffotronic") < 0) state real_default; }
14     on_rez(integer parm) { state rerun; }
15 }
16 state rerun { state_entry() { state default; } }
17
18 state real_default {
19     state_entry()
20     {
21         llSitTarget(<0, 0, 0.1>, ZERO_ROTATION);
22 //above line makes things work.  comment it out, and put in new object, and
23 // the object will not get changed events.
24         llSay(0, "sit to run the test...");
25     }
26     
27     on_rez(integer count) { llResetScript(); }
28     
29     changed(integer chang) {
30         llSay(0, "got into changed event...");
31         if (! (chang & CHANGED_LINK) ) {
32             llSay(0, "change was not a link, leaving.");
33             return;  // not for us.
34         }
35         llSay(0, "into changed event, CHANGED_LINK...");
36         link_changes++;
37         key av_sitting = llAvatarOnSitTarget();
38         if (av_sitting == NULL_KEY) {
39             llSay(0, "avatar stood up since key is null");
40         } else {
41             llSay(0, "avatar sat down: " + llDetectedName(0));
42         }
43     }
44     
45     touch_start(integer count) {
46         llSay(0, "there have been " + (string)link_changes
47             + " 'changed' events for links since the last reset.");
48     }
49 }