BiggerChatWindow = {} BiggerChatWindow.name = "BiggerChatWindow" function BiggerChatWindow:Initialize() end function BiggerChatWindow.OnAddOnLoaded(event, addonName) CHAT_SYSTEM['maxContainerHeight'] = 1200 CHAT_SYSTEM['maxContainerWidth'] = 1800 if addonName == BiggerChatWindow.name then BiggerChatWindow:Initialize() end end EVENT_MANAGER:RegisterForEvent(BiggerChatWindow.name, EVENT_ADD_ON_LOADED, BiggerChatWindow.OnAddOnLoaded)
local RegistgeredEventName = "BiggerChatWindow_OnLoaded" local function OnAddOnLoaded(event, addonName) if(addonName ~= "BiggerChatWindow") then return end CHAT_SYSTEM['maxContainerHeight'] = 1200 CHAT_SYSTEM['maxContainerWidth'] = 1800 end EVENT_MANAGER:RegisterForEvent(RegistgeredEventName , EVENT_ADD_ON_LOADED, OnAddOnLoaded)You only need to give a name for this event registration if you plan to remove it at runtime (not normally the case).
By the way did you know that similar 'addon' (in quotes, because it contains just 2 lines of code) already exists?
Alisu's Chat Enlarge
FYI, there is a "Scale UI" Slider under Interface. It's sole job is to make all windows/tooltips slightly bigger.
You are also requried to put in a Disclaimer into the addon since 1.2.3 went live:
http://www.esoui.com/forums/showpost.php?p=9931&postcount=8
Lets lookt at te code a bit:BiggerChatWindow = {} BiggerChatWindow.name = "BiggerChatWindow" function BiggerChatWindow:Initialize() end function BiggerChatWindow.OnAddOnLoaded(event, addonName) CHAT_SYSTEM['maxContainerHeight'] = 1200 CHAT_SYSTEM['maxContainerWidth'] = 1800 if addonName == BiggerChatWindow.name then BiggerChatWindow:Initialize() end end EVENT_MANAGER:RegisterForEvent(BiggerChatWindow.name, EVENT_ADD_ON_LOADED, BiggerChatWindow.OnAddOnLoaded)
The basic idea seems simple and solid enough (setting the max high/width to full UI size).
There is only basic coding stuff you should look out for:
Avoid using global variables like the black death. Global means "shared between every addon and the Zenimax code itself". Never use global unless you absolutely need to do it. You never know wich other code might be interfering with you or your with them. If you write a libraraiy, use LibStub to expose it globally.
The initialise function seems rather useless (it is empty). And in the OnLoaded you run the code before checking if that is your addons on laoded event (every registered on loaded event is run once for every addon that is executed).
Working that all in I would propably write it like this:local RegistgeredEventName = "BiggerChatWindow_OnLoaded" local function OnAddOnLoaded(event, addonName) if(addonName ~= "BiggerChatWindow") then return end CHAT_SYSTEM['maxContainerHeight'] = 1200 CHAT_SYSTEM['maxContainerWidth'] = 1800 end EVENT_MANAGER:RegisterForEvent(RegistgeredEventName , EVENT_ADD_ON_LOADED, OnAddOnLoaded)You only need to give a name for this event registration if you plan to remove it at runtime (not normally the case).
If you don't, just leave it blank/nil.
Every addon can use saved variables. You propably want account wide ones:crabby654b14_ESO wrote: »FYI, there is a "Scale UI" Slider under Interface. It's sole job is to make all windows/tooltips slightly bigger.
You are also requried to put in a Disclaimer into the addon since 1.2.3 went live:
http://www.esoui.com/forums/showpost.php?p=9931&postcount=8
Lets lookt at te code a bit:BiggerChatWindow = {} BiggerChatWindow.name = "BiggerChatWindow" function BiggerChatWindow:Initialize() end function BiggerChatWindow.OnAddOnLoaded(event, addonName) CHAT_SYSTEM['maxContainerHeight'] = 1200 CHAT_SYSTEM['maxContainerWidth'] = 1800 if addonName == BiggerChatWindow.name then BiggerChatWindow:Initialize() end end EVENT_MANAGER:RegisterForEvent(BiggerChatWindow.name, EVENT_ADD_ON_LOADED, BiggerChatWindow.OnAddOnLoaded)
The basic idea seems simple and solid enough (setting the max high/width to full UI size).
There is only basic coding stuff you should look out for:
Avoid using global variables like the black death. Global means "shared between every addon and the Zenimax code itself". Never use global unless you absolutely need to do it. You never know wich other code might be interfering with you or your with them. If you write a libraraiy, use LibStub to expose it globally.
The initialise function seems rather useless (it is empty). And in the OnLoaded you run the code before checking if that is your addons on laoded event (every registered on loaded event is run once for every addon that is executed).
Working that all in I would propably write it like this:local RegistgeredEventName = "BiggerChatWindow_OnLoaded" local function OnAddOnLoaded(event, addonName) if(addonName ~= "BiggerChatWindow") then return end CHAT_SYSTEM['maxContainerHeight'] = 1200 CHAT_SYSTEM['maxContainerWidth'] = 1800 end EVENT_MANAGER:RegisterForEvent(RegistgeredEventName , EVENT_ADD_ON_LOADED, OnAddOnLoaded)You only need to give a name for this event registration if you plan to remove it at runtime (not normally the case).
If you don't, just leave it blank/nil.
I did everything you suggested and it seems to work fantastic still.
I have a question thought. I was wondering if its possible to create a saved variable for this addon. Looking around it seems like you can only have addons create saved variables if there an option on the addon (Like turning an option on or off). I tried to create a saved variable function but I'm not sure how to get it to retain the window size for each character. By default when I log on/off it saves the window size for each character individually but I have no idea where that information is. I'd like to make a saved variable for it as a just in case you someone how loose it.
If you can get or set it via the API, you can store it in a Saved Variable to be persisted between runs of the client/relogs and synced between Chracters.crabby654b14_ESO wrote: »Hmm ya I did glance through the saved variable section. Honestly I am a complete noob to all of this and it was by pure chance I got the right code to even be able to unlock the chat window size further.
If there is no option to actually save chat size in a saved variable I may just leave it alone for now until they add that option.
Every window can have defined handlers for such events - for example "OnResizeStart", "OnResizeStop", "OnDragStart", "OnMoveStart", "OnMoveStop" etc (full list in documentation attached to this topic).... <snip> ...
I asume you want to synch the chat sizes across characters?
As there is no "Unloading" event, there is no obvious way to get the data on logging out. I also have no idea of a fitting event (like chat size changed), but there are 469 Events as of 100007 (1.2.5).
So you probably need a autosave timer for that.
... < snip >...
local width, height = CHAT_SYSTEM.containers[1].control:GetDimensions()
local width = CHAT_SYSTEM.sv.containers[1].width local height = CHAT_SYSTEM.sv.containers[1].height
local displayName = GetDisplayName() local sv = ZO_Ingame_SavedVariables.Default[displayName] for characterName, characterSettings in pairs(sv) do local settings = characterSettings.Chat.containers[1] d("Character: " .. characterName .. ", width: " .. settings.width .. ", height: " .. settings.height) end
local width, height ZO_PreHook("ZO_ChatSystem_OnResizeStop", function(control) width, height = control:GetDimensions() end)
local settings = { point = BOTTOMLEFT, relPoint = BOTTOMLEFT, x = 0, y = 0, width = 445, height = 267, } CHAT_SYSTEM.containers[1]:LoadSettings(settings)
CHAT_SYSTEM.containers[1].control:SetDimensions(width, height)
crabby654b14_ESO wrote: »The more I have been thinking about it I am probably not going to try to fight with a saved variable option. Mainly because in the ZOS saved variable it already has a different setting for each character and its really not necessary. And also because I really have no idea how to do ANY of that.
However I do want to try some simple things. I've been slowly looking up how to create a slash command. Like "/bcw reset" that will reset the chat window to the default size and position, the only issue is I can't seem to find the function (right word?) that will actually reset the size. Hmm this is a lot more daunting that I thought!..but fun!
CHAT_SYSTEM:ResetContainerPositionAndSize(CHAT_SYSTEM.containers[1])
## Title: Bigger Chat Window ## Description: Allows you to make your chat window bigger than default. ## Version: 1.2 ## Author: Crabby654 ## APIVersion: 100007 ## SavedVariables: BiggerChatWindow_SavedVariables BiggerChatWindow.lua
local addonName = "BiggerChatWindow" local defaults = { ["*"] = { width = 445, height = 267, point = BOTTOMLEFT, relPoint = BOTTOMLEFT, x = 0, y = 0, }, } local function OnAddOnLoaded(event, name) if(name ~= addonName) then return end EVENT_MANAGER:UnregisterForEvent(addonName, event) --account wide saved variables local savedVars = ZO_SavedVars:NewAccountWide("BiggerChatWindow_SavedVariables", 1, "Chat", defaults) --set maximal chat size to full screen CHAT_SYSTEM.maxContainerWidth, CHAT_SYSTEM.maxContainerHeight = GuiRoot:GetDimensions() --chat tabs are created when palyer is activated, we just need to replace settings with our values for i = 1, GetNumChatContainers() do local chatSV = ZO_Ingame_SavedVariables.Default[GetDisplayName()][GetUnitName("player")].Chat.containers for key, value in pairs(savedVars[i]) do chatSV[i][key] = value end end --hook functions, so we can store chat containers size and position local function SaveSettings(control) local sv, _ = savedVars[control.container.id] sv.width, sv.height = control:GetDimensions() _, sv.point, _, sv.relPoint, sv.x, sv.y = control:GetAnchor(0) end ZO_PreHook("ZO_ChatSystem_OnResizeStop", SaveSettings) ZO_PreHook("ZO_ChatSystem_OnMoveStop", SaveSettings) --define slash command SLASH_COMMANDS["/bcwreset"] = function() for i = 1, #CHAT_SYSTEM.containers do savedVars[i] = nil CHAT_SYSTEM:ResetContainerPositionAndSize(CHAT_SYSTEM.containers[i]) end end end EVENT_MANAGER:RegisterForEvent(addonName, EVENT_ADD_ON_LOADED, OnAddOnLoaded)
local addonName = "BiggerChatWindow" local function OnAddOnLoaded(event, name) if(name ~= addonName) then return end EVENT_MANAGER:UnregisterForEvent(addonName, event) --set maximal chat size to full screen CHAT_SYSTEM.maxContainerWidth, CHAT_SYSTEM.maxContainerHeight = GuiRoot:GetDimensions() --define slash command SLASH_COMMANDS["/bcwreset"] = function() for i = 1, #CHAT_SYSTEM.containers do CHAT_SYSTEM:ResetContainerPositionAndSize(CHAT_SYSTEM.containers[i]) end end end EVENT_MANAGER:RegisterForEvent(addonName, EVENT_ADD_ON_LOADED, OnAddOnLoaded)
BiggerChatWindow = {} BiggerChatWindow.name = "BiggerChatWindow"and replaced it with just:
local addonName = "BiggerChatWindow"Why is that? Sorry if its a stupid question I'm honestly curious why little things like that you changed.
Your addon doesn't need global table, you don't use it anywhere else in the code. That's the reason why I have removed it.crabby654b14_ESO wrote: »Ok amazing! I have it working. I actually am understanding how things are working now..well sort of!
Question though, my original "code" I basically took from the ESO API wiki and you changed some things I'm curious about:
As an example you removed:BiggerChatWindow = {} BiggerChatWindow.name = "BiggerChatWindow"and replaced it with just:local addonName = "BiggerChatWindow"Why is that? Sorry if its a stupid question I'm honestly curious why little things like that you changed.