#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;

variable initialized1;

import variable radio_computer;


procedure start
begin
	if (not(initialized1)) then begin
		radio_computer := self_obj;
		initialized1 := 1;
	end
	else begin
		if (script_action == description_proc) then begin
			call description_p_proc;
		end
		else begin
			if (script_action == use_proc) then begin
				call use_p_proc;
			end
		end
	end
end

procedure description_p_proc
begin
	variable LVar0 := 0;
	LVar0 := message_str(SCRIPT_RADIOCOM, 100);
	if (is_success(do_check(dude_obj, 1, has_trait(0, dude_obj, 0)))) then begin
		if (global_var(GVAR_RADIO_COMPUTER_OFF)) then begin
			LVar0 := LVar0 + message_str(SCRIPT_RADIOCOM, 101);
		end
		else begin
			LVar0 := LVar0 + message_str(SCRIPT_RADIOCOM, 102);
		end
	end
	display_msg(LVar0);
end

procedure use_p_proc
begin
	if (source_obj == dude_obj) then begin
		if (is_success(roll_vs_skill(dude_obj, 12, 0))) then begin
			if (global_var(GVAR_RADIO_COMPUTER_OFF)) then begin
				display_msg(message_str(SCRIPT_RADIOCOM, 103));
				set_global_var(GVAR_RADIO_COMPUTER_OFF, 0);
			end
			else begin
				display_msg(message_str(SCRIPT_RADIOCOM, 104));
				set_global_var(GVAR_RADIO_COMPUTER_OFF, 1);
			end
		end
		else begin
			display_msg(message_str(SCRIPT_RADIOCOM, 105));
		end
	end
	else begin
		set_global_var(GVAR_RADIO_COMPUTER_OFF, 1);
	end
end