If statement executing even when conditionals are false.

250 < lightlevel < 800

This is semantically correct; is it syntactically correct from programming point of view?

lightlevel is a variable, and 250 is a constant value. The variable should be compared, and not the constant.

if (250 < lightlevel && lightlevel < 800)

It is clearly a programming language instruction. Therefore, it should be judged from both semantic and syntactic points of views. It is semantically correct as there is no ambiguity in the meaning; but, it is certainly syntactically wrong as we are comparing a constant against a variable. The variable lightlevel should be greater than 250 AND should be less than 800 for the next course of action to have taken place.