[Solved] Refreshing the menu using ZForms

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

[Solved] Refreshing the menu using ZForms

Postby Jarewill » Thu Jul 29, 2021 2:00 pm

Recently I started using ZForms for making my custom menus, however I have encountered a small problem.
I don't know how to refresh the current menu so it would get redrawn.

My use case is drawing an inventory and letting the player discard items from it, however when the item is discarded, it remains in the inventory and causes a VM abort.
I currently use Init(mParentMenu) to do it, and while it works, it also breaks all the buttons and makes the menu unusable.
I also tried putting the item drawing function into Ticker() instead of Init(), but that also broke the buttons, only giving the player a very tiny window when they are usable.

Does anyone here know how should I approach this situation?

Edit: Okay, I managed to fix this by replacing Init with SetMenu and waiting 1 tic before doing that, so a network event passes.
For those curious:
Code: Select allExpand view
    bool restartint restimer;
Override void Ticker()
Override void Init(Menu parent)
let parmnu ZFMenuBase(parent);
Joined: 21 Jul 2019

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest