ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   Save last used chat type for each chat tab? (https://www.esoui.com/forums/showthread.php?t=2106)

Baertram 08/12/14 05:42 AM

Save last used chat type for each chat tab?
 
Maybe this was asked before but I could not find it with the forum's search.
So I'll ask again:

Is there a possibility to save the channel you have last written in for each chat tab?

For example:
Tab 1: General chat -> Last talkted in /z
Tab 2: Guilds -> Last talked in /g2
Tab 3: Group -> Last talked in /p
Tab 4: Tells -> Last talked to /t player1

Currently eso is not remembering the last chat command, if you switch between the tabs.
But I'd love to get it to this behaviour :-)

Thanks for any ideas, hints to existing addons etc.

zgrssd 08/12/14 06:36 AM

There are no direct events to work with the Chat tabs. I can't even be notified of name changes or categories being toggeled (UCT has to use a timer to save changes and that in 2014).

There might be some pre-hook event or direct access to the UI element wich allows you to be notified if the active tab changes, but I avoid those areas.

There is no direct way to set the chat channel either. However, if you use Startmessage with a proper channel /slashID (not the same as a slash command!), it will switch to that channel.
But again, there migh be some undokumneted way for this.

Baertram 08/12/14 08:28 AM

OK, this is like the answer I had expected. Too bad :-( Thanks for your input!

Maybe someone has tested this already:
At which time do the events EVENT_CHAT_CHANNEL_JOIN and EVENT_CHAT_CHANNEL_LEAVE fire? If you join a specific chat channel (like "zone" or "zonefr"), and if you leave it by changing to another channel?

If this would be the case one could try to get the currently active control of the chat tabs (if any variable is telling us that the tab is currently selected. Maybe it is :HasFocus() ) and save the channel name upon change to a table.
I assume that we can read the channelname somehow...
When the even EVENT_CHAT_CHANNEL_JOIN is fired the active chat tab could be determined again and the saved channelname will be added to the beginning of send messages, or will be put into the edit control where we start to type the text).

Many maybes :-) I'll try it as I find the time.

zgrssd 08/12/14 08:44 AM

Quote:

Originally Posted by Baertram (Post 11407)
OK, this is like the answer I had expected. Too bad :-( Thanks for your input!

Maybe someone has tested this already:
At which time do the events EVENT_CHAT_CHANNEL_JOIN and EVENT_CHAT_CHANNEL_LEAVE fire? If you join a specific chat channel (like "zone" or "zonefr"), and if you leave it by changing to another channel?

If this would be the case one could try to get the currently active control of the chat tabs (if any variable is telling us that the tab is currently selected. Maybe it is :HasFocus() ) and save the channel name upon change to a table.
I assume that we can read the channelname somehow...
When the even EVENT_CHAT_CHANNEL_JOIN is fired the active chat tab could be determined again and the saved channelname will be added to the beginning of send messages, or will be put into the edit control where we start to type the text).

Many maybes :-) I'll try it as I find the time.

Install bug eater and type "/zgoo events" into the chat. You get a nice overview of every event that is fired and can even look at the parameters.

As far as I can tell those Events are no longer used. There were used for the old beta version API wich allowed custom channels (and addons changing the channel, via CreateChannel, JoinChannel). The respective functions have been removed.

Garkin 08/12/14 08:52 AM

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("ChatMemory", EVENT_PLAYER_ACTIVATED, function(event)
  2.    EVENT_MANAGER:UnregisterForEvent("ChatMemory", event)
  3.  
  4.    local sv = {}
  5.  
  6.    --save current settings
  7.    ZO_PreHook(CHAT_SYSTEM, "ValidateChatChannel", function(self)
  8.       local tabIndex = self.primaryContainer.currentBuffer:GetParent().tab.index
  9.       sv[tabIndex] = sv[tabIndex] or {}
  10.       sv[tabIndex].channel = self.currentChannel
  11.       sv[tabIndex].target = self.currentTarget
  12.    end)
  13.  
  14.    --load settings
  15.    ZO_PreHook(CHAT_SYSTEM.primaryContainer, "HandleTabClick", function(self, tab)
  16.       local tabIndex = tab.index
  17.       if sv[tabIndex] then
  18.          CHAT_SYSTEM:SetChannel(sv[tabIndex].channel, sv[tabIndex].target)
  19.       end
  20.    end)
  21. end)
Code above works just for primary container, but it should be sufficient as it's not possible to have more chat containers without addons (ChatMultiWindow).

Baertram 08/12/14 09:04 AM

Is there anything you haven't tried/coded with ESO yet, Garkin? :-)
Many many thanks! I'll test it when I get home later.

Baertram 08/12/14 08:12 PM

FCO Chat Tab Brain
 
I coded this simple addon with your code:
FCO Chat Tab Brain

Maybe someone else likes this possibility too.


All times are GMT -6. The time now is 11:39 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI