You don't actually need a script. You can just specify the conditions using Conditional Formatting. For instance, Table::Field = "Yes", then you can format the button with different fill or text colors (or other options). In a script, you can do it with something like:
Set Variable $$ButtonColor = "Brown"
If you've added conditional formatting to the button such as:
$$ButtonColor = "Brown"
Then when the script is done running, the button will turn the brown you choose. You can add multiple conditional criteria, too.