summaryrefslogtreecommitdiffstats
path: root/Items.c4d/Sensors.c4d/Switch.c4d/Script.c
diff options
context:
space:
mode:
Diffstat (limited to 'Items.c4d/Sensors.c4d/Switch.c4d/Script.c')
-rw-r--r--Items.c4d/Sensors.c4d/Switch.c4d/Script.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/Items.c4d/Sensors.c4d/Switch.c4d/Script.c b/Items.c4d/Sensors.c4d/Switch.c4d/Script.c
new file mode 100644
index 0000000..1396ba7
--- /dev/null
+++ b/Items.c4d/Sensors.c4d/Switch.c4d/Script.c
@@ -0,0 +1,21 @@
+#strict 2
+#include BS7I
+
+local state;
+
+func Triggers() { return [["$On$"], ["$Off$"]]; }
+
+func ControlThrow(object caller)
+{
+ state = !state;
+ SetAction(["Idle", "On"][state]);
+ Sound("Grab");
+ TriggerState(caller);
+}
+
+func TriggerState(object caller)
+{
+ Trigger(!state, caller);
+}
+
+func SensorCallbacks() { return [["$Switch$", "ControlThrow"], ["$Retrigger$", "TriggerState"]]; }