![]() |
This is the transcript of a script file, which runs certain tasks in the game upon execution. |
---|
Details | |
---|---|
Type | Decompiled script |
SCRIPTS.LST comment | Saul, local_vars=0 |
MSG file | SAUL.MSG |
/*******************************************************
- Some unreferenced imported varables found. *
- Because of it it is impossible to specify *
- the real names of global variables. *
- /
- /
variable GVar0;
variable GVar1;
variable GVar2;
variable GVar3;
variable GVar4;
variable GVar5;
variable GVar6;
variable GVar7;
variable GVar8;
variable GVar9;
variable GVar10;
variable GVar11;
variable GVar12;
procedure start;
procedure combat_p_proc;
procedure critter_p_proc;
procedure description_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure map_enter_p_proc;
procedure map_update_p_proc;
procedure talk_p_proc;
procedure timed_event_p_proc;
procedure damage_p_proc;
procedure Saul06;
procedure Saul07;
procedure Saul08;
procedure Saul09;
procedure Saul10;
procedure Saul11;
procedure Saul12;
procedure Saul13;
procedure Saul14;
procedure Saul15;
procedure Saul16;
procedure Saul17;
procedure Saul18;
procedure Saul18a;
procedure Saul19;
procedure Saul20;
procedure Saul21;
procedure Saul22;
procedure Saul23;
procedure Saul24;
procedure SaulBoxing;
procedure SaulCombat;
procedure SaulEnd;
procedure create_challenger;
procedure sleeping;
/* ?import? variable night_person; */
/* ?import? variable wake_time; */
/* ?import? variable sleep_time; */
/* ?import? variable home_tile; */
/* ?import? variable sleep_tile; */
/* ?import? variable hostile; */
/* ?import? variable initialized; */
/* ?import? variable round_counter; */
/* ?import? variable sleeping_disabled; */
/* ?import? variable challenger_hits; */
/* ?import? variable Saul_hits; */
/* ?import? variable whose_turn; */
import variable challenger_ptr;
import variable fight;
/* ?import? variable removal_ptr; */
import variable Saul_loses;
import variable Saul_wins;
procedure get_reaction;
procedure ReactToLevel;
procedure LevelToReact;
procedure UpReact;
procedure DownReact;
procedure BottomReact;
procedure TopReact;
procedure BigUpReact;
procedure BigDownReact;
procedure UpReactLevel;
procedure DownReactLevel;
procedure Goodbyes;
/* ?import? variable exit_line; */
procedure start
begin
if (script_action == 13) then begin
call combat_p_proc;
end
else begin
if (script_action == 12) then begin
call critter_p_proc;
end
else begin
if (script_action == 3) then begin
call description_p_proc;
end
else begin
if (script_action == 18) then begin
call destroy_p_proc;
end
else begin
if (script_action == 21) then begin
call look_at_p_proc;
end
else 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 == 11) then begin
call talk_p_proc;
end
else begin
if (script_action == 22) then begin
call timed_event_p_proc;
end
end
end
end
end
end
end
end
end
end
procedure combat_p_proc
begin
if ((fixed_param == 4) and obj_can_see_obj(self_obj, dude_obj)) then begin
GVar7 := GVar7 + 1;
end
if (GVar7 > 3) then begin
if (global_var(247) == 0) then begin
set_global_var(247, 1);
set_global_var(155, global_var(155) - 5);
end
end
end
procedure critter_p_proc
begin
if (GVar5) then begin
GVar5 := 0;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
else begin
if (cur_map_index == 11) then begin
if (fight) then begin
fight := 0;
GVar10 := 0;
GVar9 := 0;
anim(self_obj, 1000, 1);
if (obj_can_see_obj(dude_obj, self_obj)) then begin
gfade_out(600);
call create_challenger;
gfade_in(600);
end
else begin
call create_challenger;
end
add_timer_event(self_obj, game_ticks(1), 1);
end
end
if (GVar8 == 0) then begin
call sleeping;
end
end
if (global_var(247) == 1) then begin
if (obj_can_see_obj(self_obj, dude_obj)) then begin
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
end
end
procedure description_p_proc
begin
if (is_success(do_check(dude_obj, 1, has_trait(0, dude_obj, 0)))) then begin
display_msg(message_str(528, 102));
end
end
procedure destroy_p_proc
begin
if (source_obj == dude_obj) then begin
set_global_var(247, 1);
if (source_obj == dude_obj) then begin
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
set_global_var(156, 1);
set_global_var(157, 0);
end
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(157) == 1))) then begin
set_global_var(157, 1);
set_global_var(156, 0);
end
set_global_var(159, global_var(159) + 1);
if ((global_var(159) % 2) == 0) then begin
set_global_var(155, global_var(155) - 1);
end
end
end
set_global_var(169, 3);
end
procedure look_at_p_proc
begin
script_overrides;
if (not(global_var(169))) then begin
display_msg(message_str(528, 101));
end
else begin
display_msg(message_str(528, 100));
end
end
procedure map_enter_p_proc
begin
variable LVar0 := 0;
if (global_var(15) == 1) then begin
LVar0 := create_object_sid(234, 0, 0, -1);
add_obj_to_inven(self_obj, LVar0);
kill_critter(self_obj, 48);
end
GVar8 := 0;
GVar2 := 2000;
GVar1 := 700;
if (cur_map_index == 11) then begin
GVar4 := 7000;
if ((game_time / (10 * 60 * 60 * 24) % 3) == 0) then begin
GVar3 := 15094;
end
else begin
GVar3 := 16892;
end
end
if (global_var(169) == 3) then begin
destroy_object(self_obj);
end
move_to(self_obj, GVar3, 0);
end
procedure map_update_p_proc
begin
if (not(combat_is_initialized)) then begin
if ((game_time / (10 * 60 * 60 * 24) % 3) == 0) then begin
GVar3 := 15094;
end
else begin
GVar3 := 16892;
end
move_to(self_obj, GVar3, 0);
if (local_var(8) == 1) then begin
set_local_var(8, 0);
reg_anim_animate(self_obj, 0, 0);
end
call sleeping;
end
end
procedure talk_p_proc
begin
call get_reaction;
if (local_var(4)) then begin
float_msg(self_obj, message_str(185, 166), 0);
end
else begin
if (critter_state(self_obj) bwand 1) then begin
display_msg(message_str(528, 115));
end
else begin
if (global_var(247)) then begin
float_msg(self_obj, message_str(669, 104), 2);
end
else begin
if ((obj_item_subtype(critter_inven_obj(dude_obj, 1)) == 3) or (obj_item_subtype(critter_inven_obj(dude_obj, 2)) == 3)) then begin
call Saul06;
end
else begin
start_gdialog(528, self_obj, 4, -1, -1);
gsay_start;
if (global_var(169)) then begin
call Saul23;
end
else begin
call Saul07;
end
gsay_end;
end_dialogue;
end
end
end
end
if (not(global_var(557) bwand 16) and (global_var(557) bwand 8)) then begin
set_global_var(557, global_var(557) + 16);
display_msg(message_str(342, 173));
give_exp_points(250);
end
end
procedure timed_event_p_proc
begin
if (fixed_param == 1) then begin
if (obj_pid(challenger_ptr) == 16777227) then begin
if (random(0, 4) == 0) then begin
GVar11 := 1;
end
else begin
GVar11 := 0;
end
end
else begin
if (random(0, 2)) then begin
GVar11 := 1;
end
else begin
GVar11 := 0;
end
end
call SaulBoxing;
end
else begin
if (fixed_param == 2) then begin
Saul_wins := 1;
end
else begin
if (fixed_param == 3) then begin
Saul_loses := 1;
set_local_var(8, 1);
end
end
end
end
procedure damage_p_proc
begin
if (source_obj == dude_obj) then begin
set_global_var(247, 1);
end
end
procedure Saul06
begin
float_msg(self_obj, message_str(528, 104), 2);
end
procedure Saul07
begin
if (local_var(1) == 1) then begin
gsay_reply(528, 105);
end
else begin
gsay_reply(528, 106);
end
giq_option(4, 528, 107, Saul08, 50);
giq_option(4, 528, 108, Saul09, 51);
giq_option(4, 528, message_str(528, 109) + proto_data(obj_pid(dude_obj), 1) + message_str(528, 110), Saul09, 50);
end
procedure Saul08
begin
gsay_reply(528, 111);
giq_option(4, 528, 112, Saul09, 51);
giq_option(4, 528, 113, Saul11, 50);
giq_option(4, 528, 103, SaulEnd, 50);
end
procedure Saul09
begin
if (local_var(1) == 1) then begin
gsay_reply(528, 128);
end
else begin
gsay_reply(528, 129);
end
if (local_var(1) == 1) then begin
giq_option(4, 528, 130, Saul10, 50);
giq_option(4, 528, 188, SaulCombat, 51);
end
giq_option(4, 528, 131, Saul10, 50);
if (local_var(1) == 3) then begin
giq_option(4, 528, 135, Saul11, 50);
end
giq_option(4, 528, 132, SaulEnd, 50);
end
procedure Saul10
begin
if (local_var(1) == 1) then begin
gsay_reply(528, 133);
end
else begin
gsay_reply(528, 134);
end
giq_option(4, 528, 135, Saul11, 50);
giq_option(4, 528, 136, Saul12, 49);
giq_option(4, 528, 132, SaulEnd, 50);
end
procedure Saul11
begin
gsay_reply(528, 137);
giq_option(4, 528, 136, Saul12, 49);
if (not(local_var(5))) then begin
giq_option(4, 528, 138, Saul13, 50);
end
if (not(local_var(6))) then begin
giq_option(4, 528, 139, Saul14, 50);
end
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
procedure Saul12
begin
call UpReact;
if (local_var(1) == 1) then begin
gsay_reply(528, 140);
end
else begin
gsay_reply(528, 141);
giq_option(5, 528, 142, Saul15, 49);
end
giq_option(4, 528, 143, Saul13, 50);
giq_option(4, 528, 144, Saul14, 50);
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
procedure Saul13
begin
set_local_var(5, 1);
gsay_reply(528, 145);
giq_option(4, 528, 146, Saul19, 50);
giq_option(4, 528, 147, Saul14, 50);
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
procedure Saul14
begin
set_local_var(6, 1);
gsay_reply(528, 148);
if (not(local_var(5))) then begin
giq_option(4, 528, 149, Saul13, 50);
end
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
procedure Saul15
begin
set_local_var(7, 1);
gsay_reply(528, 150);
giq_option(4, 528, 151, Saul17, 50);
giq_option(4, 528, 152, Saul18, 50);
if (get_critter_stat(dude_obj, 4) >= 6) then begin
giq_option(6, 528, 153, Saul16, 49);
end
else begin
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
giq_option(6, 528, 154, Saul24, 50);
end
procedure Saul16
begin
call UpReact;
gsay_reply(528, 155);
giq_option(4, 528, 156, Saul18, 50);
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
procedure Saul17
begin
gsay_reply(528, 157);
giq_option(4, 528, 158, Saul18, 50);
if ((global_var(557) bwand 1) or (global_var(557) bwand 4)) then begin
giq_option(5, 528, 159, Saul20, 50);
end
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
procedure Saul18
begin
if (local_var(1) < 2) then begin
gsay_reply(528, 160);
end
else begin
gsay_reply(528, 161);
end
if (not(local_var(5))) then begin
giq_option(4, 528, 162, Saul13, 50);
end
if (not(local_var(6))) then begin
giq_option(4, 528, 163, Saul14, 50);
end
giq_option(4, 528, 164, Saul18a, 51);
giq_option(4, 528, 165, SaulEnd, 50);
end
procedure Saul18a
begin
set_local_var(1, 1);
call LevelToReact;
call Saul09;
end
procedure Saul19
begin
gsay_reply(528, 166);
giq_option(4, 528, 168, Saul18, 50);
if (get_critter_stat(dude_obj, 4) >= 6) then begin
giq_option(6, 528, 167, UpReact, 49);
end
else begin
call Goodbyes;
giq_option(4, 528, 169, SaulEnd, 50);
end
end
procedure Saul20
begin
if (local_var(1) == 1) then begin
gsay_reply(528, 169);
end
else begin
if (is_success(roll_vs_skill(dude_obj, 14, 0))) then begin
gsay_reply(528, message_str(528, 170) + message_str(528, 171));
if (get_critter_stat(dude_obj, 4) >= 6) then begin
giq_option(6, 528, 172, Saul21, 49);
end
else begin
giq_option(4, 528, 173, Saul22, 50);
end
end
else begin
gsay_reply(528, message_str(528, 170));
end
end
giq_option(4, 528, 174, Saul18, 50);
giq_option(4, 528, 175, SaulEnd, 50);
end
procedure Saul21
begin
call UpReact;
set_global_var(557, global_var(557) + 8);
gsay_message(528, 176, 49);
end
procedure Saul22
begin
if (is_success(roll_vs_skill(dude_obj, 14, 0))) then begin
call Saul21;
end
else begin
gsay_reply(528, 177);
giq_option(4, 528, 178, Saul18, 50);
giq_option(4, 528, 179, SaulEnd, 50);
end
end
procedure Saul23
begin
if (local_var(1) < 2) then begin
gsay_reply(528, 180);
end
else begin
gsay_reply(528, 181);
end
giq_option(4, 528, 182, Saul09, 51);
if ((global_var(557) bwand 1) or (global_var(557) bwand 4) and not(global_var(557) bwand 8)) then begin
giq_option(4, 528, 183, Saul20, 50);
end
if (not(local_var(5))) then begin
giq_option(4, 528, 184, Saul13, 50);
end
call Goodbyes;
giq_option(4, 528, GVar12, SaulEnd, 50);
end
procedure Saul24
begin
gsay_reply(528, 185);
giq_option(4, 528, 186, SaulEnd, 0);
giq_option(4, 528, 187, Saul18, 0);
end
procedure SaulBoxing
begin
reg_anim_func(2, self_obj);
reg_anim_func(2, challenger_ptr);
if (GVar11 == 1) then begin
reg_anim_func(1, 1);
reg_anim_animate(self_obj, 16, -1);
if (is_success(roll_vs_skill(self_obj, 3, 0))) then begin
if (GVar9 >= (get_critter_stat(challenger_ptr, 2) * 2)) then begin
reg_anim_animate(challenger_ptr, 20, 4);
reg_anim_animate(challenger_ptr, 48, -1);
add_timer_event(self_obj, game_ticks(2), 2);
end
else begin
reg_anim_animate(challenger_ptr, 14, 4);
GVar9 := GVar9 + 1;
add_timer_event(self_obj, game_ticks(random(1, 2)), 1);
end
end
else begin
reg_anim_animate(challenger_ptr, 13, 4);
add_timer_event(self_obj, game_ticks(random(1, 2)), 1);
end
reg_anim_func(3, 0);
end
else begin
reg_anim_func(1, 1);
reg_anim_animate(challenger_ptr, 16, -1);
if (is_success(roll_vs_skill(challenger_ptr, 3, 0))) then begin
if (GVar10 >= (get_critter_stat(self_obj, 2) * 2)) then begin
reg_anim_animate(self_obj, 20, 4);
reg_anim_animate(self_obj, 48, -1);
add_timer_event(self_obj, game_ticks(2), 3);
end
else begin
reg_anim_animate(self_obj, 14, 4);
GVar10 := GVar10 + 1;
add_timer_event(self_obj, game_ticks(random(1, 2)), 1);
end
end
else begin
reg_anim_animate(self_obj, 13, 4);
add_timer_event(self_obj, game_ticks(random(1, 2)), 1);
end
reg_anim_func(3, 0);
end
end
procedure SaulCombat
begin
GVar5 := 1;
end
procedure SaulEnd
begin
end
procedure create_challenger
begin
challenger_ptr := random(0, 4);
if (challenger_ptr == 4) then begin
challenger_ptr := create_object_sid(16777226, 0, 0, 25);
end
else begin
if (challenger_ptr == 3) then begin
challenger_ptr := create_object_sid(16777227, 0, 0, 25);
end
else begin
if (challenger_ptr == 2) then begin
challenger_ptr := create_object_sid(16777238, 0, 0, 25);
end
else begin
if (challenger_ptr == 1) then begin
challenger_ptr := create_object_sid(16777218, 0, 0, 25);
end
else begin
if (challenger_ptr == 0) then begin
challenger_ptr := create_object_sid(16777243, 0, 0, 25);
end
end
end
end
end
critter_attempt_placement(challenger_ptr, tile_num_in_direction(tile_num(self_obj), 1, 1), 0);
anim(challenger_ptr, 1000, 4);
end
procedure sleeping
begin
if (local_var(4) == 1) then begin
if (not(GVar0) and (game_time_hour >= GVar1) and (game_time_hour < GVar2) or (GVar0 and ((game_time_hour >= GVar1) or (game_time_hour < GVar2)))) then begin
if (((game_time_hour - GVar1) < 10) and ((game_time_hour - GVar1) > 0)) then begin
if (tile_num(self_obj) != GVar3) then begin
animate_move_obj_to_tile(self_obj, GVar3, 0);
end
else begin
set_local_var(4, 0);
end
end
else begin
move_to(self_obj, GVar3, elevation(self_obj));
if (tile_num(self_obj) == GVar3) then begin
set_local_var(4, 0);
end
end
end
end
else begin
if (GVar0 and (game_time_hour >= GVar2) and (game_time_hour < GVar1) or (not(GVar0) and ((game_time_hour >= GVar2) or (game_time_hour < GVar1)))) then begin
if (((game_time_hour - GVar2) < 10) and ((game_time_hour - GVar2) > 0)) then begin
if (tile_num(self_obj) != GVar4) then begin
animate_move_obj_to_tile(self_obj, self_obj, 0);
end
else begin
set_local_var(4, 1);
end
end
else begin
if (tile_num(self_obj) != GVar4) then begin
move_to(self_obj, GVar4, elevation(self_obj));
end
else begin
set_local_var(4, 1);
end
end
end
end
end
procedure get_reaction
begin
if (local_var(2) == 0) then begin
set_local_var(0, 50);
set_local_var(1, 2);
set_local_var(2, 1);
set_local_var(0, local_var(0) + (5 * get_critter_stat(dude_obj, 3)) - 25);
set_local_var(0, local_var(0) + (10 * has_trait(0, dude_obj, 10)));
if (has_trait(0, dude_obj, 39)) then begin
if (global_var(155) > 0) then begin
set_local_var(0, local_var(0) + global_var(155));
end
else begin
set_local_var(0, local_var(0) - global_var(155));
end
end
else begin
if (local_var(3) == 1) then begin
set_local_var(0, local_var(0) - global_var(155));
end
else begin
set_local_var(0, local_var(0) + global_var(155));
end
end
if (global_var(158) > 2) then begin
set_local_var(0, local_var(0) - 30);
end
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(157) == 1))) then begin
set_local_var(0, local_var(0) + 20);
end
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
set_local_var(0, local_var(0) - 20);
end
call ReactToLevel;
end
end
procedure ReactToLevel
begin
if (local_var(0) <= 25) then begin
set_local_var(1, 1);
end
else begin
if (local_var(0) <= 75) then begin
set_local_var(1, 2);
end
else begin
set_local_var(1, 3);
end
end
end
procedure LevelToReact
begin
if (local_var(1) == 1) then begin
set_local_var(0, random(1, 25));
end
else begin
if (local_var(1) == 2) then begin
set_local_var(0, random(26, 75));
end
else begin
set_local_var(0, random(76, 100));
end
end
end
procedure UpReact
begin
set_local_var(0, local_var(0) + 10);
call ReactToLevel;
end
procedure DownReact
begin
set_local_var(0, local_var(0) - 10);
call ReactToLevel;
end
procedure BottomReact
begin
set_local_var(1, 1);
set_local_var(0, 1);
end
procedure TopReact
begin
set_local_var(0, 100);
set_local_var(1, 3);
end
procedure BigUpReact
begin
set_local_var(0, local_var(0) + 25);
call ReactToLevel;
end
procedure BigDownReact
begin
set_local_var(0, local_var(0) - 25);
call ReactToLevel;
end
procedure UpReactLevel
begin
set_local_var(1, local_var(1) + 1);
if (local_var(1) > 3) then begin
set_local_var(1, 3);
end
call LevelToReact;
end
procedure DownReactLevel
begin
set_local_var(1, local_var(1) - 1);
if (local_var(1) < 1) then begin
set_local_var(1, 1);
end
call LevelToReact;
end
procedure Goodbyes
begin
GVar12 := message_str(634, random(100, 105));
end