#include <define.h>

//#define NAME                    SCRIPT_

#include <command.h>
//#include <ModReact.h>



procedure start;
#include <push.h>
procedure do_stuff;
procedure do_skill;
procedure see_stuff;
procedure doorend;

variable lockpicks;
variable testa;


procedure start
begin
	variable LVar0 := 0;
	if (script_action == look_at_proc) then begin
		script_overrides;
		call see_stuff;
	end
	if (script_action == use_proc) then begin
		script_overrides;
		call do_stuff;
	end
	if (script_action == use_obj_on_proc) then begin
		lockpicks := obj_being_used_with;
		script_overrides;
		call do_skill;
	end
end

procedure do_stuff
begin
	display_msg(message_str(SCRIPT_SETDOOR1, 107));
end

procedure do_skill
begin
	if (has_skill(dude_obj, 9)) then begin
		testa := roll_vs_skill(dude_obj, 9, -10);
		if (is_success(testa)) then begin
			display_msg(message_str(SCRIPT_SETDOOR1, 100));
			set_local_var(0, 1);
		end
		else begin
			display_msg(message_str(SCRIPT_SETDOOR1, 101));
			if (is_critical(testa)) then begin
				display_msg(message_str(SCRIPT_SETDOOR1, 102));
				rm_obj_from_inven(dude_obj, lockpicks);
			end
		end
	end
	else begin
		display_msg(message_str(SCRIPT_SETDOOR1, 103));
	end
end

procedure see_stuff
begin
	if (local_var(0) == 0) then begin
		display_msg(message_str(SCRIPT_SETDOOR1, 104));
	end
	else begin
		if (local_var(2) == 1) then begin
			display_msg(message_str(SCRIPT_SETDOOR1, 105));
		end
		else begin
			display_msg(message_str(SCRIPT_SETDOOR1, 106));
		end
	end
end

procedure doorend
begin
end