This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Live
PTR
10.2.7
PTR
10.2.6
Beta
Reverse Engineering Addon via LUA
Post Reply
Return to board index
Post by
Darcovian
Hey there, So i'm trying to reverse engineer an addon that I found in order to hopefully create or mould an addon of my own or at least be able to change some of that addon so it works better for my own situation. Problem is that my knowledge of LUA is very very basic so in order to understand it better I was hoping that some help from anyone that is more knowledgable than me would be greatly appreciated.
Best way for me to explain what I'm trying to do is to imagine an excel spreadsheet. Now imagine that each of the cell identifiers is replaced by an item string and each of those cells have value in them that are added by the user. Now when the trigger for one of these cells is activated (by linking the item to me in a whisper) a message is then replied back to that person with the value in that specific cell. Does that make sense? I can clarify further if someone wishes.
Now I think I can manage to do most of this except two parts. 1) Creating a trigger from an item link and 2) creating a database that I can edit myself (IE a menu where I can input a value to reply) the rest I can kind of figure out on my own but these two parts are giving me the most trouble. So after this ramble here comes my questions.
1) What does the function look like when trying to create a trigger that is based around an item string/item link
2) what does the function look like when manually created a "Cell" that I can edit
Thanks in advance.
Post by
Myrroddin
First, it is Lua, not LUA. Lua is Portuguese for "moon" and is not an acronym.
As for your idea, it sounds like you want a table in key-pairs.
local myTable = {
= someValue -- key = value
}
Based on your rather confusing question, not to mention some vagueness, that's all I have for you right now. It would greatly help if you could clearly describe what you want to accomplish.
Post by
Darcovian
yeah sorry as I was trying to explain it i realised later on that it didnt make much sense on what I was trying to do. Let me explain a bit clearer.
Essentially I have an addon for the TSM suite called "price checker", which is not part of the official TSM pack but made by a third party, that I'm looking to reverse engineer and kind of modify better for my own needs. When someone whispers me ?<insert item link here> it replys back to them with the current auction house price of that item and the regional market price of all servers which TSM scans and stores on an internal database. What I want it to do is simply modify the addon so instead of searching the TSM database it will search inside a custom database that I create and output what I add into that database depending on the item linked. To do that I'm trying to figure out how the script recognises an item link and how it searchs for that in my own database and how possibly to store that information ingame.
I hope that makes more sense? oh and before anyone asks, I tried to contact the author of the app and still haven't received a response so I gotta try and figure this out myself for now.
Anything more you need me to add I would be happy to clarify further.
Post by
Myrroddin
I have TSM_PriceChecker, and this is the first time I've looked at the code. It is a wonderful example of how to NOT write an addon properly. It is confusing, tramps all over both itself (!) and TradeSkillMaster, and contains design flaws in the first three lines of TradeSkillMaster_PricerChecker.lua, along with weirdly localizing its defaults table for no reason.
Speaking of localization, it is set up, sort of, but is incomplete and inefficient.
Even without looking at TSM's code, I'd say this plugin is a candidate for a major rewrite. No wonder you are confused, because so am I.
Post by
Darcovian
So I guess that it would be better to start from scratch rather than try and sort through that addon then? If I'm going down that route then i may try and go down a simpler route similar to what I mentioned before about creating a table of some form ingame and have each different entry linked by a trigger to the item ID. Then my next question is when creating a trigger, would the script recognise item links that are linked in wow chat by using the identifier? or would I have to come up with some other way of identifying the item?
Post by
Myrroddin
You would have to verify the incoming message to make sure it contains the data you want, yes. That isn't all that difficult, it is simple pattern matching, of which there are multiple tutorials found via Google.
If you browse wowpedia.org in the interface customization section you will find links for various how-tos; there might even be some for sending/receiving via the hidden addon channel. Also on there you will find links to handling events, the API, and event listings (and their arguments).
At this point I suggest to you that you write a mock-up using what you know, what you want, using pseudo-code if necessary, and post it to any code-friendly online paste site. From there I could see what you want, and better help you achieve your goal. Be as specific as possible, as "sending a value as a response to a whisper" doesn't say a whole lot. I know the trigger is an incoming item link, but I have no idea what you want to send back.
In other words, based on TSM_PC, the incoming is "?" and it sends back details about the market value of the item. Those are specific details I would need to know.
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.