FSE Compile problem

Yossarian

First time out of the vault
I'm trying to get the hang of making new macros, so I put this in command.h
Code:
#define nice_move                      animate_run_to_tile(tile_num(dude_obj)+1);
I know that something like this is already included, but im just trying things out. Then I called it from my script like this
Code:
procedure description_p_proc begin
   script_overrides;
   display_msg(mstr(102));
   nice_move;
end
I get a compiler error saying "Expected: ;". So I open the temp.i file, and it says
Code:
procedure description_p_proc begin
   script_overrides;
   display_msg( message_str((1305),102) );
    animate_move_obj_to_tile(self_obj, tile_num(dude_obj)+1, (1)); ;
end
with two semicolons at the end.
Can someone tell me what Im doing wrong?
Thanks a lot for your help.
 
Since you defined it with a semicolon, there is no need to put one in the script when you call it. So all you need to put is "nice_move"
 
yeah I figure it out later, but I still have a similar problem. Suppose i do something like
Code:
#define nice_move(obj,Dest)                  
variable THSteps:=0;                              \
 if(tile_num(Obj)>Dest) then begin         \
  THSteps:=8;                                           \
animate_run_to_tile((tile_num(obj)+THSteps); \
end
In this case should I put a semicolon after calling nice_move, or take some of them out from the #define? Neither way seems to work for me.
 
If the last line you have in the macro has a semicolon (the word "end" does not count) then no semicolon is needed in the script.

What exactly is the error you are getting? One error I found in your script is that you are missing a ")" on the second to last line. Also I think the "Obj" of the third line should be "obj"
 
Sorry about the mistakes before, here is what I have now
Code:
#define nice_move(obj,Dest)                  
variable THSteps:=0;                                         \  
if(tile_num(obj)>Dest) then begin                      \
THSteps:=8;                                                       \
 animate_run_to_tile(tile_num(obj)+THSteps);  \                                              
 end

and this is how I call it(from a Node)
Code:
nice_move(self_obj,19271);
The error is "Expecting ";" at line 9393, which is
Code:
variable THSteps:=0; if(tile_num(self_obj)>19271) then begin THSteps:=8; animate_move_obj_to_tile(self_obj, tile_num(self_obj)+THSteps, (1)); end ;
in the temp.i file.

I dont think there should be a ; after end, but if I remove it from the call, it still doesn't work (gives me the exact same error, in same line). Also commenting the call(but not the define) lets the script compile fine.
 
Well be sure to remove the extra semicolon from the call as it is not needed and it won't work. As for the problem at hand. When scripting in Fallout, you cannot define a variable in the middle of a node. For example

Code:
procedure meow begin 
 code 
 code2 
 variable foo := 0 
 code 3
end

the above won't compile correctly. You have to define variables at the beginning of the node, before any other code is executed.
 
Thanks a lot for your help, I put the variable definition at the begining and that solved it. :notworthy: Let's see what other walls i run into next.
 
Back
Top