Hello there. I am needing some help with formspecs.
I can't seem to find a tutorial on them anywhere, and I can't seem to understand it by looking at other's code. Could someone please give me a quick overview of them or something similar?
Thanks!
[Help] Formspecs [Solved]
[Help] Formspecs [Solved]
Last edited by MarkSill on Wed May 08, 2013 01:05, edited 1 time in total.
Are you a potato?
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Depends what formspec you want to have. If you want a node to have a formspec that opens on a rightclick, then you have to set it in the metadata. Default chests do this in on_construct(): https://github.com/minetest/common/blob ... .lua#L1774MarkSill wrote:Yeah, I looked at that, but where would it go in the code?
When you want to change the player's formspec, then you would call player:set_inventory_formspec(param) in register_on_joinplayer() with the formspec string as param.
Thanks so much!PilzAdam wrote:Depends what formspec you want to have. If you want a node to have a formspec that opens on a rightclick, then you have to set it in the metadata. Default chests do this in on_construct(): https://github.com/minetest/common/blob ... .lua#L1774MarkSill wrote:Yeah, I looked at that, but where would it go in the code?
When you want to change the player's formspec, then you would call player:set_inventory_formspec(param) in register_on_joinplayer() with the formspec string as param.
Are you a potato?
if you're searching for formspec and button, here is an example of a chest-type formspec with 2 buttons,one "take all" and one "put all"
i would have been very happy to find this an hour ago - as said above, the formspec docs do need a bit of a cleanup by someone who really understands them - they may be precise and accurate but lack understanding
junk_chest_formspec =
"size[8,10]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"..
"button[2,4;2,1;;zbutton;put all]"..
"button[5,4;2,1;;zbutton;take all]"
makes the standard chest inventory screen but with two buttons 'take all' and 'put all'
and so,
on_receive_fields = function(pos, formname, fields, sender)
if fields.zbutton == "put all" then...
if fields.zbutton == "take all" then...
end,
prints "take all" when the take all button is clicked, and 'put all" when the put all button is clicked
i would have been very happy to find this an hour ago - as said above, the formspec docs do need a bit of a cleanup by someone who really understands them - they may be precise and accurate but lack understanding
junk_chest_formspec =
"size[8,10]"..
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]"..
"button[2,4;2,1;;zbutton;put all]"..
"button[5,4;2,1;;zbutton;take all]"
makes the standard chest inventory screen but with two buttons 'take all' and 'put all'
and so,
on_receive_fields = function(pos, formname, fields, sender)
if fields.zbutton == "put all" then...
if fields.zbutton == "take all" then...
end,
prints "take all" when the take all button is clicked, and 'put all" when the put all button is clicked
MT IS MC'S SMARTER BROTHER
minetest 0.4.8 compiled from latest git on linux mint 15 with qjoypad and wired 360 controller
freeminer, pilztest, buildcraft and next are the idea factories
my minetest page is http://1337318.zymichost.com if zymic isn't down - meh, it is free...
minetest 0.4.8 compiled from latest git on linux mint 15 with qjoypad and wired 360 controller
freeminer, pilztest, buildcraft and next are the idea factories
my minetest page is http://1337318.zymichost.com if zymic isn't down - meh, it is free...
- Gael de Sailly
- Member
- Posts: 845
- Joined: Sun Jan 26, 2014 17:01
- GitHub: gaelysam
- IRC: Gael-de-Sailly
- In-game: Gael-de-Sailly gaelysam
- Location: Voiron, France
The lua_api has changed. Now, Formspec is at https://github.com/minetest/minetest/bl ... i.txt#L869.
Just realize how bored we would be if the world was perfect.
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
leetelate 2013-09-16 03:08:14 (Last post)
[Help] Formspecs [Solved]
Eh sorry, but how do you get the ideas to dig out SOLVED problems?
[Help] Formspecs [Solved]
Eh sorry, but how do you get the ideas to dig out SOLVED problems?
Last edited by Krock on Wed Mar 26, 2014 18:30, edited 1 time in total.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 27 guests