#include <define.h>

//#define NAME                    SCRIPT_

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



procedure start;
#include <push.h>
procedure description_p_proc;
procedure use_p_proc;
procedure use_obj_on_p_proc;


procedure start
begin
	if (script_action == description_proc) then begin
		call description_p_proc;
	end
	else begin
		if (script_action == use_proc) then begin
			call use_obj_on_p_proc;
		end
		else begin
			if (script_action == use_obj_on_proc) then begin
				call use_obj_on_p_proc;
			end
		end
	end
end

procedure description_p_proc
begin
	if (obj_pid(self_obj) != 33555334) then begin
		script_overrides;
		display_msg(message_str(SCRIPT_ROPE, 104));
	end
end

procedure use_p_proc
begin
	script_overrides;
	if (obj_pid(self_obj) == 33555334) then begin
		move_to(dude_obj, 23118, 1);
	end
	else begin
		display_msg(message_str(SCRIPT_ROPE, 104));
	end
end

procedure use_obj_on_p_proc
begin
	variable LVar0 := 0;
	if (obj_pid(obj_being_used_with) == 127) then begin
		script_overrides;
		if (obj_pid(self_obj) != 33555334) then begin
			set_local_var(0, 1);
			rm_obj_from_inven(dude_obj, obj_being_used_with);
			LVar0 := create_object_sid(33555334, tile_num(self_obj), elevation(self_obj), 200);
			display_msg(message_str(SCRIPT_ROPE, 105));
			destroy_object(obj_being_used_with);
			destroy_object(self_obj);
		end
		else begin
			display_msg(message_str(SCRIPT_ROPE, 106));
		end
	end
end