• 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

Question - Can someone take a look at a Lua I kind of edited plz (1 Viewer)

Undefeated

Well-known member
This is a_moss_snake Lua that he gave me and I kinda of edited some parts specifically the spelll names and took out class I dont use. Can someone plz tell me if this loook like it will work. Thank you.
Lua:
---@type Mq
---@type ImGui
local mq = require('mq')
-- does kinda also work on raid...
local required_zone =   {
        ['akhevatwo_mission'] = true,
        ['akhevatwo_raid'] = true,
    }
local bane_mob_name = 'datiar xi tavuelim'

local banes = {
    CLR={
      {name='Blessed Chains',type='aa', order='1'},
      {name='Shackle',type='spell', order='2'}
    },
    BRD={
      {name='Slumber of the Diabo',type='spell',order='1'}
    },
    ENC={
      {name='Beguiler\'s Banishment',type='aa',order='1'},
      {name='Beam of Slumber',type='aa',order='2'},
      {name='Chaotic Puzzlement',type='spell',order='3'}
    },
    SHM={
      {name='Spiritual Rebuke',type='aa',order='1'},
      {name='Virulent Paralysis',type='aa',order='2'},
      {name='Shackle',type='spell',order='3'}
    },
    DRU={
      {name='Paralytic Spores',type='aa',order='1'},
      {name='Paralytic Spray',type='aa',order='2'},
      {name='Vinelash Assault',type='spell',order='3'}
   }
  }
local unbreakable = {
    ['CLR'] = true,
    ['DRU'] = true,
    ['SHM'] = true,
-- adapt to your healing setup
}

local function StopDPS()
    mq.cmd('/squelch /mqp on')
    mq.delay(10)
    if mq.TLO.Me.Class.ShortName() == 'BRD' then
        mq.cmd('/squelch /twist off')
        mq.delay(10)
        mq.cmd('/squelch /stopsong')
        mq.delay(10)
    end
    mq.cmd('/squelch /boxr pause')
    mq.delay(10)
        if (mq.TLO.Me.Casting.ID()) and (not unbreakable[mq.TLO.Me.Class.ShortName()]) then
            mq.cmd('/squelch /stopcast')
            mq.delay(100)
        end
end
local function ResumeDPS()
   mq.cmd('/squelch /mqp off')
   mq.delay(10)
   if mq.TLO.Me.Class.ShortName() == 'BRD' then
    mq.cmd('/squelch /twist on')
    mq.delay(10)
   end
   mq.cmd('/squelch /boxr unpause')
   mq.delay(10)
end
local function on_load()
    if not required_zone[mq.TLO.Zone.ShortName()]  then return end
    math.randomseed(os.time()*mq.TLO.Me.ID())
    local bane = banes[mq.TLO.Me.Class.ShortName()]
    if not bane then
        print('Sadly I will be of no help here')
        return end
    for _, data in ipairs(bane) do
        if data.type == 'spell' then
            local Spellname = mq.TLO.Spell(data.name).RankName()
            if mq.TLO.Me.Gem(Spellname)() and mq.TLO.Me.Gem(Spellname)() > 0 then
                print('Spell ', data.name,' memmed, good boy')
            else
                print('Spell ', data.name,' not memmed, you suck')
            end
        end
    end
end
local function isBaneableMob(spawn)
-- 200 should be enough
          return ((spawn.Type() == 'NPC') and (spawn.CleanName() == bane_mob_name) and (spawn.LineOfSight()) and (spawn.Distance() <  200))
end
---@return boolean @Returns true if the action should fire, otherwise false.
local function condition()
    local bane_mob_spawn = mq.getFilteredSpawns(isBaneableMob)
    return required_zone[mq.TLO.Zone.ShortName()] and #bane_mob_spawn > 0
end


local function target_bane_mob()
    local bane_mob_spawn = mq.getFilteredSpawns(isBaneableMob)
    local bane_mob_count = #bane_mob_spawn
    if bane_mob_count > 1 then
        --random defeates distance sorting, might weight it
        --table.sort(bane_mob_spawn, function(a, b) return a['Distance'] > b['Distance'] end )
        Index = math.random(bane_mob_count)
    else Index = 1
    end
    if #bane_mob_spawn > 0 then
        mq.cmdf('/mqtar ${Spawn[%s]}', bane_mob_spawn[Index]['ID'])
        mq.delay(50)
        mq.cmd('/face fast')
    end
end
local function cast(spell)
    if mq.TLO.Target.CleanName() == bane_mob_name then
        mq.cmdf('/cast %s', spell.RankName())
        mq.cmdf('/dgtell all used %s for bane on [%s] -- [%s]', spell.RankName(), mq.TLO.Target.CleanName(), mq.TLO.Target.ID())
        mq.delay(50+spell.MyCastTime())  
    end
end
local function use_aa(aa)
    if mq.TLO.Target.CleanName() == bane_mob_name then
        mq.cmdf('/alt activate %s', aa.ID())
        mq.cmdf('/dgtell all used %s for bane on [%s] -- [%s]', aa.Spell.Name(), mq.TLO.Target.CleanName(), mq.TLO.Target.ID())
        mq.delay(50+aa.Spell.CastTime())
    end
end
local function bane_ready(data)
    if not unbreakable[mq.TLO.Me.Class.ShortName()] then
        if data.type == 'spell' then
            return mq.TLO.Me.SpellReady(data.name)()
        elseif data.type == 'aa' then
            return mq.TLO.Me.AltAbilityReady(data.name)()
        end
    else
        if data.type == 'spell' then
            return (mq.TLO.Me.SpellReady(data.name)() and not mq.TLO.Me.Casting())
        elseif data.type == 'aa' then
            return (mq.TLO.Me.AltAbilityReady(data.name)() and not mq.TLO.Me.Casting())
        end
    end
end
local function action()
    print('Action!')
    local bane = banes[mq.TLO.Me.Class.ShortName()]
    -- if not a bane class, return
    if not bane then return end
    local breakcond = false
    while breakcond == false do
        local bane_mob_spawn = mq.getFilteredSpawns(isBaneableMob)
        if #bane_mob_spawn > 0 then
            table.sort(bane, function(a, b) return a['order'] < b['order'] end )
            for _, data in ipairs(bane) do
                if bane_ready(data) then
                    StopDPS()
                    target_bane_mob()
                    if data.type == 'spell' then
                        cast(mq.TLO.Spell(data.name))
                    else
                        use_aa(mq.TLO.Me.AltAbility(data.name))
                    end
                    while mq.TLO.Me.Casting() do
                        mq.delay(50)
                    end              
                    break
                end
            end
        else
            breakcond = true
            ResumeDPS()
        end
        mq.doevents()
        mq.delay(50)
    end
end
return {onload=on_load, condfunc=condition, actionfunc=action}
 
Last edited by a moderator:
I put it in code blocks for you. 1700466792016.pngThere's a button at the top of the forum post that lets you put stuff in code blocks.
1700466829207.png

Just give it a title, highlight line numbers you changed for review, select language and paste code.
Since you're not the original author by your own admission, informing us what you edited by highlighting lines would be helpful in narrowing down what to look at instead the entire thing. Though posting the entire thing is also useful for context on what you've edited.
NOBODY wants to review code with a screenshot of code. I used to do that. I can see how annoying it was. Please try to listen to request when you ask someone to look at something for you. Completely ignoring requests and immediately trying to get help to do something else entirely is not the way to get assistance.
 
Hey guys sorry I made a new thread but I posted it like u wanted it to be .
I deleted your duplicate thread. Threads are meant to have conversations. There is no reason to create an entirely new thread to post the same exact thing in code blocks and not in code blocks. Just edit the original post if that's your intention, and then post that you edited the post.

Can you tell us which lines you edited?
 
Sorry totally new with Lua and coding. I basically deleted the extra class it had at beinging and adding extra AA spell to druid and that it . Also he used shackle to name the spell fo all class, I named it for the actual spell name.
 
Lua:
---@type Mq
---@type ImGui
local mq = require('mq')
-- does kinda also work on raid...
local required_zone =   {
        ['akhevatwo_mission'] = true,
        ['akhevatwo_raid'] = true,
    }
local bane_mob_name = 'datiar xi tavuelim'

local banes = {
    CLR={
      {name='Blessed Chains',type='aa', order='1'},
      {name='Shackle',type='spell', order='2'}
    },
    BRD={
      {name='Slumber of the Diabo',type='spell',order='1'}
    },
    ENC={
      {name='Beguiler\'s Banishment',type='aa',order='1'},
      {name='Beam of Slumber',type='aa',order='2'},
      {name='Chaotic Puzzlement',type='spell',order='3'}
    },
    SHM={
      {name='Spiritual Rebuke',type='aa',order='1'},
      {name='Virulent Paralysis',type='aa',order='2'},
      {name='Shackle',type='spell',order='3'}
    },
    DRU={
      {name='Paralytic Spores',type='aa',order='1'},
      {name='Paralytic Spray',type='aa',order='2'},
      {name='Vinelash Assault',type='spell',order='3'}
   }
  }

So these lines?
 
Question - Can someone take a look at a Lua I kind of edited plz

Users who are viewing this thread

Back
Top
Cart