To eliminate all the aggravating factors, I reinstalled the vanilla version of the game, downloaded the latest "official" sfall 4.4.3.1 (and also some older versions) from the sfall team git hub and pasted it into the game directory. I set up ddraw.ini and then pasted my script into the data/script directory.
The script is executed and the expected effects occur, which is also confirmed by countless debug log messages.
Turning stealth on/off via tap_key still DOESN'T WORK.
If I physically press button 1, sneaking is turned on or off, which was verified through:
procedure keypress_handler begin
variable event, dx_scancode, vk_scancode;
event := get_sfall_arg;
dx_scancode := get_fall_arg;
vk_scancode := get_sfall_arg;
debug_msg("key pressed " + dx_scancode + " vk scancode " + vk_scancode);
end
which returns 2 for dx scancode or 49 for vk scancode when 1 is pressed, neither of which works through the tap_key function no matter where I place it in the code (HOOK_COMBATDAMAGE, HOOK_GAMEMODECHANGE, HOOK_SNEAK). Also tried with DIK_ESCAPE and integers 1 and 2 as arguments.
Remaining options:
Keyboard layout (Croatia), although of course I tried it with the default US English layout as well.
DX 9 not installed - I'll install it, although I'm not sure how much effect it will have since I'm on Win 11.
Seemingly a small problem, but after 7 days of frantic research, I am no closer to a solution.
At this moment, I'm thinking about firing up Ida and detecting the correct flag to indicate that stealth is active on dude. I'd rather not, but in desperation...
Not directly related to this issue, doesn't the official version of sfall have an "AutoMoveToAttack" for the melee option? (you just press the mouse on the target, regardless of the distance, and the game calculates whether you have enough AP and if so, it automatically perform attack). Is it only in the extended "unofficial" version?