Multiple variables to arduino over serial

Hello everyone, I'm trying to write some code that will allow me to send multiple variables from a computer over serial (see variables at bottom of post). The problem that I'm having is that I don't want to send values for all the variables each time, for example one time send a packet with values for lin, lat, bspeed. Then another time send values for lin, lat, mspeed, temp, h.

The way I have tried to do it so far is using a different delimiter for each variable followed by its value but I cant even seem to get that to work on a small scale with just 2 variables (see code under variables) this code was supposed to recieve values for a and b in the form a3b2 then print them values back to me (in this case 3 and 2) but it is currently printing -1 when I send it a value meaning its not even reading a value.

I would like to write code that would allow me to send values in the form (in this case having a header H and footer . and sending 2 packets) :

Ha34b255c23d98.
Hb32e44f124i1002j27.

Is this feasible as I haven't been able to find any examples of sending serial data in this way (in varying lengths using delimiters to denote what each value is for)? Also am I taking the right approach?

Thanks, Saml91

variables to send:

Name Range Type
lin 0-1023 int
lat 0-1023 int
bspeed 0-255 int
tspeed 0-255 int
mspeed 0-255 int
temp 0-1023 int
h 0-255 int
cam 0-255 int
steer 0-255 int
bpos 0-255 int

Attempted code:

//recieving and sending back serial data
const char adel = 'a';
const char bdel = 'b'; //delimiters
char variablea=0;//variables
char variableb=0;
char bread;
boolean newvalue=true;//to only print to serial when values change

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  while( Serial.available() > 0){
  bread = Serial.read();
  switch(bread){
                case adel:
                variablea=Serial.read();
                newvalue=!newvalue;
                break;
                case bdel:
                variableb=Serial.read();
                newvalue=!newvalue;
                break;
  }
  
  }
  if(!newvalue){
Serial.print(" the variablea: ");
Serial.println(variablea);
Serial.print(" the variableb: ");
Serial.println(variableb);
newvalue=!newvalue;
  }
}

You show everything as being an int, so two bytes each. Several will just have 0 as the upper byte.
The identifier will be a 3rd byte.
Try changing to this, with the letters a thru j representing a data element.

byte upperByte;
byte lowerByte;
int incomingInt;
byte identByte;
void setup(){
  Serial.begin(9600);
}
void loop(){
  if (Serial.available()>2){ // 3 bytes received?
    identByte = Serial.read();
    switch(identByte){
    case 'a':
      upperByte = Serial.read();
      lowerByte = Serial.read();
      incomingInt = (upperByte<<8) + lowerByte; 
      Serial.print (identByte);
      Serial.println (incomingInt);
      break;
    case 'b':
      upperByte = Serial.read();
      lowerByte = Serial.read();
      incomingInt = (upperByte<<8) + lowerByte; 
      Serial.print (identByte);
      Serial.println (incomingInt);
      break;
      //:
      //:
    case 'i':
      upperByte = Serial.read();
      lowerByte = Serial.read();
      incomingInt = (upperByte<<8) + lowerByte; 
      Serial.print (identByte);
      Serial.println (incomingInt);
      break;
    case 'j':
      upperByte = Serial.read();
      lowerByte = Serial.read();
      incomingInt = (upperByte<<8) + lowerByte; 
      Serial.print (identByte);
      Serial.println (incomingInt);
      break;
    } // end switch
  } // end serial check
} // end loop

Thank you very much, I have now managed to understand this code and test it and it works perfectly.