Ammobox not updating

Unlimited party, improved damage formula, better healing system, comprehensive highlighting and more.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Ammobox not updating

Post by Cyrus »

Burn I'm using fo2tweaks, v12.2, sfall 4.2.7
features I have turned on are:
improved_grenades=1
carry_weight=1
ammobox=1
highlighting=1
keymap=1
no_drop_items_on_death=1


When enter combat the ammo box shows correct info, but after than it never seems to update or change. I change slots, I fire guns, I enter inventory, I change weapons, I reload, ....still no change. until I exit combat.

I have 223 pistol in one hand and FAL HPFA in other hand. For the FAL the ammo box doesn't even show up when I go into combat.

https://i.imgur.com/4is6a3T.png
https://i.imgur.com/VOkBulD.png
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Ammobox not updating

Post by Magus »

Split the topic, let's not conflate separate issues.

Attach debug.log and a savegame. UPU or RPU?
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Re: Ammobox not updating

Post by Cyrus »

Sure.

download it here: https://www11.zippyshare.com/v/KAj9Hrx3/file.html

I also use RPU 16.

The save file is one I use for testing. New file. Some edits using f2se.
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Ammobox not updating

Post by Magus »

And in future it's better to keep attachments on the forum, so they don't get lost.

Only gamemode hook is firing, that is strange. How do you change slots, weapons, reload?
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Re: Ammobox not updating

Post by Cyrus »

And in future it's better to keep attachments on the forum, so they don't get lost.
I tried but couldn't find a way to attach. Although now I just saw it down bellow.
 
Only gamemode hook is firing, that is strange. How do you change slots, weapons, reload?
I don't understand what you mean.. I do all of that normally, like any one else. I enter inventory, drop weapons into slots. I switch weapons with red button. I switch weapon mode by right click, and reload with reload button.

Only game mode hook is firing? That can't be. On my end much more was firing. It showed it in the log. Does it not say so?

I haven;t done anything unsual with my mod folder really. I installed falout 2 GOG version. Then RPU, then sfall 4.2.7, then fo2tweaks. Then I made normal edits to ini files like ddraw and ones in mod folder. The I started a new game. Made a character. then using save editor I added DT and DR resistances and hit points. Then I travelled to san fran to get weapons. and then some pew pew to test guns. So...

The only custom change I've made is adding my own ini file to mod folder and my own script. Which for this test I removed the int file from script folder. So...

This from log file I sent you:

Code: Select all

gl_g_ammobox: initialized

gl_g_carry_weight: initialized

gl_g_grenades_anywhere: enabled

gl_g_grenades_tohit: initialized

gl_g_highlighting: enabled

gl_g_highlighting: initialized

gl_g_keymap: remapping key F6 to F5

gl_g_keymap: remapped key code 64 to 63

gl_g_keymap: remapping key F7 to F8

gl_g_keymap: remapped key code 65 to 66

gl_g_keymap: remapping key F5 to F9

gl_g_keymap: remapped key code 63 to 67

gl_g_keymap: remapping key Home to J

gl_g_keymap: remapped key code 199 to 36

gl_g_keymap: initialized

gl_g_max_knockback: initialized

gl_g_light_level: initialized

gl_g_map_hotkey: initialized, worldmap key is 17, town map key is 21

gl_g_no_drop_items_on_death: initialized

I also re-attached the zip file here now as per your request.
Attachments
msgbox.zip
(1.74 MiB) Downloaded 310 times
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Ammobox not updating

Post by Magus »

I mean, from ammobox script only gamemode hook is firing. From your log:

Code: Select all

gl_g_ammobox: initialized
gl_g_ammobox: update box - gamemode
gl_g_ammobox: update box - gamemode
Cyrus wrote: Sun Oct 25, 2020 9:17 am I do all of that normally, like any one else. I enter inventory, drop weapons into slots. I switch weapons with red button. I switch weapon mode by right click, and reload with reload button.
Riiight... Actually, I never switch with the red button. I use either keyboard or mouse. Which is why it's not reacting on that event - never occured to me.
And switching weapons or ammo from inventory screen - that use case I also missed, needs to be added.

Edit: well, reloading from inventory is easy enough to fix, but for the red button InvenWield doesn't work, and the other only thing I can think of is tracking active hand in a gvar and updating it with each mouse click. Which seems pretty excessive. On the other hand, it'll happen only in combat...
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Ammobox not updating

Post by Magus »

Eh... mouseclick fires too early, too. I'm not sure if that's possible at all without a fast global loop, and I don't want to do that. Maybe you have any ideas?
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Re: Ammobox not updating

Post by Cyrus »

Well, I would say avoid "excessive" loop solutions.

One thing that comes to mind, a good trigger that fires often enough but not too often is calc_apcost hook. That might be a good place to run checks, because it runs everytime a new item or slot is selected and it reruns after a shot has been made. So that hook might be of use for you.

I would also say if you can't solve it perfectly, don't sweat it. See People don't need to know the ammo type all the time. But when they do wanna know it would be nice to have a simple way to check.

2 solurtions that come to mind are,

1. When player presses a binded button a message can be displayed in PDA saying your ammo is: ______ blah blah blah.

OR

2. when a button is pressed, the ammo box appears showing the current ammo, and either stays on while holding the button, OR  it works by being toggled. So you press it, it comes on, showing the ammo, you press it again, it dissapears. This way the player can manually update the data by pressing the button, and even if data shown is wrong, then by pressing again it will get updated.

In the absence the perfect solution, these solution I think are good enough. I think the average person would be happy to have it even like this.

I think the box looks nice and neat. But at the same time I feel I don't always need it on. Sometimes I feel distracted by it.

But anyway, how you wanna implement it is up to you and Its your creative choice and I don't wanna put limits on your creativity. And I think knowing the ammo is actually quite important so this feature in general is very important.

Those solutions are some I can think of.


OH I just rememebered, before running into this problem I had tried switching my ammo using the keyboard button, but it wouldn't work. So for changing ammo I have to open the inven screen.
Cyrus
Posts: 59
Joined: Tue Nov 20, 2018 12:34 pm

Re: Ammobox not updating

Post by Cyrus »

Having thought about it some more,

I think the "press and hold button" for box to show (just like item highlighting) or press button to "display_msg in PDA" (like time display) are the best, cleanest and simplest options, and you don't have to worry about complicated checks and hooks and code inefficiency.

Second best option is calc ap cost hook. I think calc ap cost will work for sure because it runs at beginning of turn and after any slot change and every attack or atkmode change or game mode change, which is all you need. But still not necessary. I find first option satisfactory as a player.

And if you wanna know exactly when ap_cost runs I'd say add a counter at begining of hook and then display counter everytime hook runs. Will tell you instant feedback on how it runs.

 
User avatar
Magus
Site Admin
Posts: 474
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Ammobox not updating

Post by Magus »

Excellent suggestion about CalcAPCost! I missed it entirely. Not only it works well, I also was able to drop some other hooks. It's released now.

Regarding tapping a key to display the box, it should be quite easy to implement, so feel free to submit a pull request if you wish. One obstacle could be finding a convenient and free key, though, as many are taken already.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Post Reply