Dreamora #1 Endif is missing after the "you lose" repeat part. You have a new if there but no endif to close the KEY_N if block for that reason the last until can't be recognized as well.