implement fail_flag, give_flag, and script_link