• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run
MacroScript to Lua

Guide - MacroScript to Lua 0.2

Download
aquietone submitted a new resource:

MacroScript to Lua - How to write macro basics in Lua

This guide will cover what (I) think seem to be some of the more common building blocks of code found in macros, and ways they may be written in Lua. They may not be the only ways or the best ways, but hopefully they are useful to see.

All the Lua code from this guide is also included in the howto.lua script provided with the guide.

Other Resources
MQ2Lua wiki...

Read more about this resource...
 
Nice guide! A couple of things to mention:
{...} is the table containing the varargs in a function, which might give closer results to the macro equivalent of directly accessing the varags by index.
This is MQ specific, but you don't just directly write slash-commands, they are accessed through mq.cmd('/mycommand and args') (and cmdf), which is a major difference from the macro language.
 
This might be a bit advanced but one of the benefits of select in the macro language is short style syntax for shared code but knowing what the value is. It’s sort of a compact switch statement that sets the variable for you. So maybe the example would be more illustrative if you set variables. One of the common examples is selecting melee classes, caster classes, or hybrid classes.

Lua actually does this with tables more than anything else. So a table with class short names matched to their respective melee/caster/hybrid might be a good example of replacing a select (otherwise set a variable rather than print so the explanation is relatable since macro language also had else if. The tables example is a start to this but I think it lacks applicability where it would be a good place to get “properties” of an item in a table.

Moving on, the for loop example (repeat until) is closer to a do while than a for loop. I don’t remember if the macro language has a do while or not. 5c should probably be renamed though.

It might also be worth mentioning that Lua binds are different from macro binds in that macro binds rely on some other command executing for them to be processed. This is no longer the case with Lua binds. Just something to know as you transfer knowledge.

Great job!
 
Last edited:
This might be a bit advanced but one of the benefits of select in the macro language is short style syntax for shared code but knowing what the value is. It’s sort of a compact switch statement that sets the variable for you. So maybe the example would be more illustrative if you set variables. One of the common examples is selecting melee classes, caster classes, or hybrid classes.

Lua actually does this with tables more than anything else. So a table with class short names matched to their respective melee/caster/hybrid might be a good example of replacing a select (otherwise set a variable rather than print so the explanation is relatable since macro language also had else if. The tables example is a start to this but I think it lacks applicability where it would be a good place to get “properties” of an item in a table.

Moving on, the for loop example (repeat until) is closer to a do while than a for loop. I don’t remember if the macro language has a do while or not. 5c should probably be renamed though.

It might also be worth mentioning that lua binds are different from macro binds in that macro binds rely on some other command executing for them to be processed. This is no longer the case with lua binds. Just something to know as you transfer knowledge.

Great job!

Thanks for the feedback. I made some updates to the sections around loops/flow control, and split out the bit on Lua tables and ${Select[...]} into their own sections with some updated examples. Think the guide should flow a little better now.
 
Guide - MacroScript to Lua

Users who are viewing this thread

Back
Top
Cart