• 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

Problem - Concatenating variables inside mq.cmd

Joined
Mar 20, 2024
RedCents
1,051¢
I swear I have searched throughout the whole forum before posting, but I couldnt find the solution :(

I got the following code:

Code:
local MyRune = "Force Shield"
if not mq.TLO.Me.Gem(MyRune)() then
     mq.cmd('/memorize "' , MyRune , '" 4')
end

I can't make it work. If, instead of using mq.cmd('/memorize "' , MyRune , '" 4') , I use mq.cmd('/memorize "Force Shield" 4'), then everything works fine. That means that the concatenation of the variable MyRune breaks the cmd. I assume the quotes symbols are the culprit of the issue. Unfortunately, the spell name must be surrounded by quotes for the /memorize command to work.

Does anyone know the right syntax? Thank you in advance!
 
you should use formatted strings
Lua:
mq.cmdf('/memorize "%s" 4', MyRune)

or at least concatenate strings..
Lua:
mq.cmd('/memorize "' .. MyRune .. '" 4')
 
Problem - Concatenating variables inside mq.cmd

Users who are viewing this thread

Back
Top
Cart