How to pass a variable to a function?

I'm bored asking to see all of your code now, so I won't do it again

Exactly. Snippets-are-us is down the road a ways. If you want to post just snippets, go there. If you want help here, post all of your code, AND the exact error messages.