formspec.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Formspec
  2. --------
  3. Formspec defines a menu. Currently not much else than inventories are
  4. supported. It is a string, with a somewhat strange format.
  5. Spaces and newlines can be inserted between the blocks, as is used in the
  6. examples.
  7. Examples:
  8. - Chest:
  9. size[8,9]
  10. list[current_name;main;0,0;8,4;]
  11. list[current_player;main;0,5;8,4;]
  12. - Furnace:
  13. size[8,9]
  14. list[current_name;fuel;2,3;1,1;]
  15. list[current_name;src;2,1;1,1;]
  16. list[current_name;dst;5,1;2,2;]
  17. list[current_player;main;0,5;8,4;]
  18. Elements:
  19. size[<W>,<H>]
  20. ^ Define the size of the menu in inventory slots
  21. ^ deprecated: invsize[<W>,<H>;]
  22. list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]
  23. ^ Show an inventory list
  24. image[<X>,<Y>;<W>,<H>;<texture name>]
  25. ^ Show an image
  26. ^ Position and size units are inventory slots
  27. field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]
  28. ^ Textual field; will be sent to server when a button is clicked
  29. ^ x and y position the field relative to the top left of the menu
  30. ^ w and h are the size of the field
  31. ^ fields are a set height, but will be vertically centred on h
  32. ^ Position and size units are inventory slots
  33. ^ name is the name of the field as returned in fields to on_receive_fields
  34. ^ label, if not blank, will be text printed on the top left above the field
  35. ^ default is the default value of the field
  36. ^ default may contain variable references such as '${text}' which
  37. will fill the value from the metadata value 'text'
  38. ^ Note: no extra text or more than a single variable is supported ATM.
  39. field[<name>;<label>;<default>]
  40. ^ as above but without position/size units
  41. ^ special field for creating simple forms, such as sign text input
  42. ^ must be used without a size[] element
  43. ^ a 'Write It' button will be added automatically
  44. label[<X>,<Y>;<label>]
  45. ^ x and y work as per field
  46. ^ label is the text on the label
  47. ^ Position and size units are inventory slots
  48. button[<X>,<Y>;<W>,<H>;<name>;<label>]
  49. ^ Clickable button. When clicked, fields will be sent.
  50. ^ x, y and name work as per field
  51. ^ w and h are the size of the button
  52. ^ label is the text on the button
  53. ^ Position and size units are inventory slots
  54. image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]
  55. ^ x, y, w, h, and name work as per button
  56. ^ image is the filename of an image
  57. ^ Position and size units are inventory slots
  58. button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]
  59. ^ When clicked, fields will be sent and the form will quit.
  60. image_button_exit[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]
  61. ^ When clicked, fields will be sent and the form will quit.
  62. Inventory location:
  63. - "current_name": Selected node metadata
  64. - "current_player": Player to whom the menu is shown
  65. - "player:<name>": Any player
  66. - "nodemeta:<X>,<Y>,<Z>": Any node metadata