What is wrong with this script?

Skynet

Mildly Dipped
When I try to compile this script, I get "Error! mismatched parenthesis"


Here's the code:


#include "..\headers\define.h"

#define NAME SCRIPT_BRENTON_JOHN

#include "..\headers\command.h"
#include "..\headers\ModReact.h"

procedure start;
procedure use_p_proc;
procedure look_at_p_proc;
procedure description_p_proc;
procedure use_skill_on_p_proc;
procedure use_obj_on_p_proc;
procedure damage_p_proc;
procedure map_enter_p_proc;
procedure map_update_p_proc;
procedure talk_p_proc;

#define LVAR_Herebefore (4)
#define LVAR_Hostile (5)
#define LVAR_Personal_Enemy (6)

procedure Node001;
procedure Node002;
procedure Node003;
procedure Node004;
procedure Node005a;
procedure Node005b;
procedure Node006;
procedure Node007a;
procedure Node007b;
procedure Node999; // Exit dialog
procedure Node998; // Combat



procedure start begin
end

procedure timed_event_p_proc begin
end

procedure use_p_proc begin
end

procedure look_at_p_proc begin
script_overrides;
if (local_var(LVAR_Herebefore) == 0) then
display_msg(mstr(100));
else
display_msg(mstr(101));
end


procedure description_p_proc begin
script_overrides;
display_msg(mstr(102));
end

procedure use_skill_on_p_proc begin
end

procedure use_obj_on_p_proc begin
end

procedure damage_p_proc begin
end

procedure map_enter_p_proc begin
end

procedure map_update_p_proc begin
end

procedure talk_p_proc begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_start;
call Node001;
gSay_end;
end_dialogue;
end

procedure Node001 begin
Reply(300);
NOption(301,Node002,4);
NOption(302,Node003,4);
NOption(303,Node999,4);
end

procedure Node002 begin
Reply(400);
NOption(401,Node003,4);
NOption(402,Node999,4);
end

procedure Node003 begin
Reply(403);
NOption(404,Node004,4);
NOption(405,Node999,4);
end

procedure Node004 begin
if ((obj_is_carrying_obj_pid(dude_obj,PID_HEART_PILLS)) then
call Node05a;
else
call Node05b;
end

procedure Node005a begin
Reply(406);
NOption(407,Node006,4);
NOption(408,Node999,4);
end

procedure Node005b begin
Reply(409);
NOption(410,Node999,4);
end

procedure Node006 begin
Reply(411);
NOption(412,Node007a,4);
NOption(413,Node007b,4);
NOption(414,Node999,4);
end

procedure Node007a begin

item:=obj_carrying_pid_obj(dude_obj, PID_HEART_PILLS);
rm_obj_from_inven(dude_obj,item);
add_obj_to_inven(self_obj,item);

Reply(415);
NOption(416,Node999,4);
end

procedure Node007b begin

item:=obj_carrying_pid_obj(dude_obj, PID_HEART_PILLS);
rm_obj_from_inven(dude_obj,item);
add_obj_to_inven(self_obj,item);

Reply(417);
NOption(418,Node998,4);
NOption(419,Node999,4);
end

procedure Node999 begin
end

procedure Node998 begin
attack(dude_obj);
end

procedure give_items begin
end





If I remove following line from Node004, it compiles ok.

if ((obj_is_carrying_obj_pid(dude_obj,PID_HEART_PILLS)) then
call Node05a;
else
call Node05b;


So, what's wrong with this?
 
if ((obj_is_carrying_obj_pid(dude_obj,PID_HEART_PILLS)) then
call Node05a;
else
call Node05b;

This bit, in the last part...

if ((obj_is_carrying_obj_pid(dude_obj,PID_HEART_PILLS))

Look at it again. You've got two parentheses after the "if", then a third after obj_pid, and only close off two.
 
The Couch Guy said:
if ((obj_is_carrying_obj_pid(dude_obj,PID_HEART_PILLS)) then
call Node05a;
else
call Node05b;

This bit, in the last part...

if ((obj_is_carrying_obj_pid(dude_obj,PID_HEART_PILLS))

Look at it again. You've got two parentheses after the "if", then a third after obj_pid, and only close off two.


Oops, that was a stupid mistake, I've also noted a few missing variables, but now it is fixed and it compiles the script. Thank you!
 
Back
Top