Fallout 2 mod FO2 Engine Tweaks (Sfall)

You can use hs_keypress hook script for checking any key press:
hs_keypress.int
Runs once every time when any key was pressed or released.

int arg1 - event type: 1 - pressed, 0 - released
int arg2 - key DX scancode
int arg3 - key VK code (very similar to ASCII codes)
Code:
procedure start;

procedure start begin
   variable event;
   if not init_hook then begin
     event := get_sfall_arg;

     if (event == 1) then begin
       ***Do stuff***
     end
   end
end
 
Is there any interest in using LUA for Sfall global/hook scripts (and maybe even object scripts as well) ?

PROs:
  • Every gamedev knows how to write LUA, but SSL is very Fallout-specific.
  • No need for compiler/decompiler anymore. All scripts will just work after modification in text editor.
  • Much more robust scripting engine, polished and less bugs.
  • Support for proper programming paradigms such as OOP, functional programming, etc.
  • A lot of libraries and tools (editors, syntax highlighting, etc.) on the Net.
CONs:
  • Yet another scripting technology to learn for those who doesn't know it already (though it is easier than SSL).
  • Need to bind all high-level opcodes to LUA engine. But It might not be as hard as it sounds...
 
Last edited:
I don't see much point if it's going to be limited to just global/hook. But if all scripts can be replaced by lua, it might be worth it (although I'm not saying I'd use it personally).
 
Dunno, really. Generic scripts are extremely simple. Most stuff is "go-to procedure x" and checking some variables. If someone wants to make something really complicated, he probably is skilled enough to do it in ssl as well. So I do not really see a too big use in it.
 
Dunno, really. Generic scripts are extremely simple. Most stuff is "go-to procedure x" and checking some variables. If someone wants to make something really complicated, he probably is skilled enough to do it in ssl as well. So I do not really see a too big use in it.
The issue is that in those cases when you want something complicated, SSL fails. It lacks anonymous functions, objects, inheritance, etc. Though it is possible to simulate OOP in limited way using normal procedures (with prefixes) and sfall arrays with dot syntax.

I was thinking to implement anonymous functions (not a problem from VM point of view, just difficult to compile and more difficult to decompile) some time ago...
 
As I am on a roll right now, here is another issue:

I've just updated my sfall version, in the hopes of fixing a few problems with it (didn't, but whatev). Now I noticed that my alternate money item isn't working anymore.
Code:
Money1=41
Money2=519

I am pretty sure though that I did not use a custom sfall version, though? Did something change here? Am I dreaming something? Can it be added again?


Also my game is now crashing by a stack overflow error, apparently created from one of my global scripts.
Code:
procedure start;

#define SoundP  get_ini_string("button.ini|Button|Butin")
#define HotKeyF  get_ini_setting("button.ini|Button|HtKey")

procedure start begin
   if (game_loaded) then begin
  set_global_script_repeat(10);
  set_global_script_type(1);
  end
  
  if (get_game_mode != 1) then begin
  if (get_sfall_global_int("hotkey01") == 1) and (not(key_pressed(HotKeyF))) and (not(combat_is_initialized)) then begin
  set_sfall_global("hotkey01", 2);
  end else if (get_sfall_global_int("hotkey02") == 1) and (read_int(5366444) != 1) then begin
  set_sfall_global("hotkey02", 0);
  end

  if (key_pressed(HotKeyF)) and (get_sfall_global_int("hotkey01") == 0) and (not(combat_is_initialized)) then begin
  set_sfall_global("hotkey01", 1);
  play_sfx(SoundP);
  end else if (read_int(5366444) == 1) and (get_sfall_global_int("hotkey02") == 0) then begin
  set_sfall_global("hotkey02", 1);
  end
  end
end

Anyone got a quick idea about how to prevent it? It might look like stupid crap, but I need it.
 
Last edited:
@Lexx,

The most suspicious thing I see is a call to read_int, but it shouldn't change anything. Verify which version of sfall you are using and try the latest version if it's not. Also is there more details about the error you experiencing? Even when it's the common "memory could not be read", the address in the message might give a hint on source of the error.

About the Money1, Money2 - I don't see any reference to this in sfall source code. So can't help you here.
 
Yeah, this is the whole debug.log:

Code:
Fade time is 47
Fade steps are 893
Chi squared is 25.545500, P = 36.420000 at 0.05
Sequence is random, 95Aonfidence.
>partyMember_init   Initializing sound system...soundInit: Setting primary buffer to: 16 bit, 2 channels, 22050 rate
soundInit: Primary buffer settings set to: 16 bit, 2 channels, 22050 rate
success.
Reading SNDLIST.LST Sound FX Count: 1480
Sounds are on.
Music is on.
Speech is on.
>gsound_init   >initMovie     >gmovie_init   >moviefx_init   >art_init     >tile_init     >obj_init     >cycle_init   
** String not found @ getmsg(), MESSAGE.C **

** String not found @ getmsg(), MESSAGE.C **

** String not found @ getmsg(), MESSAGE.C **

** String not found @ getmsg(), MESSAGE.C **

** String not found @ getmsg(), MESSAGE.C **
>intface_init   >iso_init     >gmouse_init   >proto_init     >anim_init     >scr_init     >game_load_info   >scr_game_init 
WorldMap Error: Couldn't find match for Map Index!
strParseStrFromFunc Error: Couldn't find match for string: bess dead,enc:special1, if(global(299) > 0)!>wmWorldMap_init   >CharEditInit   >pip_init     >InitLoadSave   >gdialog_init   >combat_init   >automap_init   >message_init   >message_load   >scr_disable   >init_options_menu
>endgameDeathEndingInit

Playing movie: iplogo.mve
Buffered not scaled
Movie aborted
Frames 6, dropped 0

Playing movie: intro.mve
Buffered not scaled
Movie aborted
Frames 2, dropped 0

Playing movie: credits.mve
Opening subtitle file text\english\cuts\credits.SVE
subtitle: couldn't parse
Read 35 subtitles
Buffered not scaled
Movie aborted
Frames 4, dropped 0
Loading background sound file 07desert.ACM... finding background sound  playing succeeded.
Loading sound file nmselec0.ACM...succeeded.
Loading sound file nmselec1.ACM...succeeded.
Loading sound file ib1p1xx1.ACM...succeeded.
Loading sound file ib1lu1x1.ACM...succeeded.

Playing movie: elder.mve
Opening subtitle file text\english\cuts\elder.SVE
Read 14 subtitles
Buffered not scaled
Movie aborted
Frames 5, dropped 0
Loading background sound file wind2.ACM... finding background sound  playing succeeded.
Loading sound file monitor.ACM...succeeded.

Du betrittst die zweite Ebene des Observatoriums. Vor dir siehst du ein gigantisches Teleskop stehen.
[Party Member 0]: Mikhail



[Party Members]:
Total Critter Count: 8

Loading sound file monitor.ACM...succeeded.

Welcome to Fallout: Whispering Winds!Loading sound file monitor.ACM...succeeded.

Debug Mode active!Loading sound file monitor.ACM...succeeded.

Seed: -8*8*4*4*-1Loading sound file electri1.ACM...failed because there are already 4 active effects.

Gsound: playing ambient map sfx: electri1.  FAILEDLoading background sound file 04BRTHRH.ACM... finding background sound  playing succeeded.

Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>Loading sound file monitor.ACM...succeeded.

Level change
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: Undefined opcode 8158.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: pushShortStack: Stack overflow.
Current script: scripts\glkeys.int, procedure <couldn't find proc>
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
No current script
Error during execution: pushShortStack: Stack overflow.
Current script: scripts\glkeys.int, procedure <couldn't find proc>

Basically it throws error till the game crashs (I've cut off the bottom of the .log, because it continues like that for a while).


About the money. Basically it allowed me to define multiple items as currency, which made their value always be 1 and it was counted in the dialogue screen (100 of item x and 100 of item y would show the player with "200 money"). The later part was always questionable, but being able to set a fixed value for an item is extremely useful.
 
Looks like Unsafe functions (which read_int is) are disabled. Refer to AllowUnsafeScripting setting in ddraw.ini (which is bundled with latest version of sfall).

You mean some old versions of sfall allowed to change money PID? Maybe it was some customized version?
 
But it's weird. I have AllowUnsafeScripting=0 in my old ddraw.ini file and never had the problem.

If I activate it, the game won't crash anymore. But now I also found out that somehow the script doesn't make a different anyway. Right now I see no change between using this global script and not.... I think I seriously broke something in my mod, but I don't even know what. Damn, it's just way too long since this stuff has been added.
 
But it's weird. I have AllowUnsafeScripting=0 in my old ddraw.ini file and never had the problem.
Возможно ты использовал Sfall by Crafty, где этот параметр(AllowUnsafeScripting) убран за его ненадобностью.
ps: переведите ему кто-нибудь с русского и могучего)
 
But it's weird. I have AllowUnsafeScripting=0 in my old ddraw.ini file and never had the problem.

If I activate it, the game won't crash anymore. But now I also found out that somehow the script doesn't make a different anyway. Right now I see no change between using this global script and not.... I think I seriously broke something in my mod, but I don't even know what. Damn, it's just way too long since this stuff has been added.

Your best is to add more logs to the code to pinpoint the issue.. Also I would recommend using key_press hook script instead of what you have there for your hotkeys. It's the sfall 3.6+ way of doing things :)

где этот параметр(AllowUnsafeScripting) убран за его ненадобностью.
Я бы не был так категоричен...
 
Я бы не был так категоричен...
А что нет? Если скриптер использует функции типа Write_int/Calll_ и т.п. значит он берет всю ответственность за работоспособность игры на себя :P
К тому же для работы таких функций мало того, что надо включить опцию, так еще и dll надо из modderpack иметь - вот зачем так все усложнять.
 
К тому же для работы таких функций мало того, что надо включить опцию, так еще и dll надо из modderpack иметь - вот зачем так все усложнять.
Since 3.7 there's no need a separate "debugging" sfall in modderspack, it's been merged into the normal build.
Now modders can just enable related settings in the INI to use those functions.
 
А что нет? Если скриптер использует функции типа Write_int/Calll_ и т.п. значит он берет всю ответственность за работоспособность игры на себя :P
К тому же для работы таких функций мало того, что надо включить опцию, так еще и dll надо из modderpack иметь - вот зачем так все усложнять.

Как написано выше, DLL теперь единый. А по поводу опции, если ты ставишь кучу модов от разных авторов, она как бы даст понять что ты (как игрок) юзаешь "экспериментальные" моды. Минус прописывания адресов памяти в скриптах в том что если в будущем кто-то захочет переделать Sfall под другой EXEшник (например под 1 фаллаут), он в теории сможет переделать только саму DLL и все адреса зашитые в ней, а скрипты продолжат работать, т.к. они должны полагаться на sfall для реализации движковых фич.

Т.е. юзание этой фичи - рекомендовано только для моддеров в процессе разработки модов, или для отладки движковых фич (если например кому-то проще пересобирать скрипт чем sfall - ведь для этого не нужна Visual Studio). Все готовые моды и скрипты должны полагаться на возможности sfall.
 
Что если функционала Sfall не хватает? )
Code:
Info from Crafty
Обновить слоты с предметами для цели.
_target_pud:=read_int(0x59E978);
target_inventory_offset:=0x59E7EC + (read_int(0x59E948) * 4);
write_int(target_inventory_offset, 0);
call_offset_v4(0x47036C, inventory_offset, visible_offset, _target_pud, mode); /* display_target_inventory_ Обновить предметы в слоте интерфейса для цели */

Обновить слоты с предметами для игрока.
inventory_offset:=0x59E844 + (read_int(0x59E96C) * 4);
write_int(inventory_offset, 0);
call_offset_v3(0x46FDF4, inventory_offset, visible_offset, mode); /* display_inventory_ Обновить предметы в слоте интерфейса для игрока */
После нужно выполнить функцию win_draw_ см. ниже.

где:
inventory_offset - для рюкзака можно читать содержимое в памяти read_int(0x59E844) чтобы получить смещение вещи которая сейчас видна первой (если прокрутил инвентарь вниз) или же 0 для отрисовки инвентаря начиная с самой верхней вещи;
visible_offset - -1 должно хватить, если положительное значение, то вроде номер (1-6?) конкретной вещи видимой сейчас в инвентаре;
mode - режим интерфейсного окна: 0 (INVENTORY), 1 (INTFACEUSE), 2 (INTFACELOOT) и 3 (BARTER);

call_offset_v0(0x45EB98); /* intface_redraw_ Перерисовывает игровую панель */
call_offset_v0(0x471D5C); /* display_stats_ обновляет статы игрока в интерфейсе */
call_offset_v1(0x4D6F5C, read_int(0x59E964)); /* win_draw_ Перерисовывает открытый интерфейс */

write_int/read_int(0x51C4AC) - таблица области со значениями уровней скиллов в размере по 4 байт на скилл (всего 17 скиллов). Позволяет изменять скиллы игрока как в минусовую так и положительную сторону.
 
By the way- will there ever be the day where we can use Sfall with the bis mapper? :> I am hesitant towards using new unique sfall features, because I am often testing my stuff directly in the mapper-- which of course then doesn't work with sfall related code.

Also about the money again--- is it possible with sfall to define a certain item to have always exactly the same value, no matter the barter skill? It would be very helpful for my shit.
 
By the way- will there ever be the day where we can use Sfall with the bis mapper? :> I am hesitant towards using new unique sfall features, because I am often testing my stuff directly in the mapper-- which of course then doesn't work with sfall related code.
It is possible (by changing all offsets.. huge amount of work), but scripts like Mr.Stalin posted above will definitely not work :)

Also about the money again--- is it possible with sfall to define a certain item to have always exactly the same value, no matter the barter skill? It would be very helpful for my shit.
Of course, use barterprice hook script. But you will need to calculate total price, you can't only modify price for one item without reinventing the formula (it's not that complicated, you can look for example in my mod's sources).


Что если функционала Sfall не хватает? )
То что ты запостил сильно попахивает говнокодом :)
В ответ на твой вопрос - если функционала не хватает, делают Pull Request на Github (как все белые люди, вместо того чтобы рассусоливать на форумах...) и эти фичи попадают в следующую версию (а до её выхода юзают собственную сборку). Либо временно юзают тот ад что ты выложил при помощи макросов, пока в sfall не появится функция.
 
Last edited:
Need some feedback from any scripters out there. I have added several new opcodes that will hopefully allow to forget about ever updating compiler/decompiler in order to add new engine functions. They look like this:
Code:
sfall_func0("func_name");
sfall_func1("func_name", "first argument");
// ...
sfall_func6("func_name", 1, 2, 3, 4, 5, 6);

So basically it's single set of opcodes that you can use to call all kinds of new scripting functions. Function name will be unique and which sfall_funcX opcode you use doesn't matter, it's just defines how much arguments you can provide. This should make it much easier to add new scripting functions.

My questions to all:
1. Is opcode name clear enough? First I considered to call it "sfall_metaruleX" because of "metarule" and "metarule3" vanilla functions that have similar purpose (difference - they use number instead of function name as first argument).
2. Maybe add just one opcode with many arguments and pass 0 for ones you don't need? (a little less clean)
3. Is 0 to 6 arguments is enough? Maybe it's too much? If you need more arguments (which is rare case), you can always pass arrays.
4. Do we need to provide variants of opcode to pass procedures as arguments (similar to register_hook_proc, or vanilla dialogue option opcodes)?
This is relevant because compiler needs to know which argument accepts function, so when you write "my_func(Node001);" normally it will call Node001 procedure, but for some opcodes compiler knows to pass procedure number instead (without actually calling the procedure).
It is possible to pass procedure name (string) and in sfall code call this procedure by name (there's already code for that), so IMO additional opcodes are not needed.

Also there is a thing that you need to validate number of arguments passed (because you can use any of 7 opcodes to call the same function) in each function (previously compiler handled that, because number of arguments for each opcode is known to it). But I think that's not a big deal at all.
 
Back
Top