home *** CD-ROM | disk | FTP | other *** search
- #
- # Droids Cog Script
- #
- # 00_lightswitch.cog
- #
- # Light with Lightswitch cog
- #
- # Desc:
- # When switched on, will turn the various lights connected to it
- # on. Kind of like those things is rooms, you know, lightswitches?
- #
- # 11/26/97 [DGS] Created
- #
- # --------------------------------------------------------------------------------
-
-
- symbols
-
- message activate
- message startup
-
- surface switch0
- surface switch1
-
- thing light0
- thing light1
- thing light2
- thing light3
- thing light4
-
-
- float brightness=1.00
- int onoff=0 local
- end
-
- ## Code Section
- code
-
- startup:
- setthinglight(light0, 0 , 0.0);
- if (light1 != 0) setthinglight(light1, 0, 0.0);
- if (light2 != 0) setthinglight(light2, 0, 0.0);
- if (light3 != 0) setthinglight(light3, 0, 0.0);
- if (light4 != 0) setthinglight(light4, 0, 0.0);
- return;
-
- activate:
- if (onoff == 0)
- {
- // Turn the light on
- setthinglight(light0, brightness, 0.0);
- if (light1 != 0) setthinglight(light1, brightness, 0.0);
- if (light2 != 0) setthinglight(light2, brightness, 0.0);
- if (light3 != 0) setthinglight(light3, brightness, 0.0);
- if (light4 != 0) setthinglight(light4, brightness, 0.0);
- onoff = 1;
- setwallcel(switch0,1);
- setwallcel(switch1,1);
- }
- else
- {
- // Turn the light off
- setthinglight(light0, brightness, 0.0);
- if (light1 != 0) setthinglight(light1, 0, 0.0);
- if (light2 != 0) setthinglight(light2, 0, 0.0);
- if (light3 != 0) setthinglight(light3, 0, 0.0);
- if (light4 != 0) setthinglight(light4, 0, 0.0);
- onoff = 0;
- setwallcel(switch0,0);
- setwallcel(switch1,0);
- }
-
- return;
-
-
- end
-
-