• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->
MQ VS Code Lua Autocomplete Definition Library

Lua - MQ VS Code Lua Autocomplete Definition Library (2 Viewers) 1.1

I have the following (if it helps)

JSON:
    "Lua.completion.callSnippet": "Replace",
    "Lua.runtime.version": "LuaJIT",
    "Lua.workspace.ignoreSubmodules": false,
    "Lua.workspace.library": [
      "<MQ location>\\lua\\lib",
      "<MQ location>\\lua\\annotation"
    ],

lib files will sometimes have their own annotations I want to pick up. The external stuff goes into annotation. ignoreSubmodules came from a discussion with the Lua Language Server community. Not sure it helps, but it doesn't hurt either.
 
With the absolute path I got it to run. Ontop a very useful information for me was the right location of the file settings.json. I created multiple hoping I got one also in the right place. But none of them have been under ... ...appdate\roaming ....

Acutal all seems to work as intended.
many thanks @Cannonballdex
 
I have the following (if it helps)

JSON:
    "Lua.completion.callSnippet": "Replace",
    "Lua.runtime.version": "LuaJIT",
    "Lua.workspace.ignoreSubmodules": false,
    "Lua.workspace.library": [
      "<MQ location>\\lua\\lib",
      "<MQ location>\\lua\\annotation"
    ],

lib files will sometimes have their own annotations I want to pick up. The external stuff goes into annotation. ignoreSubmodules came from a discussion with the Lua Language Server community. Not sure it helps, but it doesn't hurt either.
What is the effect of "Lua.completion.callSnippet": "Replace"?
Why do you use a different runtime. version "Lua.runtime.version": "LuaJIT"? Runs "Lua Version 5.1" interpreted vs. "LuaJIT" JIT-compiled?
"Lua.workspace.ignoreSubmodules": false... I imagine will allow Submodules to declare additional annotations, if that's the case, it makes sense to me.
 
should be close, but still erratic: compareing numbers with userdata

erratic condition:
if (mq.TLO.Me.XTAggroCount(200) > 0) and (mq.TLO.Me.AltAbilityReady(102)()) then  --Escape

where is the bug?
 
should be close, but still erratic: compareing numbers with userdata

erratic condition:
if (mq.TLO.Me.XTAggroCount(200) > 0) and (mq.TLO.Me.AltAbilityReady(102)()) then  --Escape

where is the bug?
What is the (200) in your aggrocount

Returns the number of AUTO-HATER mobs on the extended target window where your aggro is less than the optional parameter N. N must be between 1-100 inclusive or it will be set to 100 (the default value).

mq.TLO.Me.XTAggroCount(100)() > 0
 
Last edited:
What is the effect of "Lua.completion.callSnippet": "Replace"?
Why do you use a different runtime. version "Lua.runtime.version": "LuaJIT"? Runs "Lua Version 5.1" interpreted vs. "LuaJIT" JIT-compiled?
"Lua.workspace.ignoreSubmodules": false... I imagine will allow Submodules to declare additional annotations, if that's the case, it makes sense to me.

The version of Lua included with MQ is LuaJIT 2.0.5. It is compatible with Lua 5.1, but offers a number of extensions. For example, I use the ffi.* functionality in a base library for my projects.

From the Lua Language Server documentation for Lua.completion.CallSnippet:

completion.callSnippet​


Type: string
Default: "Disable"
Options:
  • "Disable" - Only show function name
  • "Both" - Show function name and snippet
  • "Replace" - Only show the call snippet
Whether to show call snippets or not. When disabled, only the function name will be completed. When enabled, a "more complete" snippet will be offered.
 
Last edited:
@rouneq thanks for the details. For me it seems, you dived verry deep into the Lua-stuff available ;)
The second of my questions for me seems the most important: do Lua 5.1 run interpreted vs.LuaJit which seems to run Jit-compiled?
 
The second of my questions for me seems the most important: do Lua 5.1 run interpreted vs.LuaJit which seems to run Jit-compiled?
From The Lua Programming Language Beginner's Guide | How It Works:

There are two main components of Lua:
  • The Lua interpreter
  • The Lua virtual machine (VM)
Lua is not directly interpreted through a Lua file like other languages such as Python. Instead, it uses the Lua interpreter to compile a Lua file to bytecode. The Lua interpreter is written in ANSI C, making it highly portable and capable of running on a multitude of devices.

Usually, the compilation is done at the runtime. However, sometimes it can be done before the runtime to increase load times. Then the Lua virtual machine will run this compiled bytecode. The register-based architecture of the Lua virtual machine closely resembles actual hardware architectures, and it will increase the overall performance of the program.

From Introducing LuaJIT:

As the name says LuaJIT is a Just-In-Time (JIT) compiler. This means that functions are compiled on demand, i.e. when they are run first. This ensures both a quick application startup and helps to avoid useless work, too. E.g. unused functions are not compiled at all.
 
Last edited:
@rouneq many thanks for the details. As I understan them, both versions do compile the code befor it is started. What benefits did you see in the Jit-compiler to choose it over the standard Lua? Do you expect better runtime-performance choosing the JIT-compiler?
 
@rouneq many thanks for the details. As I understan them, both versions do compile the code befor it is started. What benefits did you see in the Jit-compiler to choose it over the standard Lua? Do you expect better runtime-performance choosing the JIT-compiler?

I didn't chose which version of Lua is included with MQ. One of the MQ devs will have to step in with their design choice(s) on the matter.
 
SHD disc 2-Hit Rune ... for lvl 120 "Repudiate"

Condition: If I have anything on aggro and I am not Invis
fire my 2 hit Rune "Repudiate" whenever possible on cooldown
as long as there is atleast 1 mob on aggro


Import Event:
cmV0dXJuIHsKIGxvYWQgPSB7CiAgYWx3YXlzID0gZmFsc2UsCiAgY2xhc3MgPSAiIiwKICB6b25lID0gIiIsCiB9LAogY29kZSA9ICJMUzB0UUhSNWNHVWdUWEVLTFMwdFFIUjVjR1VnU1cxSGRXa0tDbXh2WTJGc0lHMXhJRDBnY21WeGRXbHlaU2duYlhFbktRcHNiMk5oYkNCRGIyMWlZWFJCWW1sc2FYUjVUbUZ0WlNBOUlDZFNaWEIxWkdsaGRHVW5DZ3BzYjJOaGJDQm1kVzVqZEdsdmJpQlRkRzl3UkZCVEtDa0tJQ0FnSUcxeExtTnRaQ2duTDNOeGRXVnNZMmdnTDIxeGNDQnZiaWNwQ2lBZ0lDQnRjUzVrWld4aGVTZ3hNQ2tLSUNBZ0lHMXhMbU50WkNnbkwzTnhkV1ZzWTJnZ0wySnZlSElnY0dGMWMyVW5LUW9nSUNBZ2JYRXVaR1ZzWVhrb01UQXBDaUFnSUNCM2FHbHNaU0J0Y1M1VVRFOHVUV1V1UTJGemRHbHVaeTVKUkNncElHUnZDaUFnSUNBZ0lDQnRjUzVrWld4aGVTZ3hNREFwQ2lBZ0lDQmxibVFLWlc1a0NncHNiMk5oYkNCbWRXNWpkR2x2YmlCU1pYTjFiV1ZFVUZNb0tRb2dJQ0J0Y1M1amJXUW9KeTl6Y1hWbGJHTm9J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pYVd4cGRIbFNaV0ZrZVNoRFFWSmhibXRsWkNrZ2RHaGxiaUJ5WlhSMWNtNGdkSEoxWlNCbGJtUUtJQ0FnSUhKbGRIVnliaUJtWVd4elpRcGxibVFLQ214dlkyRnNJR1oxYm1OMGFXOXVJR0ZqZEdsdmJpZ3BDaUFnSUNCVGRHOXdSRkJUS0NrS0lDQWdJRzF4TG1SbGJHRjVLREV3S1FvZ0lDQWdiWEV1WTIxa1ppZ25MM054ZFdWc1kyZ2dMMlJwYzJNZ0pYTW5MQ0JEUVZKaGJtdGxaQ2tLSUNBZ0lHMXhMbVJsYkdGNUtERXdLUW9nSUNBZ1VtVnpkVzFsUkZCVEtDa0taVzVrQ2dweVpYUjFjbTRnZTI5dWJHOWhaRDF2Ymw5c2IyRmtMQ0JqYjI1a1puVnVZejFqYjI1a2FYUnBiMjRzSUdGamRHbHZibVoxYm1NOVlXTjBhVzl1ZlE9PSIsCiBjYXRlZ29yeSA9ICJnZW5lcmFsIiwKIHR5cGUgPSAiY29uZGl0aW9ucyIsCiBuYW1lID0gIlNoZDJIaXRSdW5lRGlzYyIsCn0=

This disc does not consume alot of Endurance, but for my feeling offers alot of defense, as it adsorbes upto 88k damage from the next 2 hits. So my SHD likes it and want it always up when he has aggro.

Full ressource code:
---@type Mq
---@type ImGui

local mq = require('mq')
local CombatAbilityName = 'Repudiate'

local function StopDPS()
    mq.cmd('/squelch /mqp on')
    mq.delay(10)
    mq.cmd('/squelch /boxr pause')
    mq.delay(10)
    while mq.TLO.Me.Casting.ID() do
       mq.delay(100)
    end
end

local function ResumeDPS()
   mq.cmd('/squelch /mqp off')
   mq.delay(10)
   mq.cmd('/squelch /boxr unpause')
   mq.delay(10)
end

local function NofHater()
---@diagnostic disable-next-line: undefined-field
    return mq.TLO.XAssist.XTFullHaterCount()
end

local CARanked = ""
local function on_load()
    CARanked = mq.TLO.Spell((CombatAbilityName)).RankName()
end

local function condition()
    if not tostring(mq.TLO.Me.Class.ShortName()) == 'SHD' then return false end           -- no SHD no fun
    ---@diagnostic disable-next-line: undefined-field
    if NofHater() > 0 and not mq.TLO.Me.Invis() and mq.TLO.Me.CombatAbilityReady(CARanked) then return true end
    return false
end

local function action()
    StopDPS()
    mq.delay(10)
    mq.cmdf('/squelch /disc %s', CARanked)
    mq.delay(10)
    ResumeDPS()
end

return {onload=on_load, condfunc=condition, actionfunc=action}


Idea for further improvements:
- extend for multiclass-support
I think this might be in the wrong thread?
 
Could not possibly say enough good things about this.
Question, I've updated to the most recent version, but it's still not sensing the CWTN tlo, and it also gives me an error on .IsLoaded (which validates through /lua parse in game) is there a way to get these TLO's added possibly?

Seriously though, thank you so much for all of this.
 
Could not possibly say enough good things about this.
Question, I've updated to the most recent version, but it's still not sensing the CWTN tlo, and it also gives me an error on .IsLoaded (which validates through /lua parse in game) is there a way to get these TLO's added possibly?

Seriously though, thank you so much for all of this.
I have not added the CWTN TLOs. If you want, I'm more than happy to take a PR on that, or if not, I'll try and get around to it. At a minimum, put an issue up on GitHub so I don't forget :)
 
I have not added the CWTN TLOs. If you want, I'm more than happy to take a PR on that, or if not, I'll try and get around to it. At a minimum, put an issue up on GitHub so I don't forget :)
Awesome job with this. Really enjoy it. I actually started to add the CWTN TLO's (mind you no idea what i am doing). I got the first few files created and there is was popping up in the helper box. Then I went to research all the CWTN TLO's and was like, F-That.
Mad props to you for as much as you have got in to this already. Greatly appreciated.
 
Fantastic helper especially for someone looking to migrate from MQ to Lua!

I got it set up on a fresh install of VS Code + Lua Language Server extension

while in D:/next/Lua folder I did git clone
INI:
git clone https://github.com/macroquest/mq-imgui-definitions.git
INI:
git clone https://github.com/macroquest/mq-definitions.git

Created the following settings.json

INI:
{
    "Lua.telemetry.enable": true,
    "Lua.runtime.version": "Lua 5.1",
    "Lua.workspace.library": [
        "D:\\Next\\lua\\mq-definitions",
        "D:\\Next\\lua\\mq-imgui-definitions"
    ]
}
The best practice would be to use relative paths but hard path was faster to setup.


I only have https://www.redguides.com/community/resources/scriber.2391/ to test
added annotation
---@type Mq
and it works!!!

so a few things missing:

mq.TLO.Me.NumBagSlots() - undefined field

goto continue --undefined global 'continue'

::continue:: --Lua 5.1 does not support this grammar(supported in 5.2, 5.3, 5.4)

So should I change the Lua version in settings?
 
Last edited:
Fantastic helper especially for someone looking to migrate from MQ to Lua!

I got it set up on a fresh install of VS Code + Lua Language Server extension

while in D:/next/Lua folder I did git clone
INI:
git clone https://github.com/macroquest/mq-imgui-definitions.git
INI:
git clone https://github.com/macroquest/mq-definitions.git

Created the following settings.json

INI:
{
    "Lua.telemetry.enable": true,
    "Lua.runtime.version": "Lua 5.1",
    "Lua.workspace.library": [
        "D:\\Next\\lua\\mq-definitions",
        "D:\\Next\\lua\\mq-imgui-definitions"
    ]
}
The best practice would be to use relative paths but hard path was faster to setup.


I only have https://www.redguides.com/community/resources/scriber.2391/ to test
added annotation
---@type Mq
and it works!!!

so a few things missing:

mq.TLO.Me.NumBagSlots() - undefined field

goto continue --undefined global 'continue'

::continue:: --Lua 5.1 does not support this grammar(supported in 5.2, 5.3, 5.4)

So should I change the Lua version in settings?
Re: ::continue::

The version of Lua used/released with MQ is LuaJIT, not 5.1. LuaJIT started with 5.1 and back-ported some changes found in 5.2. As you indicate, updating the version to LuaJIT will resolve that particular message.
 
Lua - MQ VS Code Lua Autocomplete Definition Library

Users who are viewing this thread

Back
Top