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

    if(GetLocalInt(GetObjectByTag("room10counter"), "exitcounter") == 1)
        {
            AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r10_to_rspike"))));
            SetLocalInt(GetObjectByTag("room10counter"), "exitcounter", 2);
            DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room10counter")), 6.0));
            DelayCommand(1.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_crank1")));
            DelayCommand(5.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_boomdist2")));
            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10epit_snd")));
            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10wpit_snd")));
            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10npit_snd")));
            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10spit_snd")));
        }
      else
        {
            if(GetLocalInt(GetObjectByTag("room10counter"), "exitcounter") == 2)
                {
                    if(GetLocalInt(GetObjectByTag("room5counter"), "exitcounter") == 0)
                        {
                            AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r10_to_r5"))));
                            SetLocalInt(GetObjectByTag("room10counter"), "exitcounter", 3);
                            DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room10counter")), 6.0));
                            DelayCommand(1.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_crank1")));
                            DelayCommand(5.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_boomdist2")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10npit_snd")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10spit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10epit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10wpit_snd")));
                        }
                      else
                        {
                            if(GetLocalInt(GetObjectByTag("room5counter"), "exitcounter") == 1)
                                {
                                    AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r6_to_r5"))));
                                    SetLocalInt(GetObjectByTag("room10counter"), "exitcounter", 3);
                                    DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room10counter")), 6.0));
                                    DelayCommand(1.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_crank1")));
                                    DelayCommand(5.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_boomdist2")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10npit_snd")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10spit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10epit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10wpit_snd")));
                                }
                              else
                                {
                                  if(GetLocalInt(GetObjectByTag("room5counter"), "exitcounter") == 2)
                                      {
                                          AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r1_to_r5"))));
                                          SetLocalInt(GetObjectByTag("room10counter"), "exitcounter", 3);
                                          DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room10counter")), 6.0));
                                          DelayCommand(1.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_crank1")));
                                          DelayCommand(5.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_boomdist2")));
                                          DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10npit_snd")));
                                          DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10spit_snd")));
                                          DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10epit_snd")));
                                          DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10wpit_snd")));
                                      }
                                    else
                                      {
                                        if(GetLocalInt(GetObjectByTag("room5counter"), "exitcounter") == 3)
                                            {
                                                AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r9_to_r5"))));
                                                SetLocalInt(GetObjectByTag("room10counter"), "exitcounter", 3);
                                                DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room10counter")), 6.0));
                                                DelayCommand(1.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_crank1")));
                                                DelayCommand(5.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_boomdist2")));
                                                DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10npit_snd")));
                                                DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10spit_snd")));
                                                DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10epit_snd")));
                                                DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10wpit_snd")));
                                            }
                                      }
                                }
                        }
                }
              else
                {
                    if(GetLocalInt(GetObjectByTag("room10counter"), "exitcounter") == 3)
                        {
                            AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r10_to_rspike"))));
                            SetLocalInt(GetObjectByTag("room10counter"), "exitcounter", 0);
                            DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room10counter")), 6.0));
                            DelayCommand(1.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_crank1")));
                            DelayCommand(5.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_boomdist2")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10epit_snd")));
                            DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10wpit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10npit_snd")));
                            DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10spit_snd")));
                        }
                      else
                        {
                            if(GetLocalInt(GetObjectByTag("room10counter"), "exitcounter") == 0)
                                {
                                    AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("wp_r10_to_a1"))));
                                    SetLocalInt(GetObjectByTag("room10counter"), "exitcounter", 1);
                                    DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eRoomgear, GetLocation(GetObjectByTag("room10counter")), 6.0));
                                    DelayCommand(1.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_crank1")));
                                    DelayCommand(5.0, AssignCommand(GetObjectByTag("room10counter"), PlaySound("as_cv_boomdist2")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10npit_snd")));
                                    DelayCommand(3.0, SoundObjectPlay(GetObjectByTag("ty_r10spit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10epit_snd")));
                                    DelayCommand(3.0, SoundObjectStop(GetObjectByTag("ty_r10wpit_snd")));
                                }
                        }
                }
         }
}