Once you get your code formatted so that it is easier to read, then there are 3 (maybe more) areas you need to figure out:
- How to format up the message to send to the Arduino. It looks like you've decided on semi-colon separated values. What determines whether the i/o pin should be high or low? Do you send the same pin number again - i.e. toggle it. What about sending an ASCII hexadecimal string (so it's human readable -ish). You can encode 4 pins in 0-9 & A-F.
- How will the Arduino detect the start of a new packet of data? There's a forum topic called Serial Input Basics which may help you out as mentioned by @groundFungus
- How are you going to update the pins on the Arduino. You could update every pin each time round or are you only going to update a pin that has been told to change state?