How to make Arduino execute a code according to stages

Im working on an Arduino controlled motorised time-lapse dolly and I'm trying to make the code as simple as possible. So far i can see what i wrote working well but i have two problems.
To start, this is part of the code:

 while(stage1 == 1023 && stage2 == 0)
 {
  int shutterIntervalVal = analogRead(knob);
  int shutterInterval = map(shutterIntervalVal,0,1023,0,120);
       shutterInterval = int(shutterInterval +0.5);
            lcd.setCursor(0,0);
            lcd.print("Set interval");
  delay(500);
            lcd.setCursor(0,1);
            lcd.print(shutterInterval);
        Serial.println(shutterInterval);
  delay(1);
            if(confirmBut == 1023){
                          int const offShutterInterval = shutterInterval;
                          lcd.clear();}

stage1 and stage2 are two switches in a 3-way-switch connected to analog pins(i was running out of digital pins)

Pretty simple.. And when uploaded alone works perfectly.
Yet, when i upload it with the other 2 stages which are almost the same way written with different conditions, the Arduino starts mixing up the 3 stages and running them crazy!
So how can i make the Arduino split them up to 3 different stages according to the change in conditions.
Another concern i have is for when the confirm button is pressed i need the arduino to store the value at that instant because i will use it in the third stage. So does it stay stored or should i use an alternative way?
Thankyou for your time

FULL CODE:

#include <LiquidCrystal.h>
#include <Stepper.h>
#include <math.h>
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
      int const confirmBut = A3; // Confirm Button
      int const stage1 = A1; // 1st stage on switch
      int const stage2 = A2; // second stage on switch
      int const stepsPerRevolution = 200;
    Stepper motor(stepsPerRevolution, 7, 8, 9, 10);
      int stepCount = 0;
      int const knob = A0;
      int shutterInterval = 0;
      int offShutterInterval = 0;
      int offShutterSpeed = 0;
void setup() {
  lcd.begin(16,2);
  lcd.print("Welcome Mohamad");
  delay(1000);
  lcd.clear();
  Serial.begin(9600);
  motor.setSpeed(60); 
}

void loop() {
  Serial.println(analogRead(A1));
 if(stage1 == 1023 ||stage1 == 10  && stage2 < 1023)
 {
  int shutterIntervalVal = analogRead(knob);
  int shutterInterval = map(shutterIntervalVal,0,1023,0,120);
  shutterInterval = int(shutterInterval +0.5);
  lcd.setCursor(0,0);
  lcd.print("Set interval");
  delay(500);
  lcd.setCursor(0,1);
  lcd.print(shutterInterval);
  Serial.println(shutterInterval);
  delay(1);
  if(confirmBut == 1023){ int const offShutterInterval = shutterInterval;
                          lcd.clear();}
 }

else if(stage1 < 1023 && stage2 < 1023)
 {
  int shutterSpeedVal = analogRead(knob);
  int shutterSpeed = map(shutterSpeedVal,0,1023,0,10);
  shutterSpeed = int(shutterSpeed +0.5);
  lcd.setCursor(0,0);
  lcd.print("Set shutter speed");
  delay(500);
  lcd.setCursor(0,1);
  lcd.print(shutterSpeed);
  Serial.println(shutterSpeed);
  delay(1);
  if(confirmBut == 1023){ int offShutterSpeed = shutterSpeed; lcd.clear();}
 }
 
else if(stage1 < 1023 && stage2 == 1023)
 { int convShutterInterval = map(offShutterInterval,0,120,0,200); 
   convShutterInterval = int(convShutterInterval +0.5);
   motor.step(stepsPerRevolution);
  delay(offShutterSpeed + 100);}
  
}

I realised further more problems, i added serial print to the read on A1 which on closed switch should give a value of 1023 . But even when sometimes it gives 1023 the arduino skips and remains in stage 2. And also the number 10 keeps popping out in all the prints...
I need urgent help

I think if only one stage can be high at a time something like

if(stage1)
{
run stage 1
}
else if(stage2)
{
run stage 2
}
else if(stage99)
{
run stage 99
}

you can save a variable for use in multiple functions if you declare it a global variable, so it would need to be declared before the setup function.

always post all of your code.

int shutterInterval = map(shutterIntervalVal,0,1023,0,120);

map is lame.

shutterInterval = int(shutterInterval +0.5);

This does nothing useful.
Adding 0.5 to an int, and then casting back to an int, does nothing at all. (Unless the int is negative,but that doesn't concern you.)

I think you want something more like:

int shutterInterval = (((shutterIntervalVal*240L)/1023)+1)/2;

I have not tested your code but this looks dubious to me :

if(stage1 == 1023 ||stage1 == 10  && stage2 < 1023)

I am not sure what the default behaviour would be, but I would suggest you need at least one set of extra "()" to be sure of what you are going to get.

So either

if((stage1 == 1023 ||stage1 == 10)  && stage2 < 1023)

or

if(stage1 == 1023 || (stage1 == 10  && stage2 < 1023))

I imagine the second option is more likely what you are trying to achieve.

You can, in fact, use analog pins as digital pins.

From https://www.arduino.cc/en/Reference/DigitalRead:

The analog input pins can be used as digital pins, referred to as A0, A1, etc.