Help with scripting

VonZorch

First time out of the vault
I am trying to write my first script and getting a very frustrating error.
Code
#include "..\headers\define.h"
#define NAME SCRIPT_ZIUNDIES
#include "..\headers\command.h"
procedure critter_p_proc;
#define LVAR_IS_WORN :=0;
procedure critter_p_proc begin
LVAR_IS_WORN :=1;
end
I get an "expecting ';'", at LVAR_IS_WORN :=1;. I don't see where I am missing a ; in the code. :wall:
The posted code has been reduced to the simplest possibility from the whole script.
Can someone tell please me what is wrong here?
I've tried every script editor and/or compiler I can find.

Also, is there any way to have a script trigger when an item is put into, or taken from, the armor or hand slots? I think I have a clumsy method if I could get the script to compile, I'm looking for a simple one.
 
I'll try to help a bit, if you're using "FSE" or "Sfall Script Editor":

Code:
#include "..\headers\define.h" 
#define NAME SCRIPT_ZIUNDIES 
#include "..\headers\command.h" 
procedure critter_p_proc; 
#define LVAR_IS_WORN  (0) 
procedure critter_p_proc begin 
set_local_var(LVAR_IS_WORN,1); 
end

Because IS_WORN is defined as LVAR, which remembers its value even after map change.

If you don't want "IS_WORN" value to be remembered after map change, you can use:

Code:
#include "..\headers\define.h" 
#define NAME SCRIPT_ZIUNDIES 
#include "..\headers\command.h" 
procedure critter_p_proc; 
variable IS_WORN:=0; 
procedure critter_p_proc begin 
IS_WORN:=1; 
end

There are more types of variables, but in this case, if this doesn't help. Then, i'll be damned
:mrgreen:
 
VonZorch said:
Also, is there any way to have a script trigger when an item is put into, or taken from, the armor or hand slots? I think I have a clumsy method if I could get the script to compile, I'm looking for a simple one.

Sure, just check command.h or define.h and armor_worn, equipped_in_left_hand (something like that), etc. are right there. You can then do something like make it check continuously (through critter_p_proc in your script, which checks continuously) for changes.

Just some general (unasked for) advice though: if you're starting out, don't by all means start completely from scratch. Fallout modding is frustratingly complicated enough as it is. Either start out by learning from and modifying existing scripts, or, if you absolutely want to start out fresh, with one of the templates provided by the script editor you're using. Also, make sure you read through the major header files (define.h, command.h, others depending on what you want to do) to get a feel for what's possible. Looking through the text files in sfall also helps you get to know the expanded scripting possibilities that offers.
 
Forgotten Knight, thanks, that is what I needed. :salute: My problem was none of the tutorials I looked at said how to change saved local variables, and I do need to save it.

JimTheDinosaur, that is exactly the clumsy method I was using. As for modifying existing scripts, I don't have any ideas for changes, I do for new ones. Also I an an experienced programmer been bashing BASIC for over 30 years, I don't have any C/C++ experience and Pascal was a bit of work decades back, I just need to get used to the new language. I'm currently taking a break from writing a comprehensive Fallout editing suite in VB.

I try to use FSE and sfall script editor. but I've been having problems with then. FSE can't run the compiler and sfall script editor v3.0 and 3.1 gives a file not found error on compile, 2.17 worked, maybe I'll use that. I did manage to get the compiler from the Mapper to run on my 64bit Windows install.
 
Yeah, sorry, was a presumptuous bit of "advice" on my part. I forget that what works for me as a non-programmer probably works totally different for others.
 
You should check out the original scripts to see how stuff is done there. It's the easiest way of learning how to script in Fallout.
 
I did, but obviously not well enough.
I did get the completed script to compile but now I have a new problem. The script is listed in scripts.lst and scripts.h and is in the proto but does nothing. This is for an item that does things when put into or taken out of one of the ready item slots.
How do I get the blasted thing to activate? Tried using critter_p_proc, start and timed_event_p_proc. I want to have it's action attached to the item for portability between mods. Am I going to have to put it into obj_dude?
I'm working with MegaMod with custom books and YAAM.

Solved, needed to start a new game.
 
Back
Top