Hook script help: RP 2.3.3 Source headers fail to compile?

Magnus

Water Chip? Been There, Done That
Modder
Hi all.
It's been many years since i did any scripting, and I'm trying to get back in it now.

I'm trying to compile a very simple hook script, with the version of sfall that comes with the RP:

Code:
procedure start;
#include "../headers/sfall.h"
#include "../headers/DEFINE.H"


procedure start begin
  variable type, aimed, i;
  if not init_hook then begin
    type:=get_sfall_arg;
    type:=get_sfall_arg;
    aimed:=get_sfall_arg;
    i:=-1;
    if (type == ATKTYPE_PALMSTRIKE) or (type == ATKTYPE_PIERCINGSTRIKE) or (type == ATKTYPE_JAB) then begin
      i:= 4 - (has_trait(TRAIT_PERK, dude_obj, PERK_bonus_hth_attacks) > 0);
    end
    if (type == ATKTYPE_HIPKICK) or (type == ATKTYPE_HOOKKICK) or (type == ATKTYPE_PIERCINGKICK) then begin
      i:=5 - (has_trait(TRAIT_PERK, dude_obj, PERK_bonus_hth_attacks) > 0);
    end
    if i != -1 then begin
      if aimed then i++;
      set_sfall_return(i);
    end
  end
end

The includes point to the Headers folder from the RP sources, and I'm using this script editor to compile it.
However, when I do I get an error in the Condition.h file in those headers, saying "Expected top-level statement".
The culprit code is below:

Code:
#define COND019(x)              if ((obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_LEATHER_ARMOR) and             \                                   
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_METAL_ARMOR) and               \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_POWERED_ARMOR) and             \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_COMBAT_ARMOR) and              \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_LEATHER_JACKET) and            \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_PURPLE_ROBE) and               \
                            (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_BRIDGEKEEPERS_ROBE) and /*added by killap*/   \ 
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_HARDENED_POWER_ARMOR) and      \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_BROTHERHOOD_COMBAT_ARMOR) and  \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_TESLA_ARMOR) and                \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_CURED_LEATHER_ARMOR) and        \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_ADVANCED_POWER_ARMOR) and        \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_ADVANCED_POWER_ARMOR_MK2) and    \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_LEATHER_ARMOR_MK_II) and        \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_METAL_ARMOR_MK_II) and            \
                                    (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) != PID_COMBAT_ARMOR_MK_II) ) then

All the lines below the first one have a different syntax highlighting (they don't get recognized as part of the macro), and I'm guessing I'm supposed to do some preproc stuff with this file in order to convert the \'s into a single-line statement. But how do I do that?

I am able to compile the hook script if I use Black Isle's "old" headers, i.e. the ones that come with the mapper, but I'd rather not do that.

Any advice? Is there some simple thing that I'm doing wrong here?
 
sfall's compiler doesn't like the trailing spaces. You need to remove them from the first line.
BTW, the script editor in sfall modders pack is newer than the one in the thread.
 
Last edited:
@Magnus, you have to make sure you remove all the spaces behind the /'s (there's a lot of spaces behind the top one, and one behind the "added by killap" one.

I remember it took me ages to figure this out, but that's the cause of all your macro woes 99/100 times.


edit: damnit novarain :P
 
Back
Top