|
04/25/15, 08:11 PM | #1 | |
|
Lua Code:
As for the functions, like they said we find them by reading the games lua files or using /zgoo. This addon has a feature to search the games global table for global functions. I use it to find functions I might want to use or to just look up a function when I forget its name. As for figuring out how to use the function, once I find a function that sounds like what I want then I go to the lua files and search for it to see how they use it, what the parameters are, and what values it returns if any. Click4Info |
|
04/25/15, 10:46 PM | #2 | ||
Join Date: Apr 2015
Posts: 20
|
You're right those are what I was looking for but from the documentation (or rather the list of functions) I couldn't tell that I needed to dig down to currentBuffer. I loaded up zgoo and my god, I don't see how you can derive anything from that. I did /zgoo mouse over the chat window and I see the currentBuffer and the methods under it but I still am at a loss. I was reading through the source to pchat and X4D_CHAT and I still can't make heads or tails of what's going on in them. My coding skills must be hella weak... When you say you 'go to the lua files and search for it', if you meant the ESO client where are those stored? Mine might be different since I'm using the beta client. |
||
04/25/15, 11:55 PM | #3 | |||
|
It is near the top, look for the link: ESOUI 2.0.4 CURRENT Live It is a link to a zip file that contains the lua files for the game.
That list of functions you were looking at on the wiki API page are global functions that reside directly in the main area of the global table (not inside of another table). You can call them directly without needing to have any other object. No other function in the same "area/table" can have the same name. I think of them like addresses to a location, no two objects (variables, functions, tables, exc..) can have the same address: When I repeatedly use the word objects below, if it helps to understand, they are all tables in this example. Lua Code:
In order to clear the chat buffer, you have to have the currentBuffer object and you call "it's" Clear() function, which is contained in the buffer object. If you just called Clear() the game would look for it directly in the global table and if found it would call that one, but it would NOT look inside of any other tables so it would not see the one inside of the CHAT_SYSTEM.primaryContainer.currentBuffer table. If we want to call that clear function we need to...give it that address/location so it knows which Clear() function we are wanting to call. Using: Lua Code:
So in short it tells the game to call the Clear() function that belongs to the CHAT_SYSTEM.primaryContainer.currentBuffer object. It also passes that current buffer object to the Clear() function as the first parameter (thats what the : means before the function name).
When you do /zgoo mouse it just shows all of the tables that belong to the "object" you had your mouse over, often with more & more tables nested inside of it. You just have to search around and try to find what your looking for sometimes. Last edited by circonian : 04/25/15 at 11:58 PM. |
|||
04/27/15, 01:05 PM | #4 | |
Join Date: Apr 2015
Posts: 20
|
I read up on Lua's scoping and I'm pretty sure I understand it. I see the function that allowed us to send chat messages is now protected, is that what all the bot spammers were using? It kind of seems silly to block it, writing a spam bot to send keypresses to the client as a 3rd party tool is still an option.
I'm currently reading through sharedchatsystem.lua, thanks for linking me to the files. I'm trying to figure out how to read the contents of the chat buffer so I can look for specific strings but I'm not seeing where its stored or how to access it. Can someone explain what the "..." us all about? I'm seeing it a lot, mostly as new(...). Also "#", what does this do? |
|
04/27/15, 02:16 PM | #5 | ||
There are no function to get a textbuffer content
# mean sizeof(variable) , var must be an array. It's non recursive if Lua Code:
#myarray will be 3 (...) means arguments inherited from. ex : Lua Code:
Lua Code:
You can't read chat buffer, you need to catch them when messages comes. |
|||
04/27/15, 04:01 PM | #6 | |
Lua Code:
|
||
04/28/15, 05:03 PM | #7 | |
Join Date: Apr 2015
Posts: 20
|
Thanks for the info. I got it working perfectly. Now I have a new issue where I have a few nested tables and at the end is a boolean, I ca'nt seem to check this value.
Code:
for key, value in pairs(table.table2.table3) do if(value == true) then d('true') elseif(value == false) then d('false') end end Code:
local str = "" for key, value in pairs(table) do str += value end Lastly, is there really no way to send information to the chat through an add on? Of course d() but no one will see messages you log with a d(). The only thing I can think of (and have yet to test) is adding text to the input line of the chat and letting the user press enter. |
|
ESOUI » Developer Discussions » Lua/XML Help » Manipulate the Chat |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|