i don't know mutch about scripting, but you are asking the script if the variable is both a string and a integer, try using or instead of and, because the variable can't be both a string and an interger at the same time.
when using and, all the options connected by and must be true, when using or, only one must be for it to return true, e.g.
if q == 10 and 11 #dosent work ever, will never be true
if q == 10 or 11 #will be true if value of q is 10 or 11
that's the basics as i know them, may be wrong, but i'm pretty sure that's your problem, if it dosen't work, someone else will have to help you.