Creating Function! Not working Properly

int buttonCommand(byte button, byte led, byte val, byte old_val, byte state)

Is that button state? The pin that the button is sewn onto?

    val = digitalRead(button);

Why are you overwriting the input argument?

When your function ends, any changes it made to variables will be lost.

You lied when you said the function would return an int.