I'm asking for help with alternate-ui

I use alternate-ui. I’m getting JSON. Getting the coordinates of the game window:

Спойлер
"ReadFromWindowResult": {
        "Completed": {
            "processId": 11284,
            "windowClientRectOffset": {
                "x": 8,
                "y": 31
            },

How do I get the coordinates of a found object in the game? For example, I find Arkonor. Here is the JSON string:

Спойлер
	{
		"pythonObjectAddress": "2341861547928",
		"pythonObjectTypeName": "InvItem",
		"dictEntriesOfInterest": {
			"_name": "ItemEntry_22",
			"children": {
				"address": "2341861547704",
				"pythonObjectTypeName": "PyChildrenList"
			},
			"_sr": {
				"entriesOfInterest": {}
			},
			"_displayY": 0,
			"_width": 64,
			"_displayWidth": 64,
			"_height": 103,
			"_displayX": 0,
			"_top": 0,
			"_opacity": 1,
			"_left": 0,
			"_displayHeight": 103
		},
		"otherDictEntriesKeys": null,
		"children": [
			{
				"pythonObjectAddress": "2341861545744",
				"pythonObjectTypeName": "Container",
				"dictEntriesOfInterest": {
					"_name": "MainContainer",
					"children": {
						"address": "2341861547088",
						"pythonObjectTypeName": "PyChildrenList"
					},
					"_displayY": 0,
					"_displayWidth": 64,
					"_displayX": 0,
					"_opacity": 1,
					"_displayHeight": 103
				},
				"otherDictEntriesKeys": null,
				"children": [
					{
						"pythonObjectAddress": "2341861547256",
						"pythonObjectTypeName": "InvItemIconContainer",
						"dictEntriesOfInterest": {
							"_name": "IconContainer",
							"children": {
								"address": "2341861547200",
								"pythonObjectTypeName": "PyChildrenList"
							},
							"_displayY": 0,
							"_width": 0,
							"_displayWidth": 64,
							"_height": 64,
							"_displayX": 0,
							"_top": 0,
							"_opacity": 1,
							"_left": 0,
							"_displayHeight": 64
						},
						"otherDictEntriesKeys": null,
						"children": [
							{
								"pythonObjectAddress": "2341326699824",
								"pythonObjectTypeName": "ContainerAutoSize",
								"dictEntriesOfInterest": {
									"_name": "qtypar",
									"_bgColor": {
										"address": "2341863692312",
										"pythonObjectTypeName": "tuple"
									},
									"children": {
										"address": "2341859264216",
										"pythonObjectTypeName": "UIChildrenListAutoSize"
									},
									"_displayY": 45,
									"_width": 22,
									"_displayWidth": 22,
									"_height": 17,
									"_displayX": 40,
									"_top": 2,
									"_opacity": 1,
									"_left": 2,
									"_displayHeight": 17
								},
								"otherDictEntriesKeys": null,
								"children": [
									{
										"pythonObjectAddress": "2341834179864",
										"pythonObjectTypeName": "EveLabelSmall",
										"dictEntriesOfInterest": {
											"_color": {
												"aPercent": 100,
												"rPercent": 100,
												"gPercent": 100,
												"bPercent": 100
											},
											"_displayY": 1,
											"_width": 22,
											"_setText": "20",
											"_displayWidth": 14,
											"_height": 17,
											"_displayX": 4,
											"_displayHeight": 16
										},
										"otherDictEntriesKeys": null,
										"children": null
									}
								]
							},
							{
								"pythonObjectAddress": "2341723325440",
								"pythonObjectTypeName": "Container",
								"dictEntriesOfInterest": {
									"children": {
										"address": "2341818942576",
										"pythonObjectTypeName": "PyChildrenList"
									},
									"_displayY": 0,
									"_displayWidth": 64,
									"_displayX": 0,
									"_opacity": 1,
									"_displayHeight": 64
								},
								"otherDictEntriesKeys": null,
								"children": [
									{
										"pythonObjectAddress": "2341818943192",
										"pythonObjectTypeName": "Icon",
										"dictEntriesOfInterest": {
											"_name": "icon",
											"_color": {
												"aPercent": 100,
												"rPercent": 100,
												"gPercent": 100,
												"bPercent": 100
											},
											"_displayY": 0,
											"_width": 64,
											"_displayWidth": 64,
											"_height": 64,
											"_displayX": 0,
											"_top": 0,
											"_texturePath": "res:/ui/texture/icons/23_64_5.png",
											"_left": 0,
											"_displayHeight": 64
										},
										"otherDictEntriesKeys": null,
										"children": null
									}
								]
							}
						]
					},
					{
						"pythonObjectAddress": "2341861546808",
						"pythonObjectTypeName": "Label",
						"dictEntriesOfInterest": {
							"_name": "itemNameLabel",
							"_color": {
								"aPercent": 75,
								"rPercent": 100,
								"gPercent": 100,
								"bPercent": 100
							},
							"_displayY": 66,
							"_setText": "<center><localized hint=\"Arkonor\">Arkonor*</localized>",
							"_displayWidth": 70,
							"_height": 18,
							"_displayX": {
								"int": "4294967293",
								"int_low32": -3
							},
							"_displayHeight": 18
						},
						"otherDictEntriesKeys": null,
						"children": null
					}
				]
			}
		]
	}

The View Parsed User Interface shows x=258, y=288. I don’t see anywhere in the JSON string from which to calculate similar values.

1 Like

To get the offset relative to the whole window, you have to add up all the offsets on the path from the root to the UI node in question.

Here you can see how to sum up the offsets:

To get the offsets of each node relative to their parent, use the _displayX and _displayY properties:

Thank you very much. I’ll try to figure it out.