Skip to content

Conversation

@Hokken
Copy link

@Hokken 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 <noreply@anthropic.com>
@Wishmaster117
Copy link
Owner

  • 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

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.
@Hokken
Copy link
Author

Hokken commented Jan 25, 2026

Hi! Thanks for the feedback - you're absolutely right.

I've updated the PR to reuse the existing save/restore mechanism:

Changes:

  1. OnDragStop now uses the existing helper and key:
local tX, tY = MultiBot.toPoint(frame)
MultiBotSave["MultiBarPoint"] = tX .. ", " .. tY
  1. Removed the duplicate PLAYER_ENTERING_WORLD handler and MultiBotSave.MultiBarPosition - the existing ADDON_LOADED handler in MultiBotHandler.lua already restores from MultiBotSave["MultiBarPoint"].

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!

@Hokken
Copy link
Author

Hokken commented Jan 25, 2026

Closing this PR - the updated fix doesn't work as expected. Will investigate further and resubmit with a proper solution.

@Hokken Hokken closed this Jan 25, 2026
@Hokken
Copy link
Author

Hokken commented Jan 25, 2026

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 /reload or relog.

Could you confirm that the original position save/restore (MultiBotSave["MultiBarPoint"] via PLAYER_LOGOUT / ADDON_LOADED) is actually working on your side?

Thanks!

@Hokken
Copy link
Author

Hokken commented Jan 25, 2026

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!

@Hokken
Copy link
Author

Hokken commented Jan 25, 2026

Side note: the code could be made more robust by not relying on the folder name. Instead of checking arg1 == "MultiBot", you could check for the addon's own global:

if(event == "ADDON_LOADED" and MultiBot and not MultiBot._initialized) then
    MultiBot._initialized = true
    -- initialization code...
end

This would work regardless of folder naming/casing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants