-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnPose Dismount Plugin.lsl
57 lines (51 loc) · 2.46 KB
/
nPose Dismount Plugin.lsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
The nPose scripts are licensed under the GPLv2 (http://www.gnu.org/licenses/gpl-2.0.txt), with the following addendum:
The nPose scripts are free to be copied, modified, and redistributed, subject to the following conditions:
- If you distribute the nPose scripts, you must leave them full perms.
- If you modify the nPose scripts and distribute the modifications, you must also make your modifications full perms.
"Full perms" means having the modify, copy, and transfer permissions enabled in Second Life and/or other virtual world platforms derived from Second Life (such as OpenSim). If the platform should allow more fine-grained permissions, then "full perms" will mean the most permissive possible set of permissions allowed by the platform.
*/
//Modified to work with SCHMO(E) type lines.
integer seatupdate = 35353;
list seatAndAv;
integer dismount = -221;
list SeatedAvs(){ //returns the list of uuid's of seated AVs
list avs=[];
integer counter = llGetNumberOfPrims();
while (llGetAgentSize(llGetLinkKey(counter)) != ZERO_VECTOR){
avs += [llGetLinkKey(counter)];
counter--;
}
return avs;
}
default
{
state_entry()
{
}
link_message(integer sender_num, integer num, string str, key id){
if (num == dismount){
list tempList = llParseStringKeepNulls(str, ["~"], []);
integer sitters = llGetListLength(tempList);
integer n;
llSleep(1.0);
for (n=0; n<sitters; ++n){
integer seat# = (integer)llList2String(tempList, n);
integer index = llListFindList(seatAndAv, [(seat#)]);
if (llListFindList(SeatedAvs(), [(key)llList2String(seatAndAv, index + 1)]) != -1){
//slave will be doing all unsits from now on... link message out to the slave
llMessageLinked(LINK_SET, -222, llList2String(seatAndAv, index + 1), NULL_KEY);
}
}
}else if (num == seatupdate){
integer seatcount;
list seatsavailable = llParseStringKeepNulls(str, ["^"], []);
integer stop = llGetListLength(seatsavailable)/8;
seatAndAv = [];
for (seatcount = 0; seatcount < stop; ++seatcount){
integer seatNum = (integer)llGetSubString(llList2String(seatsavailable, (seatcount)*8), 4,-1);
seatAndAv += [seatcount+1, llList2String(seatsavailable, (seatcount)*8+4)];
}
}
}
}