1 /////////////////////////////////////////////////////////////////////
5 print "Waiting for an event...\n"
6 def EVENT = System.in.newReader().readLine()
7 SepLine = EVENT.split()
8 for (int i = 0; i < EventList.size(); i++) {
9 if (EventList[i] == SepLine[0]) {
10 println("The following effect: \n")
14 ObjectList[i].touched = 1
15 evt[-1].value = "Touched"
16 evt[-1].linkText = "touched by user"
17 evt[-1].name = "TouchSensor"
18 evt[-1].descriptionText = "Touching"
21 if (SepLine[1] == "0") {
22 ObjectList[i][0].lock()
24 evt[-1].value = "locked"
25 evt[-1].linkText = "lock0"
26 evt[-1].displayName = "lock0"
28 evt[-1].descriptionText = "locking"
29 } else if (SepLine[1] == "1") {
30 ObjectList[i][1].lock()
32 evt[-1].value = "locked"
33 evt[-1].linkText = "lock1"
34 evt[-1].displayName = "lock1"
36 evt[-1].descriptionText = "locking"
37 } else if (SepLine[1] == "2") {
38 ObjectList[i][2].lock()
40 evt[-1].value = "locked"
41 evt[-1].linkText = "lock2"
42 evt[-1].displayName = "lock2"
44 evt[-1].descriptionText = "locking"
48 if (SepLine[1] == "0") {
49 ObjectList[i][0].unlock()
51 evt[-1].value = "unlocked"
52 evt[-1].linkText = "lock0"
53 evt[-1].displayName = "lock0"
55 evt[-1].descriptionText = "unlocking"
56 } else if (SepLine[1] == "1") {
57 ObjectList[i][1].unlock()
59 evt[-1].value = "unlocked"
60 evt[-1].linkText = "lock1"
61 evt[-1].displayName = "lock1"
63 evt[-1].descriptionText = "unlocking"
64 } else if (SepLine[1] == "2") {
65 ObjectList[i][2].unlock()
67 evt[-1].value = "unlocked"
68 evt[-1].linkText = "lock2"
69 evt[-1].displayName = "lock2"
71 evt[-1].descriptionText = "unlocking"
75 if (SepLine[1] == "0") {
76 ObjectList[i][0].contactLatestValue = ObjectList[i].currentContact
77 ObjectList[i][0].currentContact = "open"
79 evt[-1].value = "contact.open"
80 evt[-1].linkText = "contact0"
81 evt[-1].displayName = "contact0"
82 evt[-1].name = "ContactSensor"
83 evt[-1].descriptionText = "opening"
84 } else if (SepLine[1] == "1") {
85 ObjectList[i][1].contactLatestValue = ObjectList[i].currentContact
86 ObjectList[i][1].currentContact = "open"
88 evt[-1].value = "contact.open"
89 evt[-1].linkText = "contact1"
90 evt[-1].displayName = "contact1"
91 evt[-1].name = "ContactSensor"
92 evt[-1].descriptionText = "opening"
93 } else if (SepLine[1] == "2") {
94 ObjectList[i][2].contactLatestValue = ObjectList[i].currentContact
95 ObjectList[i][2].currentContact = "open"
97 evt[-1].value = "contact.open"
98 evt[-1].linkText = "contact2"
99 evt[-1].displayName = "contact2"
100 evt[-1].name = "ContactSensor"
101 evt[-1].descriptionText = "opening"
104 case "contact.closed":
105 if (SepLine[1] == "0") {
106 ObjectList[i][0].contactLatestValue = ObjectList[i].currentContact
107 ObjectList[i][0].currentContact = "closed"
109 evt[-1].value = "contact.closed"
110 evt[-1].linkText = "contact0"
111 evt[-1].displayName = "contact0"
112 evt[-1].name = "ContactSensor"
113 evt[-1].descriptionText = "closing"
114 } else if (SepLine[1] == "1") {
115 ObjectList[i][1].contactLatestValue = ObjectList[i].currentContact
116 ObjectList[i][1].currentContact = "closed"
118 evt[-1].value = "contact.closed"
119 evt[-1].linkText = "contact1"
120 evt[-1].displayName = "contact1"
121 evt[-1].name = "ContactSensor"
122 evt[-1].descriptionText = "closing"
123 } else if (SepLine[1] == "2") {
124 ObjectList[i][2].contactLatestValue = ObjectList[i].currentContact
125 ObjectList[i][2].currentContact = "closed"
127 evt[-1].value = "contact.closed"
128 evt[-1].linkText = "contact2"
129 evt[-1].displayName = "contact2"
130 evt[-1].name = "ContactSensor"
131 evt[-1].descriptionText = "closing"
137 FunctionList[i](evt[-1])