Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Module] Save/load window locations
#1
So I was a little annoyed at having to move all the module windows when I load up the bot and went about figuring out how to get it to save the positions.

This plugin is very simple to use. You position all your default FFXIVMinion windows then hit the "Save Window Locations" button. Next time you open the bot, all you need to do is hit the "Load Window Locations" button and the window locations will be pre-set so when you open them, they will be in the same place as last time. I have it bound to a button instead of set when the module loads because if you're like me you occasionally change the game's resolution, and I don't like losing windows off the side because I've saved it there before I re-sized the game window.

The module covers these windows:
FFXIVMinion
MeshManager
SkillBook
Radar
Dev
GatherManager
SkillManager
Skill Editor

It doesn't cover:
Console (this seems to save on its own)
3rd party modules (anything that doesn't come with the basic install of FFXIVMinion)

There's three bugs with this at the moment I'm aware of (and I know how to fix one, I'm just lazy to do it at 2am in the morning). So please read them before you run the module so you don't come in here asking why these things are happening.

First bug has to do with pressing the LOAD button before you've ever saved anything. If you do this, all the windows will default to the top left corner and be shrunk to tiny boxes. There's more enough of the window that you can still select and resize it though, so it wont ruin anything if you mess up and hit LOAD before you hit SAVE (this only applies to the first time you run it). I know exactly how to fix this, and I'll do so in the next couple days if I don't get swamped by work.

Second bug has to do with "MeshManager". For some reason, this window gets its position and size set when it is opened. I can't see any way around this other than the devs changing the way this is handled in their code (so it doesn't pre-set its location to be next to the FFXIVMinion window every time someone opens it). If there is a way, and I'm just too blind to see it please let me know. For now the easy workaround is to just hit the load button again after you open the meshmanager window and it will snap to it's previously saved position :)

Third bug is the all the useless crap in the window ('attention' text field, 'main' group). I forgot about it. I'll remove it next update. Cleaned it up and reduced the default window size so it's just the buttons. If you want to use the new "default size" window, delete the settings file in the ChocMeOut folder. This will also delete any other window settings too, so keep that in mind. Otherwise, just re-size the module window yourself and you'll be fine :)

If you're a dev and would like to see this module support your module, please post in here and I'll make the addition as soon as I can (including adding it to the list above of supported windows, with link to your thread). Otherwise, feel free to use the code in this module to give your own module the ability to save and load its location, but please give me a 'thanks' in your thread :)


Attached Files
.rar   ChocMeOut v2.rar (Size: 1.77 KB / Downloads: 38)
#2
Code:
RegisterEventHandler("Gameloop.Update",ChocMeOut.OnUpdateHandler) -- the normal pulse from the gameloop
You don't have OnUpdateHandler function.

Nice work
#3
(10-15-2013, 10:14 AM)KaWeNGoD Wrote:  
Code:
RegisterEventHandler("Gameloop.Update",ChocMeOut.OnUpdateHandler) -- the normal pulse from the gameloop
You don't have OnUpdateHandler function.

Nice work

I can take that out... I started by making modifications to the hit point sample provided at github (that doesn't work btw) - some pieces obviously got forgotten about and left behind.

It's a two button, click to do something module. It doesn't need to do anything on pulse.

I also know I can handle saving the settings in a more effective manner too, but that's not how I ended up doing it.
#4
The way to solve your meshmanager problem would be to either hook or overwrite the mm.ToggleMenu() function and remove the line

Code:
GUI_MoveWindow( mm.mainwindow.name, wnd.x+wnd.width,wnd.y)

Overwriting:
When the lua interpreter loads modules it does so in a specific order specified by the "Dependencies=xyz" line in module.def for each module. If you set your module to be dependent on FFXIVMINION, for example, with "Dependencies=FFXIVMINION", it means your module will be loaded after FFXIVMINION (which contains ffxiv_mesher.lua). This gives you access to a very nice property of lua, which is that if multiple definitions of a function are present only the last definition will be used. This means that you can simply copy and paste mm.ToggleMenu(), place it in your own module code, and remove the line. At runtime, your function will be called instead of the one in ffxiv_mesher.lua. You can use this property to have your module change default functionality without actually modifying any of the base code.

Hooking:
Another convenient property of lua is how easy it is to hook a function. I won't go into the intricacies of hooking but its a cleaner method of function modification than overwriting since you don't have to update every time the original function is updated. Here's a snippet from a wow lua book that explains it pretty well and gives an example:

http://books.google.com/books?id=tFZyUCo...ng&f=false

Note that in order for hooking to work properly you still need to make your module dependent on whatever module contains the function you want to hook.
 


Forum Jump:


Users browsing this thread: 4 Guest(s)

We help you win the game.

FFXIV Bot and More.

 

Products