-
Notifications
You must be signed in to change notification settings - Fork 12
Save MultiBar position across sessions #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save MultiBar position across sessions #93
Conversation
Hokken
commented
Jan 23, 2026
- Add position persistence for the main MultiBot UI (MultiBar)
- Position is saved to MultiBotSave.MultiBarPosition on drag stop
- Position is restored on PLAYER_ENTERING_WORLD event
- Uses BOTTOMRIGHT anchor for consistent positioning
- Properly calculates coordinates relative to UIParent
- Add position persistence for the main MultiBot UI (MultiBar) - Position is saved to MultiBotSave.MultiBarPosition on drag stop - Position is restored on PLAYER_ENTERING_WORLD event - Uses BOTTOMRIGHT anchor for consistent positioning - Properly calculates coordinates relative to UIParent Co-Authored-By: Claude Opus 4.5 <[email protected]>
Hi! Thanks a lot for the PR and for taking the time to improve MultiBot. I really appreciate the effort. That said, the current addon already saves and restores the MultiBar position via MultiBotSave["MultiBarPoint"] on logout and restores it on ADDON_LOADED. Your patch introduces a second, parallel persistence path (MultiBotSave.MultiBarPosition) plus a new restore hook (PLAYER_ENTERING_WORLD), which duplicates existing logic and risks divergence between the two stored positions. It also re-implements coordinate math that we already centralize in MultiBot.toPoint(). I’d be happy to consider an updated version that reuses the existing save/restore path and helper instead of introducing a new one. For example, if the goal is to save immediately on drag stop, we can simply call the existing MultiBot.toPoint() and update MultiBotSave["MultiBarPoint"] there. Let me know if you’d like to update the PR along those lines, thanks again! |
Instead of introducing a parallel persistence path, this update: 1. Uses existing MultiBot.toPoint() helper on drag stop 2. Saves to existing MultiBotSave["MultiBarPoint"] key 3. Removes duplicate PLAYER_ENTERING_WORLD handler (ADDON_LOADED in MultiBotHandler.lua already restores from this key) This ensures position is saved immediately on drag stop while staying consistent with the existing save/restore architecture.
|
Hi! Thanks for the feedback - you're absolutely right. I've updated the PR to reuse the existing save/restore mechanism: Changes:
local tX, tY = MultiBot.toPoint(frame)
MultiBotSave["MultiBarPoint"] = tX .. ", " .. tY
This way, position is saved immediately on drag stop (no more waiting for logout), while staying consistent with the existing save/restore path. Let me know if this looks good! |
|
Closing this PR - the updated fix doesn't work as expected. Will investigate further and resubmit with a proper solution. |
|
Hi, I've reverted my changes for now. I tried to use the existing save/restore mechanism as you suggested, but I couldn't get it to work on my side. The position doesn't restore after a Could you confirm that the original position save/restore ( Thanks! |
|
Issue resolved - the position save/restore was working correctly all along. The problem was that my local addon folder was named "Multibot" (lowercase 'b') instead of "MultiBot" (uppercase 'B'), so the ADDON_LOADED event's arg1 never matched the condition. After renaming my folder, everything works as expected. Sorry for the confusion! |
|
Side note: the code could be made more robust by not relying on the folder name. Instead of checking if(event == "ADDON_LOADED" and MultiBot and not MultiBot._initialized) then
MultiBot._initialized = true
-- initialization code...
endThis would work regardless of folder naming/casing. |