Is it possible to have some function called when a particular formspec is closed?
Obviously, I can call a function before calling minetest:close_formspec, but this would not catch all cases of the formspec closing (for example, the player pressing Escape).
trigger on formspec close
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: trigger on formspec close
The formspec will be submitted with a quit field set to "true" when ESC or a button exit is pressed
- sorcerykid
- Member
- Posts: 1841
- Joined: Fri Aug 26, 2016 15:36
- GitHub: sorcerykid
- In-game: Nemo
- Location: Illinois, USA
Re: trigger on formspec close
The ActiveFormspecs mod provides notification via callback of all conditions in which a formspec is closed (whether it be server shutdown, player killed, player logged off, etc.) through the use of signal events.
[Mod] ActiveFormspecs [formspecs]
[Mod] ActiveFormspecs [formspecs]
Re: trigger on formspec close
Thanks! It seems that documentation is missing for this feature, though: https://github.com/minetest/minetest/pull/7717rubenwardy wrote:The formspec will be submitted with a quit field set to "true" when ESC or a button exit is pressed
Re: trigger on formspec close
I was aware of ActiveFormspecs, which seems interesting. I was looking for something more lightweight, though. Basically, I want to be able to detect when player interactions are not limited by the formspec anymore, and if the player logs off, for example, the ActiveFormspecs logic might force me to do another check since the logoff would "limit" player interactions, too.sorcerykid wrote:The ActiveFormspecs mod provides notification via callback of all conditions in which a formspec is closed (whether it be server shutdown, player killed, player logged off, etc.) through the use of signal events.
[Mod] ActiveFormspecs [formspecs]
- sorcerykid
- Member
- Posts: 1841
- Joined: Fri Aug 26, 2016 15:36
- GitHub: sorcerykid
- In-game: Nemo
- Location: Illinois, USA
Re: trigger on formspec close
Ah okay. Well in fairness you did originally specify "all cases of the formspec closing" ;D
Who is online
Users browsing this forum: No registered users and 2 guests