locations.txt improvement

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

AarynD
a lesser mummy
a lesser mummy
Posts: 45
Joined: Thu Jan 02, 2003 11:25 am

locations.txt improvement

Post by AarynD » Mon Jun 23, 2003 9:59 am

Using the default UI, I sometimes have problems with my cursor not landing exactly where it's supposed to on certain bags, buttons, etc. When using a custom UI, it's almost a certainty that the inventory slots and buttons won't line up anymore. Here's an idea to correct it.

Right now, MQ uses a file called LOCATIONS.TXT which spells out all the different ui elements mq will click on, and which xml files contain the location information. An example of the current locations.txt format is this:

[destroy]
UILabel=InventoryWindow
XMLFile=EQUI_Inventory.xml
ScreenID=IW_Destroy

This is the entry for the DESTROY button in the inventory window. In my UI, I cannot do a /click destroy, because the destroy button is modified and smaller than normal. Currently, what I do is /mouseto destroy, and then /mouseto x y rel in order to "fine tune" the cursor's position, and then just issue my /click left.

I've thought of a way to finetune the mouse outside of scripts, which would enable /mouseto and /click for almost any custom UI if it were put into MQ. The idea is to add 2 new lines to each entry in locations.txt. Make them OffsetX and OffsetY, and have them all default to 0 initially. When the code runs and reads locations.txt, have it read the x/y offset values, and "adjust" the cursor position after reading where it's at according to the xml definitions. Thus, the new entry from above would be:

[destroy]
UILabel=InventoryWindow
XMLFile=EQUI_Inventory.xml
ScreenID=IW_Destroy
OffsetX=0
OffsetY=-15

This example puts the cursor 15 pixels higher than would normally occur just using the straight xml definitions.

I'm not a C++ programmer, but this doesn't look like it would be too involved to add in. And it would open up MQ to almost any custom UI for the users, requiring only one-time modifications to this static text file by the user.

- Aaryn

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Jun 23, 2003 2:31 pm

An interesting idea, except that it will make it almost impossible to use CVS to update locations.txt if a major revision is necessary.

I use a custom UI, and have not trouble hitting anything except the "Done" button on a combiner... for some reason I can hit Combine, or Done on a standard pack, but if there are both Combine and Done buttons I can only hit Combine. Not sure why.

While it is true that some custom UI's have problems with the current location parser the vast majority work well. There will always be problems with individual interfaces having minor glitches, but this is currently the best GENERIC solution.

Additionally, what if you have multiple characters and they use different UI's? I use the same UI for all characters, but I'm willing to bet others don't. This means you'd have to have multiple locations.txt files, one for each UI, and backup/rename the file every time you switched characters.

Thanks for the suggestion though. The best solution is for us to fine tune our parser to make it function better, handling such things as title bars, strange button sizes, etc.
MQ2: Think of it as Evolution in action.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Mon Jun 23, 2003 2:52 pm

I was wondering about that myself McKorr.

The button sizes and pretty much everything about the container window is defined in the xml file for the container.

Would it be possible to improve on the xml parser to find these?

Extracted from the default EQUI_Container.xml file:

Code: Select all

	<Button item = "Container_Combine">
		<ScreenID>Container_Combine</ScreenID>
		<!--<Font>3</Font>-->
		<RelativePosition>true</RelativePosition>
		[b]<Location>
			<X>16</X>
			<Y>288</Y>
		</Location>
		<Size>
			<CX>60</CX>
			<CY>20</CY>
		</Size>[/b]
		<Style_VScroll>false</Style_VScroll>
		<Style_HScroll>false</Style_HScroll>
		<Style_Transparent>false</Style_Transparent>
		<!--<TooltipReference/>-->
		<Style_Checkbox>false</Style_Checkbox>
		<!--<RadioGroup/>-->
		<Text>Combine</Text>
		<TextColor>
				<R>255</R>
				<G>255</G>
				<B>255</B>
		</TextColor>
		<ButtonDrawTemplate>
			<Normal>A_SmallBtnNormal</Normal>
			<Pressed>A_SmallBtnPressed</Pressed>
			<Flyby>A_SmallBtnFlyby</Flyby>
			<Disabled>A_SmallBtnDisabled</Disabled>
			<PressedFlyby>A_SmallBtnPressedFlyby</PressedFlyby>
		</ButtonDrawTemplate>
	</Button>

	<Button item = "Container_DoneButton">
		<ScreenID>DoneButton</ScreenID>
		<!--<Font>3</Font>-->
		<RelativePosition>true</RelativePosition>
		[b]<Location>
			<X>21</X>
			<Y>316</Y>
		</Location>
		<Size>
			<CX>50</CX>
			<CY>24</CY>
		</Size>[/b]
		<Style_Transparent>false</Style_Transparent>
		<!--<TooltipReference/>-->
		<Style_Checkbox>false</Style_Checkbox>
		<!--<RadioGroup/>-->
		<Text>Done</Text>
		<TextColor>
			<R>255</R>
			<G>255</G>
			<B>255</B>
		</TextColor>
		<ButtonDrawTemplate>
			<Normal>A_BtnNormal</Normal>
			<Pressed>A_BtnPressed</Pressed>
			<Flyby>A_BtnFlyby</Flyby>
			<Disabled>A_BtnDisabled</Disabled>
			<PressedFlyby>A_BtnPressedFlyby</PressedFlyby>
		</ButtonDrawTemplate>
	</Button>
Window definitions... bolded relevant portions

Code: Select all

	<Screen item = "ContainerWindow">
		<!--<ScreenID/>-->
		<!--<Font/>-->
		<RelativePosition>false</RelativePosition>
		<Location>
			<X>350</X>
			<Y>100</Y>
		</Location>
		<Size>
			<CX>96</CX>
			<CY>366</CY>
		</Size>
		<Text>Container</Text>
		<Style_VScroll>false</Style_VScroll>
		<Style_HScroll>false</Style_HScroll>
		<Style_Transparent>false</Style_Transparent>
		<TooltipReference>Container</TooltipReference>
[b]		<DrawTemplate>WDT_Rounded</DrawTemplate>
		<Style_Titlebar>true</Style_Titlebar>[/b]
		<Style_Closebox>true</Style_Closebox>
		<Style_Minimizebox>false</Style_Minimizebox>
		<Style_Border>true</Style_Border>
		<Style_Sizable>false</Style_Sizable>
		<Pieces>Container_Label</Pieces>
		<Pieces>Container_Icon</Pieces>
		<Pieces>ContainerSlot1</Pieces>
		<Pieces>ContainerSlot2</Pieces>
		<Pieces>ContainerSlot3</Pieces>
		<Pieces>ContainerSlot4</Pieces>
		<Pieces>ContainerSlot5</Pieces>
		<Pieces>ContainerSlot6</Pieces>
		<Pieces>ContainerSlot7</Pieces>
		<Pieces>ContainerSlot8</Pieces>
		<Pieces>ContainerSlot9</Pieces>
		<Pieces>ContainerSlot10</Pieces>
		<Pieces>Container_Combine</Pieces>
		<Pieces>Container_DoneButton</Pieces>
	</Screen>

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Tue Jun 24, 2003 6:37 pm

I'm sure the parser can use improvement, feel free :)

The parser does use the values for X,Y and CX,CY from the XML files:

Center of Button = Base Window Position (from UI_Char_##.ini) plus XY from the appropriate UI.XML file plus Half CX/CY (which are the button size).

As for the title bar... find someplace in the UI files where it's size is defined and we can fix that part. Or heck, give us a better algorithm for calculating the locations and we can adjust the parser.

All that locations.txt is for is to tell us which XML file to look for, and what ScreenID in that XML file to search for. Instead of fiddling with that (it's a kluge, but it works) we need to tune the parser algorithm.
MQ2: Think of it as Evolution in action.