- Joined
- Mar 23, 2019
- RedCents
- 8,961¢
- Pronouns
- He/Him
Hello RedGuides,
I just wanted to give everyone an update on a project I'm working on. I had announced its genesis on Discord last week, but wanted to present it in a more complete fashion; where I'm at in regards to completion, what I'm working through, and most importantly how you can use it!
First and foremost, I just want to thank the MQ Team for the updates to the library (aka MQNext) and the inclusion of Lua as a first-class scripting language, that you are now able to use not only for spectacular UIs (such as Aquietone's BoxHud) but also to create automation macros - or Luacros!
What it is:
This is a collection of Lua files that mimic the MQ libraries and contain Annotation tags from the EmmyLua project. These annotations are a lot like standard Lua comments but contain information that allows us to create definitions for Classes, Fields, and Functions. IDEs then use this information to provide typeahead, autocompletion, documentation, and class type information while you write your code. I want to stress that you only have access to Classes, Fields, and Functions. That's it. Nothing special beyond that. Classes, I think we all get the idea of what they are. Fields are simply a member of a class that returns some value. This value could be the instance of another class or maybe something really simple like a True/False (aka Boolean). Functions in the annotation library can represent class members that take arguments or parameters; these parameters can be strongly typed! This helps in finding issues before runtime - which is always nice. With these three simple constructs, we're recreating the MQ structure. It's just a facade so that when you type, you're shown a menu of choices as seen below.

Where I'm at:
I was able to get all the documented datatypes in the collection. There are some issues that I need to resolve. 1) Right now, all the members of the datatypes are just Fields - that is, they are not annotated as a function with the proper arguments. This is still useful, but not complete. 2) A few of the documented datatypes have changed since the documentation was last updated. So, I'll need to go back and update these.
TLOs are a work in progress. I hope to have them completed this weekend. I was able to write some conversion scripts for the datatype documentation, which made things go quicker, but the way the TLOs are documented are a bit more challenging. Also, some TLOs are not documented, so I have to go back into the code to find members and that takes more time.
How can you use it:
Simply place the files in a subdirectory under your normal working location. For most of us, that somewhere under the Lua directory. Depending on your IDE/Plugin, that's all you have to do. Personally, for these I'm just using Microsoft VSCode, and a plugin called Lua / Lua Language Server by summneko

When you're working in your Lua code, you just need to make sure you annotate your Macroquest library object, with
The files can be found here: https://gitlab.com/Coldblooded/mq-emmylua-definitions
Want to contribute / help / debug / review ??
Let me know! I'm more than happy to team with anyone that wants to get involved.
I just wanted to give everyone an update on a project I'm working on. I had announced its genesis on Discord last week, but wanted to present it in a more complete fashion; where I'm at in regards to completion, what I'm working through, and most importantly how you can use it!
First and foremost, I just want to thank the MQ Team for the updates to the library (aka MQNext) and the inclusion of Lua as a first-class scripting language, that you are now able to use not only for spectacular UIs (such as Aquietone's BoxHud) but also to create automation macros - or Luacros!
What it is:
This is a collection of Lua files that mimic the MQ libraries and contain Annotation tags from the EmmyLua project. These annotations are a lot like standard Lua comments but contain information that allows us to create definitions for Classes, Fields, and Functions. IDEs then use this information to provide typeahead, autocompletion, documentation, and class type information while you write your code. I want to stress that you only have access to Classes, Fields, and Functions. That's it. Nothing special beyond that. Classes, I think we all get the idea of what they are. Fields are simply a member of a class that returns some value. This value could be the instance of another class or maybe something really simple like a True/False (aka Boolean). Functions in the annotation library can represent class members that take arguments or parameters; these parameters can be strongly typed! This helps in finding issues before runtime - which is always nice. With these three simple constructs, we're recreating the MQ structure. It's just a facade so that when you type, you're shown a menu of choices as seen below.

Where I'm at:
I was able to get all the documented datatypes in the collection. There are some issues that I need to resolve. 1) Right now, all the members of the datatypes are just Fields - that is, they are not annotated as a function with the proper arguments. This is still useful, but not complete. 2) A few of the documented datatypes have changed since the documentation was last updated. So, I'll need to go back and update these.
TLOs are a work in progress. I hope to have them completed this weekend. I was able to write some conversion scripts for the datatype documentation, which made things go quicker, but the way the TLOs are documented are a bit more challenging. Also, some TLOs are not documented, so I have to go back into the code to find members and that takes more time.
How can you use it:
Simply place the files in a subdirectory under your normal working location. For most of us, that somewhere under the Lua directory. Depending on your IDE/Plugin, that's all you have to do. Personally, for these I'm just using Microsoft VSCode, and a plugin called Lua / Lua Language Server by summneko
When you're working in your Lua code, you just need to make sure you annotate your Macroquest library object, with
JavaScript:
---@type Mq
local mq = require 'mq'
The files can be found here: https://gitlab.com/Coldblooded/mq-emmylua-definitions
Want to contribute / help / debug / review ??
Let me know! I'm more than happy to team with anyone that wants to get involved.

