I think that the best way to handle keeping track of in-game state, things like "player has completed this quest", is to have, in game state and saved off with the rest of the game state's information, a way to store values by name. The syntax/semantics might be something like this:
To set an info by name:
set_info("completed castle quest", true)
Then, for example in an on_interact:
if get_info("completed castle quest") then
say "Good job completing that quest!"
else
say "You'd better get busy with that castle quest!"
end