Serial input -> Action

I'm basically looking for Arduino to take a bunch of numbers from Processing and convert them into actions.

So, currently 4 accounts that output 4 numbers, formatted from Processing like this 'Account1 0, Account2 0, Account3 0, Account4 0'.

The numbers are between 0 to 18. The higher the number is, the longer the action will go on for.

When I serial.write() the account and numbers to the Arduino, the sketch will through a bunch of if statements like:

if (incomingData == Account1, 3){
	do something for 3000ms
}

if (incomingData == Account2, 16){
	do something else for 16000ms
}
if (incomingData == Account3, 5){
	do something else for 5000ms
}

if (incomingData == Account4, 0){
	don't do anything
}
}

This could get messy and long and I'm sure theres a better way of going about this.

Any help?

This could get messy and long

Not to mention being flat out wrong.

if (incomingData == Account1, 3){

The array address, incomingData, will never equal whatever it is Account1 is. The ,3 on the end is flat wrong.

If the AccountN values are always sent in order, read and store all 4 values, using start and end of packet markers to know where a packet starts and ends, and just use the 4 values in the order received.

Yeah I realise its not going to work. It was more a reference to help explain what I want to do.

Has anyone got any code reference that I could start from?

Thanks for your tips though Paul.