- Curse Premium
Member for 15 years, 8 months, and 1 day
Last active Sun, Dec, 27 2020 05:39:59
- 0 Followers
- 2,884 Total Posts
- 2 Thanks
Nov 26, 2010Posted in: Lua Code DiscussionQuote from OrionShocklike a lot of things... the problem here is not the actuall code, but more the responsibility for maintaining it...
How about agreeing on a paradigm then. Within our own addons, try to isolate these code fragments into their own files, like the ones Adirelle showed us.
That wouldn't create any new maintenance work, and would be a step in the right direction.
I understand peoples reservation on the maintenance side. Noone likes the additional hassle of maintaining sample code.
Nov 26, 2010Posted in: General AddOnsQuote from lockofwarHow does one permanently turn of the channels; Tradeskills, Pet Info and Creature Messages: Yell. They keep turning on when i log out and in again.
And now they turn on if i go from one zone to the next even in a city
it's really annoying. I tried, complete reïnstall, adding a new tab just for those channels, down gradeing and upgradeing i even deleted my WTF folder. Nothing seems to work
I'm not sure why you are having those issues. You should make your chat settings, then exit the game once you have them as you like them.
Prat isn't involved in any of that stuff, its all default Blizzard stuff.
Nov 26, 2010Posted in: General AddOnsQuote from orgevoI am maintaining an addon which has a feature that appends an additional hyperlinked phrase to the player's name in chat windows. The basic problem I'm running into is that if I also have Prat running, I can't seem to get this additional text to show up next to the player's name (it doesn't show up anywhere, actually).
I've tried disabling the PlayerName + ChannelName modules (via the Prat UI), but that didn't seem to make a difference. So I had a few questions, hope I'm not on the wrong track here completely:
1. Are there any other Prat modules that might be overwriting the text that I am sending to the chat window (via an AddMessage pre-hook)?
2. Assuming that the issue can be isolated to one or two modules, are there any flags or control parameters in Prat that are intended to handle this sort of thing? Or should I just put something in the readme that the two addons are not compatible with regards to this feature?
3. I've considered the possibility that it's something about the _way_ in which I'm adding my hyperlink tag that is confusing or getting overlooked by Prat. But at this point, I've tried every possible way that it can be done, from least invasive (ChatMessageFilter) to most invasive (pre-hooking AddMessage, ChatFrame_OnHyperlink*, etc.), but nothing seems to make the slightest bit of difference to Prat, whatsoever. Does this sound possible/likely? As far as I can tell [without digging into Prat's code], it almost seems like Prat formats the entire message from scratch, disregarding formatting, etc. that was previously attached. Or could I be overlooking something on my end?
(edit: BTW, it's kind of implied by the original message, but FWIW, the hyperlink tag shows up correctly if I disable Prat [either via ACP+reloadUI or logging out and using addOns list])
Well. I can tell you you are right about one thing Prat does completely take over the chat system for certain message types, and does format the entire message itself this is part of Prat's core addon and is by design.
There are alot of ways to work with Prat though. For example, your implementation based on AddmessageFilter should have worked. I don't know why it didnt.
Prat works like this for inbound messages:
First it installs the following hooks, 1 hook on ChatFrame_MessageEventHandler, and then 1 hook on every chatframe's AddMessage.
This is how chat is processed for events that Prat's processing is enabled for.
1) The chatframe code calls ChatFrame_MEH invoking Prat's hook.
2) Prat breaks the message apart into its component parts and stores it in a table
3) Prat calls back into the hook chain to allow normal processing of the message
4) When the chatframe code does finally call addmessage, Prat intercepts it, and prevents it from being displayed.
5) Prat now begins its own processing. Prat fires events to all its modules for each step in its chat processing logic, modules are able to modify the table with the chatmessage data stored in it.
6) Finally after several processing steps, Prat calls AddMessage itself with the formatted chat message which is generated from the table it created from the original chat message.
I'm always willing to help people work with Prat, I can't always give them exactly what they want, ie. If they just want to fight with me over the way Prat works, I just don't entertain that anymore. However if you'd like help either working around Prat or with Prat I'm available most of the time on IRC.
Nov 24, 2010Posted in: Lua Code DiscussionQuote from AdirelleThe files in tekkub's addon template are a good example. E.g. When I don't need all the bells and whistle of AceEvent-3.0, I use something similar to this (tekkub's code) :
...I don't use AceLocale-3.0 anymore, I often copy-paste like this:
...Those pieces of code barely need to be turned into libraries. Moreover, they would gain nothing or little of being libraries. One of the strength of libraries like AceTimer-3.0 or AceGUI-3.0 is to optimize resource usage, either by recycling the resources or by using smart algorithms to efficiently handle requests from the various addons.
Exactly. Now someone comes along behind you can copy/pastes your stuff into their addon - if those things were in their own files, they could just copy the file as a whole and drop that in. So could you for that matter
Nov 24, 2010Don't get sidetracked by the fact that the code units im talking about just happen to be in an "addon template". Im not talking about the whole addon template, im talking about the individual files.Posted in: Lua Code Discussion
Using these code units is not just about "help me get started", it helps promote good program structure as well - so you just dont have 1 big blob. Also by separating out the boilerplate the main addon code is less cluttered, this physical separation helps prevent code for 1 thing getting intertwined with code from another thing.
And, as an aside. Copy/Paste doesn't help you learn anything either. Look how many addons have getglobal in them or this globals. Where do you think those came from in most cases.
Im thinking something like, a community maintained collection of 'templates' or whatever term is most appropriate which are added to through a meritocracy, ie. only those that are in use get added, and only those that are being used are part of the collection. Idk...just thinking.
Nov 23, 2010Posted in: Addon IdeasQuote from DrKazzaWow... slick code. I was going to offer some advice on how to do it but clearly from your code you're way on top of the game.
stuff I'd already typed...
If I did it I'd use CHAT_MSG_SAY and CHAT_MSG_YELL and keep all text it captures for 30 seconds (for example) with two variables... message and sender (args 1 and 2) and if the first argument matched your fontstring variable then I'd just tweak
fontstring = sender..": "..fontstring
Its a reasonable next step for certain, but the user could have that chat type disabled on all thier chatframes - in that case you'd still see a bubble, but nothing would print on any chatframe to reference.
Also, there is the issue where the chatbubble is displayed before the chatframe message (it may be possible), and 2 people saying the same thing.
Those are all edge cases obviously.
I could probably do more than I am currently, or perhaps improve my implementation somewhat. Next time I have some free time I'll look into it some more.
Nov 23, 2010Posted in: Lua Code Discussion
Yes this is almost exactly what I had in mind, i use something similar in Prat.
Static, Standalone, library code that is reusable but not shared in any way with other addons.
And the intended unit of reuse would be a single lua file - not really copy/paste.
Nov 22, 2010I have been thinking about how to encourage code reuse among authors on and off since i joined this community. I have made some suggestions in the past, some of them hairbrained some of them good.Posted in: Lua Code Discussion
Rather than suggest a design this time though, I'd like to just start a discussion on the merits of this concept.
I'm thinking of single addon libraries, and cut-and-paste code snippets. They both can be covered by the notion of a "static library". I have to use this term since the libraries we use today are "dynamic" in the sense that they interact with other copies of themselves (upgrading).
What I am thinking of is more like how Lua itself uses "libraries" in the form of modules - you get your own copy of the code, and it doesn't change at runtime.
One of my thoughts was to just use LuaCompat to enable the Lua module system for wow using an addon. Well - the flaw in that is that you'd need to get people to install an addon to enable the internal library in your addon - or make the addon a library which goes against the grain of what I want to achieve.
LibStub may work for single use libraries, but someone might reuse your single use library without you ever knowing (it is open source after all). Plus you don't need libstub if you aren't sharing a library.
We have access to a unique table for the addon a Lua file runs in. It seems we could use that table and come up with a scheme whereby we can just drop Lua files into our code and that would give us the advantages of code reuse without the stigma of being a shared library. It would also give other authors a way to write 'utility' code without creating 'yet another library'.
I could come up with a design but maybe some of you have some ideas?
Nov 22, 2010sylvanaar posted a message on LibDropdown-1.0 - A now working Ace3 dropdown libraryA screenshot would be nice so we can see what you created.Posted in: Libraries
Nov 20, 2010Here's some code i havePosted in: Lua Code Discussion
for i = 1, GetNumBattlefieldScores() do local name, killingBlows, honorKills, deaths, honorGained, faction, rank, race, class, filename, damageDone, healingDone = GetBattlefieldScore(i); if name then local plr, svr = name:match("([^%-]+)%-?(.*)") end end
- To post a comment, please login or register a new account.