Difficulty building an alarm clock program

I am trying to write a program to control a light and a pump. I will be triggering them with relays, and I would like to be able to set the turn on times and turn off times.
so far I have figured out how to display the current time using a RTC, and move through the alarm settings. I can't quite figure out how to create a variable that can be changed after the project is completed and use that variable to trigger the arduino to bring a pin high or low. I am also at a bit of loss on how to search for help on that particuliar subject. If anyone can point me in the right direction on where to find the answer or even some code that would do this I would be thankful.
Here is the code that I have so far, some is copied, and the rest I wrote from looking at the reference section.
Thanks.

#include <LiquidCrystal.h>
#include <Wire.h>
#include "RTClib.h"

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

RTC_DS1307 RTC;

int setupbutton = 2, adjustbutton = 3; //Creates a variable connected to pins 2 and 3

int setmode = 0; 

void setup () {
  
   
    lcd.begin(16, 2);
    Wire.begin();
    RTC.begin();

}
 
void loop () {
  
   
  
 if (digitalRead(setupbutton) == HIGH) //If setbutton is pressed
  {
    setmode++; //Changes the mode
    delay(200); //wait so as not to move through settings too fast
    if (setmode == 5) //Resets it if the user has scrolled through all settings
    {
      setmode = 0;
    }
  }
  
  if (setmode == 0) // If the user is not in a alarm setting mode
  {
    lcd.setCursor(0, 0);
  lcd.print("Current Time    ");
  }
  if (setmode == 1) // Setting an alarm on
  {
    lcd.setCursor(0,0);
    lcd.print("Setting Sched 1A");
  }
  if (setmode == 2)
  {
    lcd.setCursor(0,0);
    lcd.print("Setting Sched 1B"); // Setting an alarm off
  }
  if (setmode == 3)
  {
    lcd.setCursor(0,0);
    lcd.print("Setting Sched 2A"); // Setting an alarm on
  }
  if (setmode == 4)
  {
    lcd.setCursor(0,0);
    lcd.print("Setting Sched 2B"); // Setting an alarm off
  }
  
    DateTime now = RTC.now();
    
  if (now.hour() < 10) //Starts the test to see if a space needs to be inserted before the hours
  {
    lcd.setCursor(0,1); //Sets the cursor for a blank
    lcd.print(" ");   //Blanks the first digit
    lcd.setCursor(1,1); //Sets the cursor for hour
    lcd.print(now.hour(), DEC); //Prints the hour  
  }
  else
  {
    lcd.setCursor(0,1); //Sets the cursor for hours
    lcd.print(now.hour(), DEC); //Prints the hour
  }
  
  lcd.setCursor(2,1); //Sets the cursor for first colon
  lcd.print(":");
  
  if (now.minute() < 10)
  {
    lcd.setCursor(3,1); //Sets the cursor for minutes
    lcd.print("0");
    lcd.setCursor(4,1);
    lcd.print(now.minute(), DEC);
  }
  else
  {
  lcd.setCursor(3,1);
  lcd.print(now.minute(), DEC);
  }
  
  lcd.setCursor(5,1); //Sets the cursor for seconds
  lcd.print(":");
  lcd.setCursor(6,1);
  lcd.print(now.second(), DEC);    
    
 if (now.second() == 0) // blanks out the space after a single digit "second"
 {
   lcd.setCursor(7,1);
   lcd.print(" ");
 }

 





}

You have made a good start by using the setmode variable so that you can distinguish what you are doing after the setup button is pressed. Personally I would use switch/case to differentiate the actions to be taken for each state as I find it easier to read and maintain than lots of if statements, but that is a matter of personal choice,

As to the code needed to input the alarm times, that can be as simple as reading 2 other buttons, one of which increases the value being set and the other that decreases it. Realistically you need at least 2 variables for each alarm event, hours and minutes, so you need to be able to move between them when setting an alarm time. How many buttons do you have ? If you have 5 buttons they could be used as follows :

Setup - moves to the next setup state
Up - increases the current alarm digit (hour or minute)
Down - decreases the current alarm digit (hour or minute)
Right and Left - switch between setting hour and setting minute

Once you have the alarm start and end hours and minutes in separate variables for each alarm on/off time you can use the TimeAlarms library to actually manage the alarms and cause actions when the alarm is triggered.

Thank you very much for suggesting switch/case, up until you mentioned it I hadn't heard of it at all. I'll be playing with it now. Also I am putting in the variable as you have mentioned for setting alarms. Your input has helped me a lot and I will be learning a bunch more before posting back here.