home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / hewitt.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  14.0 KB  |  492 lines

  1. function work()
  2. {
  3.    _root.stop();
  4.    _root.micon.onMouseMove = function()
  5.    {
  6.       if(_root.fade._currentframe == 10)
  7.       {
  8.          this._x = _root._xmouse;
  9.          if(_root.txt_number > 1 && _root._ymouse < 100)
  10.          {
  11.             this._y = 100;
  12.          }
  13.          else
  14.          {
  15.             this._y = _root._ymouse;
  16.          }
  17.          Mouse.hide();
  18.       }
  19.    };
  20.    onMouseDown = function()
  21.    {
  22.       _root.answer = random(3) + 1;
  23.       if(_root.conditions == true && _root._currentframe < 40)
  24.       {
  25.          if(_root._ymouse > 100 && _root.txt_number <= 1)
  26.          {
  27.             if(_root.micon._currentframe != 3)
  28.             {
  29.                if(_root.txt_number == 0)
  30.                {
  31.                   _root.txt_number = 1;
  32.                }
  33.                _root.next_dis1 = 2;
  34.                _root.di1 = 1;
  35.             }
  36.             if(_root.micon._currentframe > 4)
  37.             {
  38.                if(_root.range == true)
  39.                {
  40.                   _root.answer != 1 ? (_root.answer != 2 ? (_root.next_txt1 = "Whats that going to achieve?") : (_root.next_txt1 = "Hmm... somehow I just dont think that will work")) : (_root.next_txt1 = "I can\'t use this here");
  41.                }
  42.                else
  43.                {
  44.                   _root.next_txt1 = "I can\'t reach that far unless you want me to throw it over there";
  45.                }
  46.             }
  47.             if(_root.micon._currentframe == 1)
  48.             {
  49.                if(_root.range == true)
  50.                {
  51.                   _root.answer != 1 ? (_root.answer != 2 ? (_root.next_txt1 = "IΓÇÖd rather not.") : (_root.next_txt1 = "I think this time it would just be better to keep my hands to myself")) : (_root.next_txt1 = "IΓÇÖve always wanted to know what that felt like");
  52.                }
  53.                else
  54.                {
  55.                   _root.next_txt1 = "I can\'t reach that far";
  56.                }
  57.             }
  58.             if(_root.micon._currentframe == 2)
  59.             {
  60.                _root.answer != 1 ? (_root.answer != 2 ? (_root.next_txt1 = "Are my glasses broken, or am I just looking at complete junk") : (_root.next_txt1 = "IΓÇÖve seen more interesting stuff on a bathroom stall")) : (_root.next_txt1 = "Nothing really important");
  61.             }
  62.             if(_root.micon._currentframe == 4)
  63.             {
  64.                if(_root.range == true)
  65.                {
  66.                   _root.answer != 1 ? (_root.answer != 2 ? (_root.next_txt1 = "Everybody in the house say yo...") : (_root.next_txt1 = "Is anybody there?")) : (_root.next_txt1 = "Hello?");
  67.                }
  68.                else
  69.                {
  70.                   _root.next_txt1 = "I should get closer";
  71.                }
  72.             }
  73.          }
  74.       }
  75.    };
  76.    onEnterFrame = function()
  77.    {
  78.       if(_root.togglet > 0)
  79.       {
  80.          _root.togglet = _root.togglet - 1;
  81.       }
  82.       if(_root.take > 4)
  83.       {
  84.          i = 1;
  85.          while(i < 40)
  86.          {
  87.             if(_root.inven["box" + i]._currentframe < 5)
  88.             {
  89.                _root.inven["box" + i].gotoAndStop(_root.take);
  90.                _root.take = 0;
  91.             }
  92.             i++;
  93.          }
  94.       }
  95.       !(_root.inven._currentframe == 1 && _root.fade._currentframe == 10) ? (_root.conditions = false) : (_root.conditions = true);
  96.       if(_root.txt_number == 0)
  97.       {
  98.          i = 1;
  99.          while(i < 10)
  100.          {
  101.             if(_root["di" + i] > 0)
  102.             {
  103.                _root["di" + i] = 0;
  104.             }
  105.             i++;
  106.          }
  107.          if(_root.dialogue._currentframe > 1)
  108.          {
  109.             _root.dialogue.gotoAndStop(1);
  110.          }
  111.          if(text_box._visible == true)
  112.          {
  113.             text_box._visible = false;
  114.          }
  115.       }
  116.       else
  117.       {
  118.          if(text_box._visible == false)
  119.          {
  120.             text_box._visible = true;
  121.          }
  122.          if(_root.dialogue._currentframe != _root["di" + _root.txt_number])
  123.          {
  124.             _root.dialogue.gotoAndStop(_root["di" + _root.txt_number]);
  125.          }
  126.          if(_root.txt != _root["next_txt" + _root.txt_number])
  127.          {
  128.             _root.txt = _root["next_txt" + _root.txt_number];
  129.          }
  130.          if(_root.dis != _root["next_dis" + _root.txt_number])
  131.          {
  132.             _root.dis = _root["next_dis" + _root.txt_number];
  133.          }
  134.       }
  135.       if(_currentframe > 40)
  136.       {
  137.          if(_root.range == false)
  138.          {
  139.             _root.range = true;
  140.          }
  141.       }
  142.       if(_currentframe > 1)
  143.       {
  144.          if(_root.conditions == true)
  145.          {
  146.             down = Key.isDown(40) || Key.isDown(83);
  147.             up = Key.isDown(38) || Key.isDown(87);
  148.             left = Key.isDown(37) || Key.isDown(65);
  149.             right = Key.isDown(39) || Key.isDown(68);
  150.             if(_root.nogo._currentframe != _root._currentframe)
  151.             {
  152.                _root.nogo.gotoAndStop(_root._currentframe);
  153.             }
  154.          }
  155.          else
  156.          {
  157.             if(_root.txt_number > 0)
  158.             {
  159.                _root.txt_number = 0;
  160.             }
  161.             if(_root.txt != "")
  162.             {
  163.                _root.txt = "";
  164.             }
  165.          }
  166.       }
  167.    };
  168.    _root.lvl.hewitt.onEnterFrame = function()
  169.    {
  170.       if(_root.txt_number <= 1 && _root.inven._currentframe == 1)
  171.       {
  172.          if(calc != (this._y - 144) / 3.5)
  173.          {
  174.             calc = (this._y - 144) / 3.5;
  175.          }
  176.          if(spd != calc / 14 * _root.speed_calc)
  177.          {
  178.             spd = calc / 14 * _root.speed_calc;
  179.          }
  180.          if(_root.fade._currentframe < 10 && this.walk._currentframe > 1)
  181.          {
  182.             this.walk.gotoAndStop(1);
  183.          }
  184.          if(this._xscale != calc * turn)
  185.          {
  186.             this._xscale = calc * turn;
  187.          }
  188.          if(this._yscale != calc)
  189.          {
  190.             this._yscale = calc;
  191.          }
  192.          this.swapDepths(this._y);
  193.          if(_root.conditions == true)
  194.          {
  195.             i = 1;
  196.             while(i < 5)
  197.             {
  198.                if(_root.nogo["exit" + i].hitTest(this.bot))
  199.                {
  200.                   _root.fade.gotoAndPlay(1);
  201.                   _root.gotoAndStop(_root.nogo["exit" + i].frame);
  202.                   _root.load_x = _root.nogo["exit" + i].load_x;
  203.                   _root.load_y = _root.nogo["exit" + i].load_y;
  204.                   down = _root.nogo["exit" + i].down;
  205.                   up = _root.nogo["exit" + i].up;
  206.                   left = _root.nogo["exit" + i].lefft;
  207.                   right = _root.nogo["exit" + i].rite;
  208.                }
  209.                i++;
  210.             }
  211.             if(down && !_root.nogo.hitTest(this._x,this._y + spd,true))
  212.             {
  213.                this._y += spd / 2;
  214.             }
  215.             if(up && !_root.nogo.hitTest(this._x,this._y - spd,true))
  216.             {
  217.                this._y -= spd / 2;
  218.             }
  219.             if(left && !_root.nogo.hitTest(this._x - spd,this._y,true))
  220.             {
  221.                if(turn != 1)
  222.                {
  223.                   turn = 1;
  224.                }
  225.                this._x -= spd;
  226.             }
  227.             if(right && !_root.nogo.hitTest(this._x + spd,this._y,true))
  228.             {
  229.                if(turn != -1)
  230.                {
  231.                   turn = -1;
  232.                }
  233.                this._x += spd;
  234.             }
  235.             if(!down && !up && !left && !right)
  236.             {
  237.                if(this.walk._currentframe > 1)
  238.                {
  239.                   this.walk.gotoAndStop(1);
  240.                }
  241.             }
  242.             else
  243.             {
  244.                this.walk.play();
  245.             }
  246.             if((left || right) && !down && !up && this._currentframe != 3)
  247.             {
  248.                this.gotoAndStop(3);
  249.             }
  250.             if(down)
  251.             {
  252.                if(!left && !right)
  253.                {
  254.                   if(this._currentframe != 5)
  255.                   {
  256.                      this.gotoAndStop(5);
  257.                   }
  258.                }
  259.                else if(this._currentframe != 4)
  260.                {
  261.                   this.gotoAndStop(4);
  262.                }
  263.             }
  264.             if(up)
  265.             {
  266.                if(!left && !right)
  267.                {
  268.                   if(this._currentframe != 1)
  269.                   {
  270.                      this.gotoAndStop(1);
  271.                   }
  272.                }
  273.                else if(this._currentframe != 2)
  274.                {
  275.                   this.gotoAndStop(2);
  276.                }
  277.             }
  278.          }
  279.       }
  280.       else if(this.walk._currentframe != 1)
  281.       {
  282.          this.walk.gotoAndStop(1);
  283.       }
  284.    };
  285.    i = 1;
  286.    while(i <= 11)
  287.    {
  288.       _root.lvl["ob" + i].onEnterFrame = function()
  289.       {
  290.          this.swapDepths(this._y);
  291.          if(this._currentframe != _root["taken" + this.frame] + 1)
  292.          {
  293.             this.gotoAndStop(_root["taken" + this.frame] + 1);
  294.          }
  295.       };
  296.       _root.lvl["ob" + i].onMouseDown = function()
  297.       {
  298.          if(_root.even7 >= 5 && _root.conditions == true && this.frame > 1 && _root.range == true && this.hitTest(_xmouse,_ymouse,true) && _root.micon._currentframe == 1)
  299.          {
  300.             _root.take = this.frame;
  301.             _root["taken" + this.frame] = 1;
  302.          }
  303.       };
  304.       i++;
  305.    }
  306.    i = _root.min_objects;
  307.    while(i <= _root.max_objects)
  308.    {
  309.       _root.inven["box" + i].onMouseUp = function()
  310.       {
  311.          if(this.hitTest(_xmouse,_ymouse,true) && _root.inven._currentframe == 2 && this._y > 120 && this._y < 400)
  312.          {
  313.             if(_root.micon._currentframe == 1 && _root.even7 >= 8)
  314.             {
  315.                if(_root.inven.large._currentframe == this._currentframe)
  316.                {
  317.                   _root.inven.large.gotoAndStop(1);
  318.                }
  319.                _root.micon.gotoAndStop(this._currentframe);
  320.                this.gotoAndStop(1);
  321.             }
  322.             else if(this._currentframe == 1 && _root.micon._currentframe > 4)
  323.             {
  324.                _root.inven.large.gotoAndStop(_root.micon._currentframe);
  325.                this.gotoAndStop(_root.micon._currentframe);
  326.                _root.micon.gotoAndStop(1);
  327.             }
  328.             if(_root.micon._currentframe == 2)
  329.             {
  330.                _root.inven.large.gotoAndStop(this._currentframe);
  331.             }
  332.          }
  333.       };
  334.       i++;
  335.    }
  336. }
  337. function load_vars()
  338. {
  339.    savefile = SharedObject.getLocal("Hewitt_file" + _root.load_file_chosen);
  340.    init_even7 = _root.even7;
  341.    i = 1;
  342.    while(i < 100)
  343.    {
  344.       _root.inven["box" + i].gotoAndStop(savefile.data["box_frame" + i]);
  345.       _root["taken" + i] = savefile.data["taken" + i];
  346.       _root["even" + i] = savefile.data["even" + i];
  347.       _root["talk" + i] = savefile.data["talk" + i];
  348.       i++;
  349.    }
  350.    if(_root._currentframe == 2)
  351.    {
  352.       _root.even7 = init_even7;
  353.    }
  354.    _root.success_type = 1;
  355.    _root.fade_success = 50;
  356.    _root.inven.loader.gotoAndStop(1);
  357.    if(_root.even37 == 2)
  358.    {
  359.       _root.inven.gotoAndStop(4);
  360.    }
  361.    else
  362.    {
  363.       _root.inven.gotoAndStop(6);
  364.    }
  365.    _root.sfx.gotoAndStop(2);
  366.    if(_root._currentframe == 1)
  367.    {
  368.       _root.loadeding = 1;
  369.       _root.gotoAndStop(2);
  370.    }
  371.    else if(_root._currentframe != _root.even37)
  372.    {
  373.       _root.gotoAndStop(_root.even37);
  374.    }
  375. }
  376. stop();
  377. _root.happystream = 3;
  378. _root.togglet = 0;
  379. _root.total_objects = 20;
  380. turn = 1;
  381. _root.demo = 0;
  382. _root.txt_number = 0;
  383. _root.bend_clicky = 0;
  384. _root.inven._visible = false;
  385. _root.nogo._visible = false;
  386. Stage.showMenu = false;
  387. getUrl("FSCommand:fullscreen", "true");
  388. _root.ful = 1;
  389. _root.bgSound = new Sound();
  390. _root.snd_calc = 85;
  391. _root.saveing = 0;
  392. _root.speed_calc = 1;
  393. _root.load_x = 275;
  394. _root.load_y = 475;
  395. i = 1;
  396. while(i < 100)
  397. {
  398.    _root.inven["box" + i].gotoAndStop(1);
  399.    _root["talk" + i] = 0;
  400.    _root["even" + i] = 0;
  401.    _root["taken" + i] = 0;
  402.    i++;
  403. }
  404. i = 1;
  405. while(i < 15)
  406. {
  407.    _root.inven["box" + i].work_frame = 2;
  408.    i++;
  409. }
  410. i = 15;
  411. while(i < 29)
  412. {
  413.    _root.inven["box" + e].work_frame = 3;
  414.    i++;
  415. }
  416. my_listener = new Object();
  417. Mouse.addListener(my_listener);
  418. my_listener.onMouseWheel = function(counter)
  419. {
  420.    if(counter != 0 && _root.togglet == 0 && _root.even7 == 20 && _root._currentframe > 1 && _root._currentframe < 40 && _root.inven._currentframe == 1 && _root.txt_number <= 1)
  421.    {
  422.       _root.TUTS.nextFrame();
  423.       _root.even41 = 1;
  424.       new_frame = _root.micon._currentframe;
  425.       foundframe = 0;
  426.       if(new_frame > 4)
  427.       {
  428.          _root.take = new_frame;
  429.       }
  430.       if(counter > 0)
  431.       {
  432.          while(foundframe == 0)
  433.          {
  434.             new_frame--;
  435.             if(new_frame < 1)
  436.             {
  437.                new_frame = 62;
  438.             }
  439.             else if(new_frame < 5)
  440.             {
  441.                foundframe = new_frame;
  442.             }
  443.             i = 1;
  444.             while(i < 100)
  445.             {
  446.                if(_root.inven["box" + i]._currentframe == new_frame)
  447.                {
  448.                   _root.inven["box" + i].gotoAndStop(1);
  449.                   foundframe = new_frame;
  450.                }
  451.                i++;
  452.             }
  453.             if(foundframe == 3)
  454.             {
  455.                foundframe = 2;
  456.             }
  457.          }
  458.       }
  459.       else
  460.       {
  461.          while(foundframe == 0)
  462.          {
  463.             new_frame++;
  464.             if(new_frame > 62)
  465.             {
  466.                new_frame = 1;
  467.             }
  468.             else if(new_frame < 5)
  469.             {
  470.                foundframe = new_frame;
  471.             }
  472.             i = 1;
  473.             while(i < 100)
  474.             {
  475.                if(_root.inven["box" + i]._currentframe == new_frame)
  476.                {
  477.                   _root.inven["box" + i].gotoAndStop(1);
  478.                   foundframe = new_frame;
  479.                }
  480.                i++;
  481.             }
  482.             if(foundframe == 3)
  483.             {
  484.                foundframe = 4;
  485.             }
  486.          }
  487.       }
  488.       _root.micon.gotoAndStop(foundframe);
  489.       _root.togglet = 2;
  490.    }
  491. };
  492.