• 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

Question - Multiple luas vs single lua

Soandso2

Well-known member
Joined
Mar 13, 2023
RedCents
937¢
So, one of the benefits of using Lua instead of old macroscript is that you can run multiple luas at the same time. Are there any drawbacks to this? Does running 10 separate luas for one toon decrease performance in any significant way? Or can you run hundreds of luas on a reasonable modern computer before things start to bog down?

This little Lua (not tested as I just wrote it) runs on its own. The same toon has other luas running at the same time, doing other stuff.
[CODE lang="Lua" title="ShoutBellow"]local bellow = true

while true do

if target.PctHP > 20 then
if me.AltAbilityReady("Boastful Bellow")() and bellow then
mq.cmd("/alt act 199")
bellow = false
mq.delay(5000)
end
if me.AltAbilityReady("Boastful Bellow")() and not bellow then
mq.cmd("/alt act 8201")
bellow = true
mq.delay(5000)
end
end

end[/CODE]

Why do I do this? Well, if this snippet is part of a larger Lua, the delays halts everything, including things that do not need to halt. But as a Lua that runs on its own and only does exactly what it does, a delay in the loop does not matter. This might be a "crude" approach, but is easy to make work.

Edit: keep in mind that this question does not regard the example lua as such. Just wether it is good or bad practice to "make a new lua for every new thing you come up with" rather than putting everything into the same script.
 
Last edited:
Separate Lua scripts on their own don’t matter, just how the script is written matters. Automation scripts doing the same things will conflict with each other (one script tells you to go right, the other tells you to go left).

You can solve the first problem in one script using state management instead of delays, if you were so inclined.
 
Separate lua scripts on their own don’t matter, just how the script is written matters. Automation scripts doing the same things will conflict with each other (one script tells you to go right, the other tells you to go left).

You can solve the first problem in one script using state management instead of delays, if you were so inclined.
Alright. I was mostly concerned weather it was considered good or bad practice due to performance issues on the hardware. I have not detected any myself, and of course, I am not running hundreds of luas neither. Was more a theoretical question that anything else, really. :)
 
I imagine that several “small” Luas shouldn’t burden modern processors, but I shudder to think of using so many. May just be me, but I would want to consolidate what I could.
 
I imagine that several “small” Luas shouldn’t burden modern processors, but I shudder to think of using so many. May just be me, but I would want to consolidate what I could.
I am running less than 10 luas for 2 different toons (that are online at the same time), as well as a multitude of plugins. I have not run into any issues myself; it was just a question that popped up in my mind. :)
 
So true. Have to admit that I was curious about the answer as well
 
I would say that things could be modularized based on scope.
If you have one that eats and drinks, but otherwise doesn't do anything that would conflict it could be a standalone script with a sizeable timer between checks to minimize the impact of running it.

You don't want a Lua running for every possible ability and here's why.
EQ only allows you to send commands at a specific rate, send the commands too fast and it'll straight up lock up your toon from doing anything with repeated messages about being unable to use that right now. This applies to skills, spells, combat abilities, disciplines etc. You don't want 5 scripts all trying to use something at the same time. You also have no way to setup what has more priority that way.

If one Lua wants to memorize a spell and another one wants to cast a spell then it's a conflict.
If you're trying to pickpocket so you want attack off and another one is making sure attack is on then it's a conflict.
If you need to med but another thing wants to pull you've got a conflict.
If you need to use a defensive disc, but something else wants to use DPS ability of DoOoOm then it's a conflict.
etc etc.

Things that are on the same scope should be incorporated together to avoid conflicts, and allow the one script to keep track of things, like when you last used an ability/spell/etc so you can NOT use anything else for that grace period, then you can create a priority for what is used first to last. I'm a fan of do something or do nothing (including delay). There's no reason to delay right after casting for example. Just cast, set a timer to say you just cast a spell, and once the timer is over just wait for you to no longer be casting. Order the uses of spells (or abilities) from highest priority to lowest priority, like on a berzerker you want to use braxi before you use dicho. but you may also be interested in having shared XXX up on yourself before that etc. Then as a separate Lua you could handle your food. Then a seperate lau could handle spawn tracking (is it up or not, for like named or whatever) but also handle nearby PC tracking since you're already looking through all the spawns anyway, and another one.....etc. Just non conflicting simultaneous things basically. Each one should have a job that doesn't overlap or interfere with another one. That way you can setup update rates for each of them separate according to how important it is in an effort to reduce overall resource consumption.

You could still achieve this within the confines of a single Lua using timers to determine how frequently to use things. That being said, even then it would be best to separate them into their own files that are all included to a main project so that it's easier to find things when you change stuff.
 
I imagine that several “small” Luas shouldn’t burden modern processors, but I shudder to think of using so many. May just be me, but I would want to consolidate what I could.
Again, the code matters, the number does not. Assuming the code is generally the same, save for the main loop — you will not be able to discern a difference using one script or multiple.
 
Question - Multiple luas vs single lua

Users who are viewing this thread

Back
Top
Cart