• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver
Lua (core plugin)

Release Lua (core plugin)

This is for "MacroQuest" not MQ2 :) Development name is "Next" but that's temporary.

I don't believe it will be backported.
 
Hi Redbot, I was a bit confused as I'm not understanding what this is. MQ 'Next' runs Lua scripts already...no? Please help me to understand. I peeked at the Wiki, but I don't get it. and ty for clarifying its not for old MQ2...I am seeing a happy improvement with new MQ!!! :) If I may make a small suggestion change the name to MQLua not MQ2Lua. Anyway I am excited to learn more what this is for and what to do to install.
 
There is no MacroQuest than can run Lua scripts.

One version of MacroQuest, dev codename "next" can load a plugin named MQ2Lua which can run Lua scripts.

The naming scheme is something that will likely change, but I'm sure you can understand the amount of chaos changing plugin names would cause. It's something we'll roll out slowly.
 
ok, so this is an update (since being posted today) to the Plugin that was published with the release of MacroQuest (Next)? Meaning we should download and update or is this post just for future updates? Sorry for all the questions, I'm just trying to wrap my head around this.

And yes, I understand naming issues, especially with a change happening in time. :)
 
ok, so this is an update (since being posted today) to the Plugin that was published with the release of MacroQuest (Next)? Meaning we should download and update or is this post just for future updates? Sorry for all the questions, I'm just trying to wrap my head around this.

And yes, I understand naming issues, especially with a change happening in time. :)
as redbot says this is just the resource thread, so updates that happen to the mq2lua plugin will have a place for them to be posted, and a discussion thread for the plugin itself like other resources we have anything from mq2chatwnd or mq2autologin to mq2map (all other "core" plugins)
 
I would refrain from calling it mq2lua. The only place that name exists is in the file name and it’s gonna change eventually. It’s just the Lua plugin
 
One thing I happened to notice which is a difference in how the event system worked (I think) from the old macro language, is that Lua seems to yield control back to the main script if you use `mq.delay` inside of an event handler, whereas with the old macros I believe delay still kept execution only within the event handler.

For example, if you have a script like:

Lua:
local mq = require("mq")


local function hailed (line, who)
    print("Hailed by " .. who)
    mq.delay("10s")
    print("Finished")
end


mq.event("hailed1", "#1# says, 'Hail, " .. mq.TLO.Me.Name() .. "'", hailed)
mq.event("hailed2", "#1# say, 'Hail, " .. mq.TLO.Me.Name() .. "'", hailed)


while true do
    mq.doevents()
    mq.delay(10)
end

And you hail 4 times in 10s, you'll get output that loops like this:

Code:
You say 'Hail, Soandso'
Hailed by You
You say 'Hail, Soandso'
Hailed by You
You say 'Hail, Soandso'
Hailed by You
You say 'Hail, Soandso'
Hailed by You
Finished
Finished
Finished
Finished

I'm unsure if this is expected behavior or not. It is a divergence from the semantics of the old macro langauge, but since Lua is a new system that doesn't make that wrong. At a minimum it would be nice to document this aspect, as I only found it when I was trying to debug a bug in one of my Lua macros. Currently, there's nothing keeping two events from running interlaced unless you've gone out of your way to prevent it from happening or you don't use `mq.delay` in your event handlers.
 
One thing I happened to notice which is a difference in how the event system worked (I think) from the old macro language, is that lua seems to yield control back to the main script if you use `mq.delay` inside of an event handler, whereas with the old macros I believe delay still kept execution only within the event handler.

......

I'm unsure if this is expected behavior or not. It is a divergence from the semantics of the old macro langauge, but since lua is a new system that doesn't make that wrong. At a minimum it would be nice to document this aspect, as I only found it when I was trying to debug a bug in one of my lua macros. Currently, there's nothing keeping two events from running interlaced unless you've gone out of your way to prevent it from happening or you don't use `mq.delay` in your event handlers.

The old macro language was designed to be able to run only 1 macro/thread at a time, so a "delay" would hold the whole thing.
Lua is designed to be able to run multiple "macros/Luas" parallel, so it is able to run multiple threads indipendend parallel. As a result of that, a "delay" may only hold the actual "workflow" where it is called, allowing other jobs to be continued. So for me I would expect it to work as you described it.
 
It would be beneficial to have /Lua restart luascriptname and /Lua restart all as commands.
 
It would be beneficial to have /lua restart luascriptname and /lua restart all as commands.

Put together from another project I have.

[CODE lang="Lua" title="restart.Lua"]---@type Mq
local mq = require('mq')

local function luaCommand(command, ...)
local line = table.concat({...}, ' ')

mq.cmd.Lua(command .. " " .. line)
end

local function luaRun(...)
luaCommand("run", ...)
end

local function luaStop(...)
if (string.lower(select(1, ...)) == "restart") then
mq.exit()
end

luaCommand("stop", ...)
end

local function luaRestart(...)
luaStop(...)
luaRun(...)
end
mq.bind("/restart", luaRestart)

while true do
mq.delay(50)
end[/CODE]
 
Put together from another project I have.

[CODE lang="lua" title="restart.lua"]---@type Mq
local mq = require('mq')

local function luaCommand(command, ...)
local line = table.concat({...}, ' ')

mq.cmd.lua(command .. " " .. line)
end

local function luaRun(...)
luaCommand("run", ...)
end

local function luaStop(...)
if (string.lower(select(1, ...)) == "restart") then
mq.exit()
end

luaCommand("stop", ...)
end

local function luaRestart(...)
luaStop(...)
luaRun(...)
end
mq.bind("/restart", luaRestart)

while true do
mq.delay(50)
end[/CODE]
Great little Lua there.

/restart luascript works great.
 
I did look briefly into an all option, but I wasn't getting info from mq.TLO.Lua.Script(pid) as expected (returned nil for pids reported by mq.TLO.Lua.PIDs()).
 
Wasn't sure if the actual plugin does this or not.
When you parse /mqlog in a Lua script.
It writes to the macroquest.log (which is what I expect)
If you have a macro running, this also creates a log file of the macro name and logs the Lua script log to that file as well. (is this expected)?
 
This is expected. That command was written when only macros existed and the premise is that it’s used for macro logging. From Lua you can use io for writing.
 
Feature request, add ability to minimize Lua window when two or more are stabbed together and minimize tab width so multiple windows can stack without flowing off screen.
 
Crash report. I am sure it is one of the running Lua scripts, I am just not sure which one. Hopefully I am posting it into the correct area, until we figure out which script is actually causing the issue. This happened whle zoning out of the palatial guild hall into Sunrise Hills.

---------------------------
EverQuest Crash Detected
---------------------------
MacroQuest caught a crash:

Process ID: 5504
Version: 3.1.1.3202
Location: C:\Games\MQ\Plugins\mq2lua.DLL+00000000001A5A2D

CrashID: 681d0e66-91ac-4d6f-b8fe-c6d70b51dda2

You can either:
* [RETRY] Continue execution and hope for the best.
* [CANCEL] Write a crash dump and terminate EverQuest.

Copy the contents of this dialog to your clipboard by pressing Ctrl+C

---------------------------
Retry Cancel
---------------------------
 
Crash report. I am sure it is one of the running lua scripts, I am just not sure which one. Hopefully I am posting it into the correct area, until we figure out which script is actually causing the issue. This happened whle zoning out of the palatial guild hall into Sunrise Hills.

---------------------------
EverQuest Crash Detected
---------------------------
MacroQuest caught a crash:

Process ID: 5504
Version: 3.1.1.3202
Location: C:\Games\MQ\Plugins\mq2lua.DLL+00000000001A5A2D

CrashID: 681d0e66-91ac-4d6f-b8fe-c6d70b51dda2

You can either:
* [RETRY] Continue execution and hope for the best.
* [CANCEL] Write a crash dump and terminate EverQuest.

Copy the contents of this dialog to your clipboard by pressing Ctrl+C

---------------------------
Retry Cancel
---------------------------
i looked at the crash dmp and there wasn't anything in it that i could be helpful with - I couldn't even tell you what script (this is intended to serve as a 'this isn't falling on deaf ears')
 
Thanks for trying. I will just have to resort to the old method of unloading scripts until it stops happening. I may have to write a quick script to write a log of which scripts are loaded before I kick the task on all my toons in the group. That may help narrow down which script is causing the issue.
 
Thanks for trying. I will just have to resort to the old method of unloading scripts until it stops happening. I may have to write a quick script to write a log of which scripts are loaded before I kick the task on all my toons in the group. That may help narrow down which script is causing the issue.
Start with the most jank and consider what TLOs it may be referencing that will report nil while zoning
If nothing comes to mind, yeah, one at a time ig!
 
Thanks for trying. I will just have to resort to the old method of unloading scripts until it stops happening. I may have to write a quick script to write a log of which scripts are loaded before I kick the task on all my toons in the group. That may help narrow down which script is causing the issue.
I just noticed they made a change on test with the real estate window. Since you said you were zoning into Sunset Hills. I don't know if this applies to you.
 
Release Lua (core plugin)

Users who are viewing this thread

Back
Top
Cart