#How make multiple Hud with preserve title
1 messages · Page 1 of 1 (latest)
change one of the data_control to some other name
"display": {
"$update_string": "hud:a:",
"type": "label",
"text": "#text",
"controls": [
{
"data_control_2": { //here
"type": "panel",
"size": [
0,
0
],
"bindings": [
{
"binding_name": "#hud_title_text_string"
},
{
"binding_name": "#hud_title_text_string",
"binding_name_override": "#preserved_text",
"binding_condition": "visibility_changed"
},
{
"binding_type": "view",
"source_property_name": "(not (#hud_title_text_string = #preserved_text) and not ((#hud_title_text_string - $update_string) = #hud_title_text_string))",
"target_property_name": "#visible"
}
]
}
}
],
"bindings": [
{
"binding_type": "view",
"source_control_name": "data_control_2", //and here
"source_property_name": "(#preserved_text - $update_string)",
"target_property_name": "#text"
}
]
}
@dense wharf
Hey man
I couldn't find the exact post we talked about preserve title there,
But i need your help
You showed me how to do it months ago and i kept going adding more stuff until i accidentally typed " " on the title commad.
Or whatever you type inside the (" ") , it will update the elements. If you type normal text it won't interfere with the preserve title.
Can you fix it?😢
I don't quite understand your problem
Like the code you sent above
Try typing a title command in the game but instead of "hud:d" for example type only the " "
Or maybe anything like "whatever".
It will disable the ui
It probably has issue or something. Try it from the wiki
What I was saying here is to use a different name for the child control for each preserved text
Ok will try again and i will send the code if you have time
i am back , i tried copying the wiki but its the same problem
you can try your self , type /title @s title "whatever"
here is the code by you:
"hud_square": {
"type": "image",
"texture": "textures/ui/hud_square",
"bindings": [
{ "binding_type": "view",
"source_control_name": "data_control", // refer to the helper panel
"source_property_name": "((#preserved_text - 'show_hud_square') = ':true')", // its visibility drives this element
"target_property_name": "#visible"
}]},
"preserved_title_display": {
"$show_string": "show_hud_square:", // title must include this string to update the element
"type": "panel",
"controls": [
{"data_control": {
"type": "panel",
"size": [ 0, 0 ],
"bindings": [
{"binding_name": "#hud_title_text_string"},
{"binding_name": "#hud_title_text_string",
"binding_name_override": "#preserved_text",
"binding_condition": "visibility_changed"},
// element becomes visible then immediately turns invisible when a title containing the update string is passed
{
"binding_type": "view",
"source_property_name": "(not (#hud_title_text_string = #preserved_text) and not ((#hud_title_text_string - $show_string) = #hud_title_text_string))",
"target_property_name": "#visible"
}
]
}
}
]
},
"root_panel": {
"modifications": [
{
"array_name": "controls",
"operation": "insert_back",
"value": [
{"[email protected]_square": {}},
{"[email protected]_title_display":{}}
]}]}}```
Your issue appears because you are trying to set visibility of this element
You'll have to move the data control out of this element and then set visibility
And how is that?
Sorry I think I was mistaken
Btw so the image shows for any title?
The image show only for show_hud_square:true
you meant using the quotes only
i was trying without them
and yeah it's fixable
change the source_property_name in data_control to this:
(not (#hud_title_text_string = #preserved_text) and not (((#hud_title_text_string - '\"') - $show_string) = (#hud_title_text_string - '\"')))