procedure start;
procedure map_enter_p_proc;
procedure map_update_p_proc;
procedure look_at_p_proc;
procedure use_p_proc;
procedure use_obj_on_p_proc;
procedure use_skill_on_p_proc;
procedure timed_event_p_proc;
import variable Door_ptr;
import variable Cabbot_Ptr;
procedure start
begin
if (script_action == 15) then begin
call map_enter_p_proc;
end
else begin
if (script_action == 23) then begin
call map_update_p_proc;
end
else begin
if (script_action == 21) then begin
call look_at_p_proc;
end
else begin
if (script_action == 6) then begin
call use_p_proc;
end
else begin
if (script_action == 7) then begin
call use_obj_on_p_proc;
end
else begin
if (script_action == 8) then begin
call use_skill_on_p_proc;
end
else begin
if (script_action == 22) then begin
call timed_event_p_proc;
end
end
end
end
end
end
end
end
procedure map_enter_p_proc
begin
Door_ptr := self_obj;
if (obj_is_open(self_obj)) then begin
add_timer_event(self_obj, game_ticks(1), 1);
end
end
procedure map_update_p_proc
begin
Door_ptr := self_obj;
end
procedure look_at_p_proc
begin
if ((global_var(108) == 2) and (local_var(0) == 0)) then begin
display_msg(message_str(526, 102));
end
else begin
display_msg(message_str(526, 100));
end
end
procedure use_p_proc
begin
if ((global_var(108) != 2) and (local_var(0) == 0)) then begin
if (source_obj != Cabbot_Ptr) then begin
script_overrides;
set_map_var(0, map_var(0) + 1);
display_msg(message_str(526, 104));
end
end
end
procedure use_obj_on_p_proc
begin
variable LVar0 := 0;
variable LVar1 := 0;
LVar0 := obj_being_used_with;
LVar1 := roll_vs_skill(dude_obj, 9, -50);
if (global_var(108) != 2) then begin
set_map_var(0, map_var(0) + 1);
end
if (obj_pid(LVar0) == 77) then begin
script_overrides;
if (is_success(LVar1)) then begin
if (global_var(108) != 2) then begin
set_map_var(0, map_var(0) + 2);
end
set_local_var(0, 1);
display_msg(message_str(63, 100));
display_msg(message_str(766, 103) + "75" + message_str(766, 104));
give_exp_points(75);
end
else begin
if (is_critical(LVar1)) then begin
rm_obj_from_inven(dude_obj, LVar0);
destroy_object(LVar0);
jam_lock(self_obj);
display_msg(message_str(63, 101));
end
else begin
display_msg(message_str(63, 103));
end
end
end
end
procedure use_skill_on_p_proc
begin
variable LVar0 := 0;
if (global_var(108) != 2) then begin
set_map_var(0, map_var(0) + 1);
end
if (local_var(0) == 0) then begin
if (action_being_used == 9) then begin
script_overrides;
LVar0 := roll_vs_skill(dude_obj, 9, -70);
if (is_success(LVar0)) then begin
set_local_var(0, 1);
if (global_var(108) != 2) then begin
set_map_var(0, map_var(0) + 2);
set_global_var(250, 1);
end
display_msg(message_str(63, 100));
give_exp_points(75);
display_msg(message_str(766, 103) + "75" + message_str(766, 104));
end
else begin
if (is_critical(LVar0)) then begin
jam_lock(self_obj);
display_msg(message_str(63, 110));
end
else begin
display_msg(message_str(63, 103));
end
end
end
end
else begin
display_msg(message_str(63, 109));
end
end
procedure timed_event_p_proc
begin
set_local_var(0, 0);
obj_close(self_obj);
end