PDA

View Full Version : Shameless solicitation (chat parsing, ui, data passing)


soulos90
03-08-2021, 06:06 PM
Hi,

I am new to this community so I feel a little bad asking for something before contributing... but I am going to anyway because I guess I am a jerk... sorry. TLDR I am hoping someone who is confident in lua will be interested in consulting/working on this project with me.

I have been working on an idea for a plugin forking off the Songbook plugin, what I want is a background windows app that parses data (songs in list, inputs, etc) to suggest a song that is "recommended" to play next. This is in my wheelhouse.

The part that I am struggling with is the lua in game interface as I have never worked in lua before and while there are many cool products made by this community I am getting a raging headache parsing through these files to try and figure out the pieces of code that I need to emulate.

My main tasks in lua right now are:

Modify the Songbook UI to integrate my functionality; I want a button that changes depending on next expected input from "/play x sync" to reminders to change instruments. I want a interface that represents detected state of band members "player x is waiting to play y".

Send and read data from chat; I want the band leader to be able to send instructions through chat to all members, song and instrument, and band members to be able to send their state.

I also need to send data to the plugindata files and read from them, though because the nature of the app isn't very time sensitive I hope I can just wait the 30 seconds.

I will keep plugging away at making this plugin myself, but would happily take advice, and even more happily work with someone more comfortable in lua than I, side bonus I havn't met someone new during this particular pandemic and friends are nice :)

Hope you all are doing well, and thank you for your time,

Nathan

Garan
03-08-2021, 06:36 PM
You can read/write data without the 30 second wait on the plugindata files fairly easily by using a second plugin that is loaded from the main plugin - the second one will have full real-time access to plugindata files as it loads and can communicate with the main plugin using custom formatted chat commands (not executing the commands, but rather creating and checking for the existance of certain custom formatted commands). If you are interested, look into how TerrainMap loads annotations on the fly as the user scrolls the map.

The mechanism is a little bulky, but its far more efficient than waiting 30 seconds for every external communication and once you've implemented it once, it's easy to re-implement or expand it's usefulness. I wrote a simple chat translation plugin that communicated via an external app with Google translate and response times were pretty decent (of course, some of the translations left a lot to be desired but heh, Google is better than nothing... usually ;) ).

Lotro Alerts (sometimes just called Alerter) has a lot of examples of chat parsing. MoorMap and TerrainMap share annotations with each other and with other users via chat parsing. There are several other plugins that do quite a bit of sharing of info via chat parsing.

Unfortunately, I don't use songbook or even work with the music aspects of the Lua interface so I wouldn't be of much help with your other issues but welcome to the neighborhood :)

Garan

soulos90
03-08-2021, 08:36 PM
would you be willing to sit with me, in a discord call or something, and give me a crash course in how your terrainmap plugin is using some of this tech?

Garan
03-08-2021, 09:22 PM
would you be willing to sit with me, in a discord call or something, and give me a crash course in how your terrainmap plugin is using some of this tech?

I'm not sure if we can arrange a good time to talk via discord, my schedule is a bit peculiar these days and my free time is broken up into tiny bits here and there but I don't mind chatting via PMs or if possible via discord.

Hyoss
03-09-2021, 07:42 AM
Note to self: go and read TerrainMap and Lotro Alerts source code ASAP to learn :D

soulos90
03-16-2021, 06:56 PM
So Garan,
I know in terrainmap you embed the sending character name in the data because "there is a bug" in the sender parameter of the chat listener callback. what bug is there? and where do you see documentation about that parameter?

Garan
03-16-2021, 09:39 PM
So Garan,
I know in terrainmap you embed the sending character name in the data because "there is a bug" in the sender parameter of the chat listener callback. what bug is there? and where do you see documentation about that parameter?

The bug is that the "Sender" parameter will always be the local character no matter who the original sender of the message is. The documentation is the API documentation found here:
https://www.lotrointerface.com/downloads/info1054-OfficialUpdate25LuaDocumentation.html
The relevant documentation is for the Received event of the Turbine.Chat object.
Note, there are two sender values, the parameter directly passed to the event handler and the args.Sender value. The one in question is not the sender passed directly as that just references the object that fired the event. The args.Sender value, however, should be the original Sender of the message and is not. The args.ChatType and args.Message work as documented.
function Chat:Received(sender, args)
This event is fired whenever any chat message is received from the game or other users. The arguments for this event will contain a combination of a Sender, a ChatType, and the Message itself. The ChatType enumeration can be used to determine what kind of message was received.

soulos90
03-16-2021, 10:02 PM
You are a gentleman and a scholar as usual.