Compiler error

Xavierblazer

Vault Senior Citizen
When I try to compile this script I get the error EXPECTING: Top level statement. What does it mean, and is there a tutorial or something on compiler error messages?

Code:
procedure start;
procedure critter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure description_p_proc;
procedure use_skill_on_p_proc;
procedure damage_p_proc;
procedure map_enter_p_proc;
procedure timed_event_p_proc;

procedure Node998;           // Feiten
procedure Node999;         // Nomoretalkie

procedure Node001;
procedure Node002;

import variable chesties;

in_dialog:= false
moved_inven:= false;
procedure start begin
end

procedure timed_event_p_proc begin
end

procedure map_enter_p_proc begin
end

procedure critter_p_proc begin
end

procedure damage_p_proc begin
end

procedure pickup_p_proc begin
end

procedure talk_p_proc begin
variable the_bit := 1;
variable the_value := 1;
   while (the_bit <= 32) do begin
      the_bit += 1;
      the_value := the_value * 2;
   end
    if (in_dialog == false) then begin
in_dialog := true; 
start_gdialog(SCRIPT_mrtestie,self_obj,4,-1,-1);
 gSay_Start;
 call Node001;
 gSay_End;
 end_dialogue; 
in_dialog := false;
 end 
else call Node001 ;
end

procedure destroy_p_proc begin
end

procedure look_at_p_proc begin
end

procedure description_p_proc begin
end

procedure use_skill_on_p_proc begin
end

procedure Node998 begin
end
procedure Node999 begin
end

procedure Node001 begin
  gSay_Reply(SCRIPT_mrtestie,"Sup homie?") ;
   giQ_Option(001,SCRIPT_mrtestie,"nutin. sup wit u?",Node002,(50)) ;
   giQ_Option(001,SCRIPT_mrtestie,"Why do you talk like a moron?",Node002,(50)) ;
   giQ_Option(001,SCRIPT_mrtestie,"I gotta run. Nature calls, you know?",Node999,(50)) ;
end
procedure Node002 begin
if (moved_inven:= false) then begin
move_obj_inven_to_obj(dude_obj,chesties);
moved_inven:= true;
end
  gSay_Reply(SCRIPT_mrtestie,"This is my reply.") ;
   giQ_Option(001,SCRIPT_mrtestie,"Thats interesting. I gotta know something else.",Node001,(50)) ;
   giQ_Option(001,SCRIPT_mrtestie,"I gotta run. Nature calls, you know?",Node999,(50)) ;
end
 
You have a syntax error somewhere, does it say what line the error is in when you compile?

EDIT:

The error appears to be at line 21.

in_dialog:= false;
moved_inven:= false;

Are these variables?

There was a missing semi-colon I added at the end of in_dialog:=false but I haven't go the Iplay compiler setup and instead am using Noids, there may be a few more errors further along.
 
A few problems ... this error: EXPECTING: Top level statement .. what the compiler is saying is: I don't know WTF this is but it's not a script :lol: It means there is a very basic syntax error somewhere. A few suggestions:

** You need this at the top of the script
#include "..\headers\define.h"
#define NAME SCRIPT_mrtestie
#include "..\headers\command.h"

** You can't reference SCRIPT_mrtestie in dialog without having that at the top. But you need to add that script name to SCRIPTS.H

#define SCRIPT_mrtestie (1321) // mrtestie.int ; Test Script
Change the number to the next available one in the header
Also, the variables like in_dialog are defined in command.h header. All scripts should have the above 3 line in them (referencing define.h, command.h, and defining NAME of the script (for FO2).

** You're missing a semicolon after in_dialog := false

** there is an error in an if statement
if (moved_inven := false) then begin

The := operator is to assign value to variables, it's not a logical operator. The "equals" test is == not :=, should be
if (moved_inven == false) then begin

** The gsay command expects a message number as second parameter, you have:
gSay_Reply(SCRIPT_mrtestie,"Sup homie?");

I think the text should be in mrtestie.msg and a line number should be in the gsay commands.
 
I redid the script with the talk template and it compiles fine. I have a different problem this time. The inventory of dude_obj isnt moving when I call it to move everything to the chest Im pointing to. I just borrowed the map and chest scripts from the ones from the Arroyo temple.

Critter script:
Code:
#include "e:\compiler\headers\define.h"

#define NAME                    SCRIPT_MRTESTIE

#include "e:\compiler\headers\command.h"


/* Standard Script Procedures */
procedure start;
procedure critter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure description_p_proc;
procedure use_skill_on_p_proc;
procedure damage_p_proc;
procedure map_enter_p_proc;

/* Script Specific Procedure Calls */
procedure Node998;                                      // This Node is Always Combat
procedure Node999;                                      // This Node is Always Ending


procedure Node001;
procedure Node002;
procedure Node003;
procedure Node004;

import variable chesties;

procedure start begin
end

procedure map_enter_p_proc begin
end

procedure critter_p_proc begin
end

procedure damage_p_proc begin
end

procedure pickup_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 destroy_p_proc begin
end

procedure look_at_p_proc begin
   script_overrides;
     display_mstr(100);
end

procedure description_p_proc begin
   script_overrides;
   display_mstr(110);
end

procedure use_skill_on_p_proc begin
end

procedure Node998 begin
end

procedure Node999 begin
end


// Not lines are allowed to be added below here
// The Following lines are from the Design Tool
//~~~~~~~~~~~~~~~~ DESIGN TOOL STARTS HERE

procedure Node001 begin
   Reply(120);

   NOption(130,Node002,004);
   NOption(140,Node003,004);
   NOption(150,Node999,004);
end

procedure Node002 begin
move_obj_inven_to_obj(dude_obj,chesties);
Reply(210);
   NOption(180,Node004,004);
end

procedure Node003 begin
   Reply(160);
   NOption(170,Node999,004);
end

procedure Node004 begin
   Reply(190);
   NOption(200,Node999,004);
end

Map script:

Code:
#include "E:\compiler\headers\define.h"
#define NAME                    SCRIPT_lvmap
#include "E:\compiler\headers\command.h"

procedure start;
procedure map_enter_p_proc;
procedure map_update_p_proc;

export variable chesties;


procedure start begin
end

procedure map_enter_p_proc begin
end

procedure map_update_p_proc begin
end


Chest script:

Code:
/*
	Copyright 1998-2003 Interplay Entertainment Corp.  All rights reserved.
*/

/* Include Files */
#include "E:\compiler\headers\define.h"

#define NAME                    SCRIPT_CHEST

#include "e:\compiler\headers\command.h"

procedure start;
procedure map_update_p_proc;

import variable chesties;

procedure start begin
end

procedure map_update_p_proc begin
   chesties:=self_obj;
end
 
Hmmm I checked the flow of the chest and I can't see anything wrong. Be sure that the map script is attached, because if that doesn't run, then the chesties pointer won't get exported.

In the mapper, select SCRIPTS->SET MAP SCRIPT, set it to your map script, and make sure it's attached SCRIPTS->SHOW MAP SCRIPT. Save the map after attaching.

You should enable debug mode, and you can put messages in your scripts, for example in NODE002 where the transfer of inven is supposed to happen, you can do

debug_msg("Transferring inven");
move_obj_inven_to_obj(dude_obj,chesties);
debug_msg("Finished transfer");

Then run ( F8 ) and check the debug.log. You can enable debugging like this:
http://www.nma-fallout.com/forum/viewtopic.php?t=782&start=2
 
I did that, and it turns out the script Chest wasnt found. Sure enough, I go into the compiler and the chest script was sitting there, ready to be transported.

Now, it is screwing up wierdly. I initiate conversation mode about 7 hexes away from mr testie. I do the move inventory node, and it goes through sucessfully. But my items are still in my inventory. I check the chest and its still empty. So I get 1 hex away from mr testie and do the move inventory node and it works. All my items, including my armour and gun I had equiped were put into the chest. I restart the map and get next to mrtestie to see if distance was the problem, and when I say "Move my inven please" the text disappears and I cant exit. I can enter barter mode, but then when I click talk it just beeps and stays on the barter screen. Then when I press F8 the mapper interface comes back up but the barter screen was still there. then it freezes and I have to resart my computer.
 
In the debug messages, when its moving the inventory, its saying:
Code:
ob_move_obj_inven_to_obj: Obj is null
Im not sure if it is saying that the chest is null, or if dude_obj is null. It works after trying a few different combinations of distances and fidgeting with the chest.
 
Xavierblazer said:
Code:
ob_move_obj_inven_to_obj: Obj is null
Im not sure if it is saying that the chest is null, or if dude_obj is null.
The dude_obj can never be null, because it's the only object pointer that "goes everywhere". See, I'm omnicient. I'm a playa. You can print the pointer to the chest:

debug_msg("Transferring inven");
debug_msg("chesties=" + chesties);
move_obj_inven_to_obj(dude_obj,chesties);
debug_msg("Finished transfer");

If the chest is null, engine tries to add inventory from it, falls down and can't get up LOL Why it's doing that intermittently is the question.
 
Ive abandoned this idea. I found that it is much easier to place the inventory on Mr Testie.

Thanks for the help though.

PS: could it have something to do with the "chesties:=self_obj" in the chest script being in map update? ill try it in different places.
 
Perhaps map_enter_p_proc would be a better place to set that pointer. Once the pointer is set it should be available to other scripts. Maybe the engine is creating multiple pointers on map update.
 
Back
Top