home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 52 / ClassicFond52.iso / GAMES / DROIDW.RAR / DWCD.GOB / mission_cog_02_bafflem.cog < prev    next >
Encoding:
Text File  |  1998-11-04  |  7.3 KB  |  297 lines

  1. symbols
  2. message        user0
  3. message        user1
  4. message        user2
  5. message        user3
  6. message        user4
  7. message        user5
  8. message        user6
  9. message        startup
  10. message        entered
  11. message        activate
  12. message        arrived
  13. message        pulse
  14. message        timer
  15.  
  16. sector         crosector           linkid=1
  17. sector         lamesector          linkid=2
  18.  
  19. thing          light1
  20. thing          light2
  21. thing          light3
  22.  
  23. thing          xlight1
  24. thing          xlight2
  25. thing          xlight3
  26. thing          xlight4
  27. thing          xlight5
  28. thing          xlight6
  29. thing          xlight7
  30. thing          xlight8
  31.  
  32. thing          mirror        
  33.  
  34. cog            fittotalkcog
  35. cog            ADarrivescog
  36.  
  37. flex           xcount=0.67
  38.  
  39. cog            goalscog
  40.  
  41. surface        mirrorswitch        linkid=3
  42. surface        led_ones            nolink
  43. surface        led_tens            nolink
  44.  
  45. sound          poweronwav=nrg02poweron.wav
  46. sound          poweroffwav=nrg02poweroff.wav
  47. sound          clicksound
  48. end
  49.  
  50. code
  51. startup:
  52.      poweron=0;
  53.      ct=0;
  54.      ct2=0;
  55.      x1genon=0;
  56.      x2genon=0;
  57.      x3genon=0;
  58.      setthinglight(light1, 0, 0.0);
  59.      setthinglight(light2, 0, 0.0);
  60.      setthinglight(light3, 0, 0.0);
  61.      setpulse(5);
  62.      rotatepivot(mirror, 1, 1);
  63.      settimerEX(3, 1, 0, 0);
  64.      direction=1;
  65.      mircount=0;
  66.      genbreak=0;
  67.      pleasework=0;
  68.      md_power=35;
  69.      call displayweight;
  70.      return;
  71.      
  72. pulse:
  73.      if ( (x1genon==1)&&(x2genon==1)&&(x3genon==1) ) xcount=1.0;
  74.      
  75.      if ( (x1genon==1)&&(x2genon==1)&&(x3genon==0) ) xcount=0.67;
  76.      if ( (x1genon==1)&&(x2genon==0)&&(x3genon==1) ) xcount=0.67;
  77.      if ( (x1genon==1)&&(x2genon==0)&&(x3genon==1) ) xcount=0.67;
  78.      
  79.      if ( (x1genon==1)&&(x2genon==0)&&(x3genon==0) ) xcount=0.33;
  80.      if ( (x1genon==0)&&(x2genon==1)&&(x3genon==0) ) xcount=0.33;     
  81.      if ( (x1genon==0)&&(x2genon==0)&&(x3genon==1) ) xcount=0.33;
  82.      
  83.      rand1=rand();
  84.      rand2=rand();
  85.      rand3=rand();
  86.      rand4=rand();
  87.      rand5=rand();
  88.      rand6=rand();
  89.      rand7=rand();
  90.      rand8=rand();     
  91.      
  92.      hightime=xcount*2.5;
  93.      
  94.      if (rand1<xcount) setthinglight(xlight1, hightime, 2);
  95.      else setthinglight(xlight1, .33, 2);
  96.      
  97.      if (rand2<xcount) setthinglight(xlight2, hightime, 2);
  98.      else setthinglight(xlight2, .33, 2);
  99.      
  100.      if (rand3<xcount) setthinglight(xlight3, hightime, 2);
  101.      else setthinglight(xlight3, .33, 2);
  102.      
  103.      if (rand4<xcount) setthinglight(xlight4, hightime, 2);
  104.      else setthinglight(xlight4, .33, 2);
  105.      
  106.      if (rand5<xcount) setthinglight(xlight5, hightime, 2);
  107.      else setthinglight(xlight5, .33, 2);
  108.      
  109.      if (rand6<xcount) setthinglight(xlight6, hightime, 2);
  110.      else setthinglight(xlight6, .33, 2);
  111.      
  112.      if (rand7<xcount) setthinglight(xlight7, hightime, 2);
  113.      else setthinglight(xlight7, .33, 2);
  114.      
  115.      if (rand8<xcount) setthinglight(xlight8, hightime, 2);
  116.      else setthinglight(xlight8, .33, 2);
  117.      
  118.      return;
  119.      
  120. entered:
  121.      if (getsenderid()==1) call xGenCheck;
  122.      return;
  123.      
  124. user0:
  125.      x1genon=1;
  126.      print("generator one LINED UP");
  127.      if (miron==1) setthinglight(light1, 1.5, 3.0);
  128.      call xGenCheck;     
  129. //     else call ctext2;
  130.      return;
  131.      
  132. user1:
  133.      x1genon=0;
  134.      setthinglight(light1, 0.0, 3.0);     
  135.      call xGenCheck;     
  136.      return;
  137.      
  138. user2:
  139.      x2genon=1;
  140.      print("generator two ONLINE");
  141.      setthinglight(light2, 1.5, 3.0);     
  142.      call xGenCheck;     
  143.      return;
  144.      
  145. user3:
  146.      x2genon=0;
  147.      setthinglight(light2, 0.0, 3.0);     
  148.      call xGenCheck;     
  149.      return;
  150.  
  151. user4:
  152.      x3genon=1;
  153.      print("generator three ONLINE");
  154.      setthinglight(light3, 1.5, 3.0);     
  155.      call xGenCheck;     
  156.      return;
  157.      
  158. user5:
  159.      x3genon=0;
  160.      setthinglight(light3, 0.0, 3.0);     
  161.      call xGenCheck;     
  162.      return;
  163.      
  164. user6:
  165.      genbreak=1;
  166.      return;
  167.    
  168. timer:
  169.      if (getsenderid()==1) {
  170.           if (mircount<6) { 
  171.                rotatepivot(mirror, 1, 1);
  172.                settimerEX(3, 1, 0, 0);
  173.           }
  174.      }
  175.      else if (getsenderid()==2) {
  176.           md_power=md_power+inc;
  177.          if (md_power < 35)  md_power = 35;
  178.           else if (md_power>65) md_power=65;         
  179.          else if (md_power == c_dest) print("reached c_dest");
  180.           else SetTimerEX(0.02,2,0,0);
  181.            call displayweight;     
  182.      }
  183.      return;
  184.      
  185. displayweight:
  186.      playsoundpos(clicksound, getsurfacecenter(led_tens), 0.3, -1, -1, 0);
  187.      SetWallCel(led_ones, md_power %  10);
  188.      SetWallCel(led_tens, (md_power / 10) % 10);
  189.      SetWallCel(led_hund, (md_power / 100) % 10);
  190.      return;
  191.  
  192. #--------------------------------------------------------------------------       
  193. arrived:
  194.      setwallcel(mirrorswitch,0);
  195.      mircount=mircount+1;
  196.      print("mircount is");
  197.      printint(mircount);
  198.      miron=0;
  199.      if (mircount%12==0) {
  200.           direction=1;
  201.           jumptoframe(mirror, 0, getthingsector(mirror));
  202.           print("jump!");
  203.      }
  204.      else if ((mircount-6)%12==0) direction=-1;
  205.      else if ( ((mircount-8)%12==0)||((mircount-4)%12==0) ) {                    
  206.           if (x1genon==1) setthinglight(light1, 1.5, 3.0);
  207.           miron=1;
  208.           print("that's it!");
  209.      }   
  210.      else setthinglight(light1, 0.0, 3.0);     
  211.      call xGenCheck;
  212.      return;
  213.  
  214. activate:
  215.      print("activate");
  216.      if (getsenderid()==3) {
  217.           if (getwallcel(mirrorswitch)==1) return; 
  218.           setwallcel(mirrorswitch, 1);
  219.          
  220.           if (direction==1) {
  221.                print("moving downward");
  222.                rotatepivot(mirror, 1, 1);               
  223.                inc=-1;
  224.                c_dest=md_power-5;
  225.           }
  226.           else if (direction==-1) {
  227.                print("moving upward");
  228.                rotatepivot(mirror, 1, -1);
  229.                inc=1;
  230.                c_dest=md_power+5;
  231.           }   
  232.           
  233.           
  234.           SetTimerEX(0.02,2,0,0);  
  235.      }
  236.      return;
  237.  
  238. displayweight:
  239.      SetWallCel(led_ones, md_power %  10);
  240.      SetWallCel(led_tens, (md_power / 10) % 10);
  241.      return;
  242.  
  243.  
  244.  
  245. #--------------------------------------------------------------------------     
  246.  
  247. xGenCheck:     
  248.      if ( (x3genon==1)&&(x2genon==1)&&(x1genon==1)&&(miron==1) )  {
  249.           print("GENERATORS ONLINE");
  250.           playsoundlocal(poweronwav, 1.0, 0.0, 0);
  251.           poweron=1;
  252.           if (genbreak==0) {
  253.                sendmessage(fittotalkcog, user3);
  254.                call ctext1;
  255.           }
  256.           else if ((genbreak==1)&&(pleasework==0)) {
  257.                sendmessage(ADarrivescog, user0);               
  258.                pleasework=1;
  259.           }
  260.      }
  261.      else {
  262.           print("GENERATORS OFFLINE");
  263.           sendmessage(fittotalkcog, user2);
  264.           if (poweron==1) {
  265.                playsoundlocal(poweroffwav, 1.0, 0.0, 0);
  266.                poweron=0;
  267.           }
  268.      }
  269.      return;
  270.      
  271. ctext1:
  272.      if (ct==0) {          
  273.           dwplaycammyspeech(16006, "m2ca006.wav", 20, 2);
  274. //          sendmessage(goalscog, user0);
  275.           ct=1;
  276.      }
  277.      return;
  278.      
  279. ctext2:
  280.      if (ct2==0) {     
  281.           dwplaycammyspeech(16016, "m2ca016.wav", 20, 2);
  282.           ct2=1;
  283.      }
  284.      return;
  285.   
  286. end
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.      
  295.  
  296.  
  297.