Scripting Question

Tesgrim

First time out of the vault
Okay..i have copied and made new script from generic citizen of the Enclave....i copied the msg file and editied it to my liking..but how do I make my new script use the edited msg file? here is the script if you need it

-------------------------------------------------------------------------------------
#include "..\headers\define.h"
//#include "..\headers\<TownName.h>"

#define NAME SCRIPT_ATest
#define TOWN_REP_VAR (GVAR_TOWN_REP_ENCLAVE)


#define At_Work (false)

/* 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;
procedure timed_event_p_proc;
procedure push_p_proc;

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


// The next lines are added in by the Designer Tool.
// Do NOT add in any lines here.
//~~~~~~~~~~~~~~~~ DESIGNER TOOL STARTS HERE

procedure Node001;

//~~~~~~~~~~~~~~~~ DESIGN TOOL ENDS HERE
// The Following lines are for anything that is not needed to be
// seen by the design Tool


/* Local Variables which are saved. All Local Variables need to be
prepended by LVAR_ */
#define LVAR_Looked_Before (4)
#define LVAR_Hostile (5)
#define LVAR_Personal_Enemy (6)
#define LVAR_Poison_Timer (8)
#define LVAR_Home_Tile (9)

/* Imported variables from the Map scripts. These should only be
pointers and variables that need not be saved. If a variable
Needs to be saved, make it a map variable (MVAR_) */


/* Local variables which do not need to be saved between map changes. */
variable Only_Once:=0;

procedure start begin
end

/* This procedure will get called each time that the map is first entered. It will
set up the Team number and AI packet for this critter. This will override the
default from the prototype, and needs to be set in scripts. */
procedure map_enter_p_proc begin
Only_Once:=0;
critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_ENCLAVE);
critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_PEASANT);

if (local_var(LVAR_Poison_Timer) == 0) then begin
set_local_var(LVAR_Poison_Timer,4*ONE_GAME_MINUTE+random(0,2*ONE_GAME_MINUTE));
end

if (local_var(LVAR_Home_Tile) == 0) then begin
set_local_var(LVAR_Home_Tile,tile_num(self_obj));
end

rm_timer_event(self_obj);
add_timer_event(self_obj,random(30,60)*ONE_GAME_SECOND,1);
end

procedure timed_event_p_proc begin
if (fixed_param == 1) then begin
if (tile_distance(tile_num(self_obj),local_var(LVAR_Home_Tile)) > 6) then
animate_move_to_tile(local_var(LVAR_Home_Tile));
else
animate_move_to_tile(tile_num_in_direction(tile_num(self_obj),random(0,5),random(2,5)));
add_timer_event(self_obj,random(30,60)*ONE_GAME_SECOND,1);
end
end

procedure push_p_proc begin
end


/* Every heartbeat that the critter gets, this procedure will be called. Anything from
Movement to attacking the player on sight can be placed in here.*/
procedure critter_p_proc begin

/* If the critter is mad at the player for any reason, it will attack and remember to attack
the player should the game be saved and loaded repeatedly. Additionally, if any special
actions need to be taken by the critter based on previous combat, the critter will remember
this as well. */

if ((local_var(LVAR_Hostile) == 2) and (obj_can_see_obj(self_obj,dude_obj))) then begin
set_local_var(LVAR_Hostile,1);
attack(dude_obj);
end

if (global_var(GVAR_ENCLAVE_POISON_TIMER) != 0) then begin
if ((game_time - global_var(GVAR_ENCLAVE_POISON_TIMER)) > local_var(LVAR_Poison_Timer)) then begin
critter_damage(self_obj,2*get_critter_stat(self_obj,STAT_max_hp));
end
end

end

/* Whenever the critter takes damage of any type, this procedure will be called. Things
like setting ENEMY_ and LVAR_Personal_Enemy can be set here. */
procedure damage_p_proc begin

/* If the player causes damage to this critter, then he will instantly consider the player
his personal enemy. In Critter_Proc or through dialog, actions will be taken against
the player for his evil acts. */
if (source_obj == dude_obj) then begin
set_local_var(LVAR_Personal_Enemy,1);
end

end

/* Any time that the player is caught stealing from this critter, Pickup_proc will be called.
In here, various things can happen. The most common response is instant hostility which
will be remembered. */
procedure pickup_p_proc begin
if (source_obj == dude_obj) then begin
set_local_var(LVAR_Hostile,2);
end
end

/* The dialog system is setup and prepares the player to talk to this NPC. Where To Go
written by designers are placed in here. Additionally, Reactions are generated and
stored which affects player interactions. */
procedure talk_p_proc begin
Evil_Critter:=0;
Slavery_Tolerant:=SLAVE_TOLERANT;
Karma_Perception:=KARMA_PERCEPTION1;

CheckKarma;

GetReaction;

if (global_var(GVAR_ENCLAVE_ALARM) == ALARM_REACTOR) then begin
floater(random(113,122));
end

else if (global_var(GVAR_ENCLAVE_ALARM) == ALARM_TOXIN) then begin
floater(random(123,132));
end

else if (global_var(GVAR_ENCLAVE_ALARM) == ALARM_INTRUDER) then begin
floater(random(133,142));
end

else if (At_Work) then begin
floater(random(143,152));
end

else begin
floater(random(103,112));
end
end

/* This procedure gets called only on the death of this NPC. Special things like
incrementing the death count for reputation purposes and Enemy Counters are placed
in here. */
procedure destroy_p_proc begin

/* Increment the aligned critter counter*/
inc_good_critter

/* Set global_variable for Enemy status*/
end

/* Look_at_p_proc gets called any time that the player passes the cursor over any object.
This should only hold the most cursory of glances for the player. */
procedure look_at_p_proc begin
script_overrides;
if (local_var(LVAR_Looked_Before) == 0) then begin
inc_local_var(LVAR_Looked_Before);
display_msg(mstr(100));
end
else
display_msg(mstr(101));
end

/* The player will see more indepth descriptions from this procedure. They are actively
looking at the critter and want more information. Things like names can be added here
if the critter is known to the player. */
procedure description_p_proc begin
script_overrides;
display_msg(mstr(102));
end

/* Any time a skill is used on a critter this call is made. This can be to give examinations
for things like Doctor skill or messages for various other skills. */
procedure use_skill_on_p_proc begin
end

/* Should the Player ever cause the NPC too much discomfort that he desires to attack the player,
this call will be made. Essentially, it stores the Hostile vaule so that the critter remembers
he was once hostile towards the player.*/
procedure Node998 begin
set_local_var(LVAR_Hostile,2);
end

/* Anytime that there is a need for an ending to dialog, this node is to be called. It will just
exit from the dialog system without any reprisals from the NPC. */
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
end

//xxxxxxxxxxxxxxxxxxxx
 
add an entry to the scripts.h file which defines your script name ( #define NAME SCRIPT_ATest <- this bit would become this bit -> #define SCRIPT_ATest (1304) , at the end of the file.. )

next make an entry into the scripts.lst in the scripts folder

NOTE: your .msg file should have the same name as the script name ( ie ATest.msg.. )

then re-compile your script and it sould work..

(alternatively, i HIGHLY recomend using Jargo's F.S.E. script editor, it has tons of usefull features not the least of which is a "register script" button that put the needed entries into the scripts.h, scripts.lst and wherever else it needs to be.. as well as a built in dialogue editor and "show message file references" option that puts the lines of the .msg file into the script as notes so you can easily see if the lines are in the right place...)
 
...

Okay added the script into the text files...and got FSE(great prog Thanks..)

but i got a problem...when i try to compile a script with the compile.exe a message flashes in the command window..i took a screenshot and it reads:

Stub exec failed:
dos4gw.exe
No such file or directory


any idea?
lookinf for a differnt compiler right now though...either way i wish i knew what was wrong
 
Re: ...

Tesgrim said:
...when i try to compile a script with the compile.exe a message flashes in the command window..i took a screenshot and it reads:

Stub exec failed:
dos4gw.exe
No such file or directory

The dos4gw.exe file is kind of like a dll file for dos and it is needed by some old ms-dos programs to provide memory management type stuff. Your compiler must have been linked against it but they didn't provide a copy. No big deal, I just Googled for it and here's a download link:

http://www.k4d4th.org/pub/games/msdos/dos4gw/dos4gwexe.zip

Just copy this into the same directory as the compiler exe and it should fix you up.

I also was looking into the whole script compiler deal and I found this page here which mentions dos4gw also.

Setting up for Script Compiling (for Fallout 2)

Personally I was thinking more along the lines of using the Cygwin GNU tools like cpp, bison, flex, and all those other weird utilities that it has that nobody really understands what they do or what they are for yet it always installs them if you install the development system packages.
 
Your compiler must have been linked against it but they didn't provide a copy.

Yes you need dos4gw.exe but it is in scripts folder in your mapper dir.
To compile simple script write:
Code:
dos4gw.exe compile scriptname.ssl

If you use #define etc then you must use precompiler (watcom) before compiling.

BTW FSE can compile script using watcom and compiler.
 
...

Okay...got everythign down to here....yet another problem(computers..mostly windows...hates me) Now i get an error from the script everytime..it keeps telling me about undefined symbols...though..i have not layed hands n the script whatsoever..its a carbon copy of the enclave one( i want them to change reaction on terms of whats going on at the enclave), though it gives errors.... like
Error! Undefined symbol inc_good_critter.


do i need to get watcom or something (the one i tried to download woud have taken 6 hours on my connetion)
 
Yes compiler does not know what inc_good_critter means because this is a macro from header file(*.h).
Precompiler(Watcom) in needed to use macros.
You can get Watcom from here http://www.openwatcom.com/ftp/zips/c_nt.zip
Put it in the same folder like compiler, and use like this:

Code:
wcc386 scriptname.ssl /pc /fo=temp.i /w4

and then compile:

Code:
dos4gw.exe compile temp.i
 
Back
Top