Fallout 2 mod Sfall general script questions

mrowrpurr

First time out of the vault
Hi all, I'm having a problem compiling a script using any fs_* functions

The compiler that comes with sFall Script Editor 4.1.6 (also tried 4.1.7 RC0) simply tells me expecting ';'

Here is the code I'm trying to compile:

#include "../headers/define.h"
#define NAME "gl_mymod"
#include "../headers/command.h"

procedure start;

procedure start begin
if game_loaded then begin
display_msg("Please work?");
fs_copy("path1", "path2");
end
end


I really wanna get these functions working :cry: Thanks in advance! Loving so much of what sfall adds!

Edit: it compiles when using a variable but I can't get it to work :(

file:=fs_copy("color.pal", "color.pal"); <-- compiles

I set UseFileSystemOverride=1 in my ddraw.ini and it's still not working...

UseFileSystemOverride=1 is still available in ddraw.ini, so I'm guessing this feature should work / is supported? It's documented in sFall Script Editor and the sfall-team official docs. Anyone know?


I'm testing by trying to override an animation (of the idle of the ants in the temple, just to test)

file := fs_copy("art/critters/MYIDLE.frm", "art/critters/MAANTTAA.frm");
 
Last edited:
file := fs_copy("art/critters/MYIDLE.frm", "art/critters/MAANTTAA.frm");
Use art_change_fid_num() instead. Much easier to change critters like that.

That said, I'm pretty sure you are missing the /data/ folder?
 
Use art_change_fid_num() instead. Much easier to change critters like that.

That said, I'm pretty sure you are missing the /data/ folder?

The docs say that it's relative to the data directory. Although, yeah, I tried with data/ and also used \\ slashes per docs and nothing working yet.

Can I use art_change_fid_num to switch to use an animation that's provided in data\art\critters\ but not defined in a proto?

I'm trying to make a mod that's compatible with all mods, which means no adding protos, if I understand correctly.

I want to change a critter to use my animation files for a brief period of time during gameplay. That's why I was going the fs_copy route to start with.

I basically have a zzzzzzAA.frm idle and would like to assign it to a critter at runtime (without editing any files that contain sequential numbers, to keep it compatible with other mods)
 
Is there any way in sfall or vanilla to get the map obj for a specific map? Specifically, given a map index.

I'm looking for a map of [map index] => [map obj identifier (of the map script)]

For example, provide 126 as a parameter and get the 123456789 obj identifier of the Artemple script.

Would it be challenging to RE and add support if there's nothing already?

I haven't even begun to get into RE at all, though Cheat Engine only had a few instances of a map obj identifier which I tested with (`self_obj` printed from a map script as a test). Any RE resources for F2 which could allow me to help?

If we've RE'd a script table or something maybe that would have the info? Maybe it would have the obj identifiers for critters as well?

Use-case: interact with attached scripts from other scripts (in particular, gain read/write access of the attached script's variables). For this, we just need the obj of the given critter or map to use set_self,set_self and gain access to LVAR and MVAR. Very powerful! Especially as we live in a world where global scripts rule.

A similar function to what I'm looking for is: dialog_obj. But would love to have a map_obj.
Doesn't *have* to be map index --> map obj. Getting the obj of the current map would do! And easier to implement.

Thanks!
 
Last edited:
Is there any way in sfall or vanilla to get the map obj for a specific map? Specifically, given a map index.

cur_map_index

I don't think it is possible to get the script of the current map, but I also can't really imagine a use case for that. To change the LVAR of a different script, you have to run set_self() twice, I've just tried it and it works.

Btw. it is probably better to make a new thread for such questions, as it doesn't really have much to do with Sfall.
 
Btw. it is probably better to make a new thread for such questions, as it doesn't really have much to do with Sfall.

Very happy to! New to NMA and hesitant to start too many new threads, not sure how the community usually posts!

For what it's worth, I posted to the Sfall thread because I wanted the question to reach the Sfall developers who could RE map_obj because Sfall provides the RE functions dialog_obj, obj_under_cursor, and tile_get_objs.

To change the LVAR of a different script, you have to run set_self() twice

Yep! That's already what I've been doing for LVARs.

I don't think it is possible to get the script of the current map, but I also can't really imagine a use case for that..

Oh! Is there another way to access MVAR from outside of the map script?

Note: I haven't tried read_int yet. I'll give it a shot. Never tried the direct memory functions before! I figure one of the addresses I found from CheatEngine might get me the current map script. So very very happy that Sfall includes the Direct Memory Access features. I'm going to be spoiled by Sfall, it has some surprisingly lovely features which even F4SE doesn't have <3 Tho it would be dope if maybe *one day* Sfall loads .dlls like F4SE <3

Edit: address for anyone who finds this post 0x0E491110
 
Last edited:
Oh! Is there another way to access MVAR from outside of the map script?

MVARs are global to the local map you are in. Every script inside the map can access them, they have nothing to do with map scripts.
 
Hello sfall peoples!

I cannot get the @ procedure stringify operator to work:

Code:
procedure foo begin
   display_msg("Called foo.");
end

procedure start begin
   if game_loaded then begin
      // variable fn = "foo"; <--- this doesn't work either, same compiler error
      variable fn = @foo;
      fn(); <--- "Assignment operator expected." error on this line
   end
end

The compiler complains about fn() with "Assignment operator expected."

Related: I can't get invoking a string variable to work either (which is supposed to be vanilla compiler supported?)

Thoughts? Thanks!

I am using the compiler provided with sFall Script Editor 4.1.6.0
(also tried with the compile.exe that comes with sfall modderspack_4.3.5 - same error)

Edit: I found that this is documented as "NOTE: Does not work currently." in the sfall SSLC README.
Nevermind! Bummer. I'm extra sad because it does say in the README:
Not many people know that since vanilla Fallout you can call procedures by "calling a variable" containing it's name as a string value
...and yet it doesn't appear to work, at least not with the latest compiler :puppy-dog:

Edit Edit: The compiler error goes away and it compiles if I do:
Code:
procedure start begin
   if game_loaded then begin
      variable fn = "foo";
      variable ret = fn(); // <--- compiles if I do an assignment
      display_msg("This is never displayed, calling fn() seems to stop the proc");
   end
end
... but it still doesn't work, doesn't invoke the `foo` proc as advertised :irked:

Edit Edit Edit: Nevermind, figured it out. It works fine so long as the proc is called from *somewhere* so the optimizer doesn't remove the procedure. Also works if you set -O0 to disable optimization, but that's not ideal. Working for me! :aiee:

If you find this, make sure you look into using AddNamedEvent/AddNamedHandler/SignalNamed/ClearNamed
 
Last edited:
I've split your posts into a new thread as it doesn't really belong into the Sfall release thread.
 
I've split your posts into a new thread as it doesn't really belong into the Sfall release thread.
You're the best! Thanks!

It wasn't clear to me that the 165 pages of FO2 Engine Tweaks (Sfall) were actually for releases, honest mistake!
 
Back
Top