void main()
{
    object oPC = GetClickingObject();
    effect eRoomgear = EffectVisualEffect(VFX_FNF_SCREEN_SHAKE, FALSE);

    if(GetLocalInt(GetObjectByTag("room13counter"), "exitcounter") == 3)
        {
            if(GetLocalInt(GetObjectByTag("room4counter"), "exitcounter") == 0)
                {
                    AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r13_to_r4"))));
                    SetLocalInt(GetObjectByTag("room13counter"), "exitcounter", 0);
                    DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room13counter")), 6.0));
                    DelayCommand(1.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_crank1")));
                    DelayCommand(5.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_boomdist2")));
                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13npit_snd")));
                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13spit_snd")));
                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13epit_snd")));
                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13wpit_snd")));
                }
              else
                {
                    if(GetLocalInt(GetObjectByTag("room4counter"), "exitcounter") == 1)
                        {
                            AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r9_to_r4"))));
                            SetLocalInt(GetObjectByTag("room13counter"), "exitcounter", 0);
                            DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room13counter")), 6.0));
                            DelayCommand(1.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_crank1")));
                            DelayCommand(5.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_boomdist2")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13npit_snd")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13spit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13epit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13wpit_snd")));
                        }
                      else
                        {
                            if(GetLocalInt(GetObjectByTag("room4counter"), "exitcounter") == 2)
                                {
                                    AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r1_to_r4"))));
                                    SetLocalInt(GetObjectByTag("room13counter"), "exitcounter", 0);
                                    DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room13counter")), 6.0));
                                    DelayCommand(1.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_crank1")));
                                    DelayCommand(5.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_boomdist2")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13npit_snd")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13spit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13epit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13wpit_snd")));
                                }
                              else
                                {
                                    if(GetLocalInt(GetObjectByTag("room4counter"), "exitcounter") == 3)
                                        {
                                            AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r8_to_r4"))));
                                            SetLocalInt(GetObjectByTag("room13counter"), "exitcounter", 0);
                                            DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room13counter")), 6.0));
                                            DelayCommand(1.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_crank1")));
                                            DelayCommand(5.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_boomdist2")));
                                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13npit_snd")));
                                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13spit_snd")));
                                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13epit_snd")));
                                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13wpit_snd")));
                                        }
                                }
                        }
                }
        }
      else
        {
            if(GetLocalInt(GetObjectByTag("room13counter"), "exitcounter") == 0)
                {
                    AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r13_to_rspike"))));
                    SetLocalInt(GetObjectByTag("room13counter"), "exitcounter", 1);
                    DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room13counter")), 6.0));
                    DelayCommand(1.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_crank1")));
                    DelayCommand(5.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_boomdist2")));
                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13epit_snd")));
                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13wpit_snd")));
                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13npit_snd")));
                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13spit_snd")));
                }
              else
                {
                    if(GetLocalInt(GetObjectByTag("room13counter"), "exitcounter") == 1)
                        {
                            AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r13_to_a2"))));
                            SetLocalInt(GetObjectByTag("room11counter"), "exitcounter", 2);
                            DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room11counter")), 6.0));
                            DelayCommand(1.0, AssignCommand(GetObjectByTag("room11counter"), PlaySound("as_cv_crank1")));
                            DelayCommand(5.0, AssignCommand(GetObjectByTag("room11counter"), PlaySound("as_cv_boomdist2")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13npit_snd")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13spit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13epit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13wpit_snd")));
                        }
                      else
                        {
                            if(GetLocalInt(GetObjectByTag("room13counter"), "exitcounter") == 2)
                                {
                                    AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r13_to_rspike"))));
                                    SetLocalInt(GetObjectByTag("room13counter"), "exitcounter", 3);
                                    DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room13counter")), 6.0));
                                    DelayCommand(1.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_crank1")));
                                    DelayCommand(5.0, AssignCommand(GetObjectByTag("room13counter"), PlaySound("as_cv_boomdist2")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13epit_snd")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r13wpit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13npit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r13spit_snd")));
                                }
                        }
                }
         }
}