#include <define.h>

//#define NAME                    SCRIPT_

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



procedure start;
#include <push.h>
procedure use_stuff;
procedure pick_lock;

variable unlocked;


procedure start
begin
	if ((script_action == look_at_proc) or (script_action == description_proc)) then begin
		script_overrides;
		display_msg(message_str(SCRIPT_MVRCRDOR, 100));
	end
	else begin
		if (script_action == use_proc) then begin
			call use_stuff;
		end
		else begin
			if (script_action == use_obj_on_proc) then begin
				if (obj_pid(obj_being_used_with) == 77) then begin
					call pick_lock;
				end
			end
		end
	end
end

procedure use_stuff
begin
	if (not(unlocked)) then begin
		script_overrides;
		display_msg(message_str(SCRIPT_MVRCRDOR, 101));
	end
end

procedure pick_lock
begin
	script_overrides;
	if (unlocked) then begin
		display_msg(message_str(SCRIPT_MVRCRDOR, 102));
	end
	else begin
		if (is_success(roll_vs_skill(dude_obj, 9, -20))) then begin
			display_msg(message_str(SCRIPT_MVRCRDOR, 103));
			unlocked := 1;
		end
		else begin
			display_msg(message_str(SCRIPT_MVRCRDOR, 104));
		end
	end
end