Okay, I'll try to explain things. This may get long winded.
Every location in the NewUI is a combination of several factors. First is your UI_Character_Server.ini file. This tells EQ which UI you are using (i.e. the subdirectory name), and the basic locations of all windows in that UI.
Next are the XML files themselves. They lay out the locations of everything in a window, determining the location and size of any button, label, etc.
The INI and XML files are updated every time you CLOSE a window. When you open a window (inventory, pack, whatever) those locations are read into memory, and EQ addresses the memory directly to find those locations. When you close the window, the INI files and XML files are updated with the new information, i.e. whatever has changed since you opened the window (moved it, resized it, whatever.)
Once I had working code to move the mouse and click it (thanks NealThorpayt), I sat down and devised an algorithm for determing the location of anything on the screen. That algorithm became the "parser" you'll see referred to in any post about /mouseto or /click.
First, MQ determines which character is logged on, and which server he is on. That information is used to construct a string for the UI.ini file, UI_Character_Server.ini.
We then read that file to determine which UI you are using, which will give us a subdirectory to look in for XML files.
Next, we check your /mouseto or /click argument against locations.txt. That file is a "roadmap" to screen locations, providing us with a standardized set of names for our screen locations
Code: Select all
[auto]
UILabel=InventoryWindow
XMLFile=EQUI_Inventory.xml
ScreenID=IW_CharacterView
As you can see above, our standardized "location" for the autoequip area in your inventory window is called "auto".
We search locations.txt for your location, giving you an error message if we can't find it. If we find it, we then have 3 values to work with.
UILabel is the label in your UI_Character_Server.ini file for the base location of the window we need. In this case, for "auto", we need to find the entry in the ini file for InventoryWindow. We then pull the base location of that window from the ini file.
XMLFile is the XML file in your UI directory that corresponds to UILabel in your ini file. It tells us which file in your directory to read to get our actual screen location.
Finally, ScreenID is the label to search for inside the XML file to determine the position and size of our desired screen location within the window. That size and position are relative to the window location derived from UI_Character_Server.ini.
So:
Code: Select all
Base Window Location from INI + Position Inside Window from XML file + Half the Size of the Location from XML (so we click in the center) = Location on Screen
Since we read these locations from the files on your hard drive, not from memory, MQ will go to the wrong location if you open a window and then move it, since the files aren't updated till you close the window.
Now, there are a few locations hardcoded into the parser for the sake of backwards compatibility with the readme file. We could have just changed locations.txt, but since it is computer generated (a program that quickly scans the INI and XML files and builds a list of all locations) it was easier to put the translation directly into the source code, rather than edit locations.txt.
While it would be possible to read the locations directly from memory so that moving windows doesn't cause a problem, it would be very complicated. I was more interested in getting things working at the time I developed the current method, and, well, we didn't really know about that movement problem at the time anyway.
Next you will ask "why does my custom UI not work when yours does?" I'm afraid there's no simple answer. It has to do with the varying size of labels on the top of windows, or whether they exist or not. It has to do with the way the actual XML files of a custom UI are structured, and how close they are to complying with the default UI. Suffice it to say the biggest problem is with custom containers, and you are better off just using the default container file. In general custom inventories don't seem to be affected by this "bug", and I use a custom loot window that is not bothered in the slightest. The more radical your departure from the default UI, the more likely you are to run into problems.