Your if-conditions are wrong. Can you find the bug? It's in the first of the three comparisons.
A debugger is indeed useful in some cases. You can find a debugger script under "Tips&Tricks". If you can't see the bug at once, use the debugger for observing the values used for the if-conditions.