-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsd_acc_elevator.lsl
117 lines (103 loc) · 3.4 KB
/
vsd_acc_elevator.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
integer ACC_GAME_CHANNEL = 49805;
string SEPERATOR = "|||";
float RAISE_HEIGHT = 5.5;
float RAISE_TIME = 5.0;
float DELAY_TIME = 5.0; //Inactive time in seconds
/*^Make Changes to above numbers^*/
vector startPosition = ZERO_VECTOR;
integer up = FALSE;
list itemAcollectors = [];
list itemBcollectors = [];
list itemCcollectors = [];
integer listenHandle = 0;
MoveElevator()
{
if(up)
{
llMoveToTarget(startPosition + <0,0, RAISE_HEIGHT>, 1.5);
}
else
{
llMoveToTarget(startPosition, 1.5);
}
}
default
{
state_entry()
{
llListenRemove(listenHandle);
listenHandle = llListen(ACC_GAME_CHANNEL, "", "", "");
llSetStatus(STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z, FALSE);
startPosition = llGetPos();
llSetTimerEvent(0.0);
}
touch_end(integer total_number)
{
key avatarKey = llDetectedKey(0);
if(llListFindList(itemAcollectors, [avatarKey]) != -1 &
llListFindList(itemBcollectors, [avatarKey]) != -1 &
llListFindList(itemCcollectors, [avatarKey]) != -1)
{
llSetStatus(STATUS_PHYSICS, TRUE);
if(!up & startPosition != ZERO_VECTOR)
{
up = TRUE;
MoveElevator();
llSetTimerEvent(RAISE_TIME);
}
else
{
up = FALSE;
MoveElevator();
llSetTimerEvent(0.0);
}
}
else
{
llSay(0, "Please learn more about this value by stepping on all 3 plates before proceeding upstairs!");
}
}
timer()
{
up = FALSE;
MoveElevator();
}
listen(integer channel, string name, key id, string message)
{
list parameters = llParseString2List(message, [SEPERATOR], [""]);
key avatarKey = (key)llList2String(parameters, 0);
string command = llList2String(parameters, 1);
string commandParameter = llList2String(parameters, 2);
if(command == "ADD_STEPPER")
{
llSay(0, llKey2Name(avatarKey) + " activated switch " + commandParameter + ".");
if(commandParameter == "A")
{
integer index = llListFindList(itemAcollectors, [avatarKey]);
if(index == -1)
{
itemAcollectors = itemAcollectors + avatarKey;
}
}
else if(commandParameter == "B")
{
integer index = llListFindList(itemBcollectors, [avatarKey]);
if(index == -1)
{
itemBcollectors = itemBcollectors + avatarKey;
}
}
else if(commandParameter == "C")
{
integer index = llListFindList(itemCcollectors, [avatarKey]);
if(index == -1)
{
itemCcollectors = itemCcollectors + avatarKey;
}
}
/*llSay(0, "A: " + llDumpList2String(itemAcollectors, ",") +
"\nB: " + llDumpList2String(itemBcollectors, ",") +
"\nC: " + llDumpList2String(itemCcollectors, ","));*/
}
}
}