#How make multiple Hud with preserve title

1 messages · Page 1 of 1 (latest)

feral anchor
#

hello im making a multiple hud using preserve title but when i send the title although the second hud have as update string "hud:b" it updates anyway anybody can help me?

this is the code:

#

How make multiple Hud with preserve title

dense wharf
#

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"
                        }
                    ]
                }
glass tulip
#

@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?😢

dense wharf
glass tulip
dense wharf
#

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

glass tulip
glass tulip
# dense wharf It probably has issue or something. Try it from the wiki What I was saying here ...

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":{}}
        ]}]}}```
dense wharf
dense wharf
#

Sorry I think I was mistaken

Btw so the image shows for any title?

glass tulip
#

The image show only for show_hud_square:true

dense wharf
#

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 - '\"')))