Dinamically change text in formspecs?

Post Reply
User avatar
runs
Member
Posts: 2060
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Dinamically change text in formspecs?

by runs » Post

Is it possible to dinamically change the text in formspecs? Without reloading the form again I mean.
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: Dinamically change text in formspecs?

by texmex » Post

Have a look at ActiveFormspecs.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
v-rob
Developer
Posts: 813
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Dinamically change text in formspecs?

by v-rob » Post

No, it is impossible, no matter what mod you use. ActiveFormspecs probably makes it simpler to use (I haven't looked much, I prefer the raw stuff), but the engine limitation remains.
GUI Core Developer | My Best Mods: Bridger - Slats - Stained Glass | To contact me, send a PM

User avatar
Linuxdirk
Member
Posts: 2711
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Dinamically change text in formspecs?

by Linuxdirk » Post

runs wrote:Without reloading the form again I mean.
No, not without reloading it. Formspecs are static.

User avatar
runs
Member
Posts: 2060
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: Dinamically change text in formspecs?

by runs » Post

It is for my WIP Dialogue Mod. It is fundamentral to me a form to set the changing dialogue in a cool and easy way.
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

micheal65536
Member
Posts: 167
Joined: Mon May 22, 2017 20:27

Re: Dinamically change text in formspecs?

by micheal65536 » Post

When you show a form using minetest.show_formspec you pass a "name" for the form (which is also passed to your formspec handler callback if you want to respond to e.g. button clicks in the form). If you later show another form with the same name (and to the same player), this will replace the previous form without the player needing to re-load the form (i.e. it will immediately update what the player sees). So all you need to do is re-generate the entire form with the new text in response to whatever event triggered the change, and then show this to the player as you normally would.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest