on *:Text!~:#: { if (%stage5 == on) {
You type !~ for the last symbol. It should work.
ermm actualy your command is wrong it should be on *:Text:!~:#: { also !proceed_into_castle and !climb_ladder triggers do not work