Using Serial imput to run a code

sorry about not posting the code earlier, was trying to decide how to post it because it was over sized. I will have to post links in the future due to the character limit.