{
"namespace": "slot_rows",
"item_slot@rust_inventory.container_item": { "size": [18, 18] },
"slot_stack": {
"type": "stack_panel",
"orientation": "vertical",
"size": ["100%c", 54],
"layer": 20,
"$item_collection_name|default": "container_items", //to do inventory change to inventory_items
"controls": [
{
"top_row@slot_rows.row_template": {
"controls": [
{ "item_0@slot_rows.item_slot": { "collection_index": 0 } },
{ "item_1@slot_rows.item_slot": { "collection_index": 1 } },
{ "item_2@slot_rows.item_slot": { "collection_index": 2 } },
{ "item_3@slot_rows.item_slot": { "collection_index": 3 } },
{ "item_4@slot_rows.item_slot": { "collection_index": 4 } },
{ "item_5@slot_rows.item_slot": { "collection_index": 5 } }
]
}
},
{ "spacer": { "type": "panel", "size": [18, 18] } },
{
"bottom_row@slot_rows.row_template": {
"controls": [
{ "item_6@slot_rows.item_slot": { "collection_index": 6 } },
{ "item_7@slot_rows.item_slot": { "collection_index": 7 } },
{ "item_8@slot_rows.item_slot": { "collection_index": 8 } },
{ "item_9@slot_rows.item_slot": { "collection_index": 9 } },
{ "item_10@slot_rows.item_slot": { "collection_index": 10 } },
{ "item_11@slot_rows.item_slot": { "collection_index": 11 } }
]
}
}
]
},
"row_template": {
"type": "stack_panel",
"size": ["100%c", 18],
"orientation": "horizontal",
"collection_name": "$item_collection_name"
}
}
``` this is the way i know of doing it though there's probably a better way
#How to split inventory grid
1 messages · Page 1 of 1 (latest)
Thank you!
And
"right_bottom_panel_root": {
"type": "panel",
"anchor_from": "bottom_right",
"anchor_to": "bottom_right",
"size": [
20,
100
],
"bindings": [
{
"binding_name": "#hud_title_text_string",
"binding_name_override": "#text",
"binding_type": "global"
},
{
"binding_type": "view",
"source_property_name": "('%.3s' * #text)",
"target_property_name": "#str_health"
},
{
"binding_type": "view",
"source_property_name": "('%.3s' * (#text- ('%.3s' * #text)))",
"target_property_name": "#str_regenerate"
},
{
"binding_type": "view",
"source_property_name": "('%.3s' * (#text- ('%.6s' * #text)))",
"target_property_name": "#str_water"
},
{
"binding_type": "view",
"source_property_name": "('%.3s' * (#text- ('%.9s' * #text)))",
"target_property_name": "#str_hunger"
}
]
}
why doesn't this work?
Is string formatting not allowed in this situation or is there another reason? I want to make a hud but I can't split the data into 4 parts
Or is the problem that it's #? Is it possible to turn # into $ and vice versa?
if your inputting numbers you may need to add something that will make sure the numbers stay strings like a letter or something here's a example then convert them into numbers if needed
{
// command used to test was /title @s title :111:222:333:444
"hud_content": {
"modifications": [
{
"array_name": "controls",
"operation": "insert_front",
"value": [
{
"label": {
"type": "label",
"anchor_from": "bottom_right",
"anchor_to": "bottom_right",
"size": ["default", "default"],
"font_size": "medium",
"layer": 7,
"text": "#text",
"bindings": [
{"binding_name": "#hud_title_text_string","binding_name_override": "#text","binding_type": "global"},
{"binding_type": "view","source_property_name":"('%.4s' * #text)","target_property_name":"#str_health"},
{"binding_type": "view","source_property_name":"('%.4s' * (#text - ('%.4s' * #text)))","target_property_name":"#str_regenerate"},
{"binding_type": "view","source_property_name":"('%.4s' * (#text - ('%.6s' * #text)))","target_property_name":"#str_water"},
{"binding_type": "view","source_property_name":"('%.4s' * (#text - ('%.9s' * #text)))","target_property_name":"#str_hunger"},
{
"binding_type": "view",
"source_property_name":"('§z' + (#str_health + '\n' + #str_regenerate + '\n' + #str_water + '\n' + #str_hunger))",
"target_property_name":"#text"
}
]
}
}
]
}
]
}
}
It doesn't work
"$t1": "test",
"$t2": "('%.2s'+$t1)",
"text": "$t2",
This works/ -> te
How to convert # to $
I ran what you wrote.
1 -> no changes
2-> "text": "test",