So I am trying to get this script to switch the lever to the right (East). The current script I have flips it to the left (West) every time, and if the lever is already facing left (West), then it doesn't touch the lever and just jumps through the portal. Is there any way to change it to have it flip the lever the other way?

Lever script:

--Check Lever
if topitem(32156,31125,10).id == 2773 then
useitem(2773,32156,31125,10)