[Mod] Formspex - Consistent Backgrounds [formspex]

Post Reply
User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

[Mod] Formspex - Consistent Backgrounds [formspex]

by orwell » Post

THIS MOD IS OBSOLETE
Its functionality is achieved by formspec prepends.

This mod makes all formspecs automatically look like they look in minetest_game. No work on the side of other mods is required.

-specific background image and colors for forms
-player inventory hotbar is highlighted in a darker color.

Depends: default
License: WTFPL
There are no textures and sounds

Notes: formspecs set by set_inventory_formspec and set_creative_formspec remain unchanged (would be too difficult to implement). For many containers, it is required to re-place the node.
I won't continue development on this mod except if bugs are found.

Latest version:
formspex_1_2.zip
v. 1.2
(1.7 KiB) Downloaded 144 times
-fixed: forms already declaring a background element (e.g. signs_lib) looked weird
-fixed some other stuff I don't remember

Old versions:
formspex.zip
v. 1.1
(1.45 KiB) Downloaded 92 times
- Fix: meta:from_table() not working
- Fix: showed a warning "invalid use of background without a size[] element" when using short form of field[] in formspecs (won't modify these forms.)
formspex.zip
v. 1.0
(1.45 KiB) Downloaded 95 times
Last edited by orwell on Thu Nov 07, 2019 12:07, edited 6 times in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [Mod] Formspex [formspex]

by 4aiman » Post

A screenie? Pretty please?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Formspex [formspex]

by orwell » Post

screenshot showing a craft-guide form.
nothing in craft-guide's source was changed.
Without Formspex
Without Formspex
fs_screenie_cg_no.png (225.39 KiB) Viewed 945 times
With Formspex
With Formspex
screenshot_1848063.png (102.62 KiB) Viewed 945 times
Highlighted Hotbar
Highlighted Hotbar
fs_screenie_hotbardark.png (15.18 KiB) Viewed 945 times
Last edited by orwell on Wed Aug 19, 2015 10:01, edited 1 time in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [Mod] Formspex [formspex]

by 4aiman » Post

A before/after image would be great :)
Anyways, judging by the code, this mod will add extra lag when opening inventories.

It is One Thing to concat strings while registering nodes (i.e. at a server startup) and The Other Thing to do that every time someone opens inventory. Aside from additional calculations this adds an extra delay - once the minetest.show_formspec is called the server will wait it to finish. The same goes to the get_meta replacement.



The idea of quickly changing formspecs IS great on it's own nevertheless.

To speed-up your code, try using a table.
Just populate it with the pieces of a formspec and then use table.concat.

Regards!

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

Re: [Mod] Formspex [formspex]

by Minetestforfun » Post

+1 for screens

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Formspex [formspex]

by rubenwardy » Post

The name was confusing to me, maybe put: [Mod] Formspex [formspex] - Consistent backgrounds
4aiman wrote:It is One Thing to concat strings while registering nodes (i.e. at a server startup) and The Other Thing to do that every time someone opens inventory. Aside from additional calculations this adds an extra delay - once the minetest.show_formspec is called the server will wait it to finish. The same goes to the get_meta replacement.
I doubt that the delay will be noticeable. Even with 40 players there won't be more than 100 opens per second. Optimise in the right places, in the places that need it most. If this was C++ or a lower level language, then yes these optimisations would be good.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Formspex [formspex]

by orwell » Post

rubenwardy wrote:The name was confusing to me, maybe put: [Mod] Formspex [formspex] - Consistent backgrounds
Thanks. I changed the title.
4aiman wrote:It is One Thing to concat strings while registering nodes (i.e. at a server startup) and The Other Thing to do that every time someone opens inventory. Aside from additional calculations this adds an extra delay - once the minetest.show_formspec is called the server will wait it to finish. The same goes to the get_meta replacement.
To the show_formspec method: It is a function, and so it is unpredictable for my mod what it will return.
To the meta replacement: every time a mod sets the "formspec" meta tag, the style information is added. (not every time someone opens formspecs). Again, it is unpredictable what the tag will be set to.
So, nothing can be set on load time.
rubenwardy wrote: I doubt that the delay will be noticeable. Even with 40 players there won't be more than 100 opens per second. Optimise in the right places, in the places that need it most. If this was C++ or a lower level language, then yes these optimisations would be good.
This is Lua, and Lua is great!
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [Mod] Formspex [formspex] - Consistent Backgrounds

by 4aiman » Post

@orwell
You don't have to explain anything to me, since I can't remember suggesting to use concatenation only at load-time. :/
Actually, I can't really tell why you decided I've told you to do that...


Anyway, I'd like to cite the other part of my message (which was the reason to post it):
4aiman wrote:To speed-up your code, try using a table.
Just populate it with the pieces of a formspec and then use table.concat.
^ This is really important. Just try it and you'll see the difference.

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

Re: [Mod] Formspex [formspex] - Consistent Backgrounds

by Minetestforfun » Post

Always no screens :(

EDIT : i see it, sorry and thank you :)
Last edited by Minetestforfun on Tue Aug 11, 2015 11:01, edited 1 time in total.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [Mod] Formspex [formspex] - Consistent Backgrounds

by 4aiman » Post

See this post, Minetestforrun: viewtopic.php?f=9&t=12939&p=186824#p185813

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Formspex [formspex] - Consistent Backgrounds

by orwell » Post

4aiman wrote:@orwell
Anyway, I'd like to cite the other part of my message (which was the reason to post it):
4aiman wrote:To speed-up your code, try using a table.
Just populate it with the pieces of a formspec and then use table.concat.
^ This is really important. Just try it and you'll see the difference.
Sorry, now I understand what you mean with this part of your post. I've seen it in another mod.
I will think about it.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Formspex - Consistent Backgrounds [formspex]

by amadin » Post

How change color for slots by using formspecx?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Formspex - Consistent Backgrounds [formspex]

by orwell » Post

just enable both your mod and this one.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Formspex - Consistent Backgrounds [formspex]

by amadin » Post

I mean change to not default color, for example to red.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Formspex - Consistent Backgrounds [formspex]

by orwell » Post

amadin wrote:I mean change to not default color, for example to red.
And I mean, just try to enable both your mod viewtopic.php?f=11&t=15640 and this one.
See what happens when you open e.g. a homedecor nightstand(it must have been placed after formspex was enabled)
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests