• 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

Guide - New language feature: functions (1 Viewer)

Awesome, how about a map data type for macros next? ;)
You read my mind. :) That is one of the things I have in mind. Creating an interface to the c++ containers vector, map and unordered map. And possibly some of the algorithms. I don't know how many of the mq2 data types I can support. Maybe just strings and int.
 
I would give this about 3 months until its super tested. none of this has ever worked as intended ever.
never ever.
ever.
 
You underestimate the lazy.. hehe.

For whoever writes 400 character long code lines like
Rich (BB code):
            /if (${Select[${2ndPart},Mana,Aura,Mount,Me,Summon,End,0]} || (${FindItemCount[=${Buffs[${i}]}]}>=1 && ${Select[${Spell[${Buffs[${i}]}].TargetType},self]}) || (${FindItemCount[${1stPart}]}>=1 && ${Select[${Spell[${3rdPart}].TargetType},self]}) || (${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[self]}) || ${BookSpellTT.Find[self]} || ${BookSpellTT.Find[pet]}) /goto :SkipCheckIni
lazy doesn't seem the right word to me. Let me think of something better. How about masochist ? :D

Functions are realy great for stuff like this. ie instead of /if (cond1 && cond2 && ...... && cond99) you can give the thing you want to check a nice name /if (${needsIni[some args]} and define a function
Rich (BB code):
Sub needsIni (some args)
/if (!cond1) /return false
/if (!cond2) /return false
...
...
/return true
A lot of of grey matter and hair saved. And potentialy faster code because not every condition must be evaluated. End of advertisement.:)
 
For whoever writes 400 character long code lines like
Rich (BB code):
            /if (${Select[${2ndPart},Mana,Aura,Mount,Me,Summon,End,0]} || (${FindItemCount[=${Buffs[${i}]}]}>=1 && ${Select[${Spell[${Buffs[${i}]}].TargetType},self]}) || (${FindItemCount[${1stPart}]}>=1 && ${Select[${Spell[${3rdPart}].TargetType},self]}) || (${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[self]}) || ${BookSpellTT.Find[self]} || ${BookSpellTT.Find[pet]}) /goto :SkipCheckIni
lazy doesn't seem the right word to me. Let me think of something better. How about masochist ? :D

Functions are realy great for stuff like this. ie instead of /if (cond1 && cond2 && ...... && cond99) you can give the thing you want to check a nice name /if (${needsIni[some args]} and define a function
Rich (BB code):
Sub needsIni (some args)
/if (!cond1) /return false
/if (!cond2) /return false
...
...
/return true
A lot of of grey matter and hair saved. And potentialy faster code because not every condition must be evaluated. End of advertisement.:)

But how does this level my language skills?
 
I've used this feature since it was released myself.

Rich (BB code):
Sub checkVend(string buyItem)
    /if (!${Window[MerchantWnd].Open}) {
        /cechob "\ayYou need to open a merchant! Attempting to do that for you."
        /target class Merchant
        /if (${Target.Distance} < 20) {
            /cechob "\awAttempting to open merchant!"
            /invoke ${Target.RightClick}
            |Need to give the merchant time to load their inventory. 
            /delay 10s ${Window[MerchantWnd].Open}
        } else /if (${Target.Race.Name.Equal[Merchant]}) {
        /cechob "\ap${Target.CleanName} is to far away to open the Merchant, get closer and try again!"
        /end
        } else {
        /cechob "\apNo Merchant in this Zone, ending macro!!"
        /end
        }
    }
/return ${Window[MerchantWnd].Child[MW_ItemList].List[=${buyItem},2]}

Then use it like
Rich (BB code):
/if (${checkVend["Water Flask"]})

as an example. The same could be done for inventory check. But these are easy examples of what it could be used for.

But yes I'm working with botting macros that do have extremely long if commands that were adapted for a sort of function a long time ago by using /noparse, IE:

Rich (BB code):
    /noparse /declare SelfBuffCheck string outer (${Spell[${bookcheck}].TargetType.Equal[Self]} && ${Spell[${bookcheck}].Duration}>50 && !${bookcheck.Find[illusion]})
    /noparse /declare LifetapCheck string outer (${Spell[${bookcheck}].TargetType.Equal[Lifetap]})
    /noparse /declare NukeCheck string outer (${Spell[${bookcheck}].TargetType.Equal[single]} && !${Spell[${bookcheck}].Duration} && (${Spell[${bookcheck}].Category.Find[Direct Damage]}||${Spell[${bookcheck}].Skill.Equal[Archery]}))
    /noparse /declare DotCheck string outer (${Spell[${bookcheck}].TargetType.Equal[single]} && ${Spell[${bookcheck}].Duration}>=2 && ${Spell[${bookcheck}].Category.Find[Damage Over Time]})
    /noparse /declare FightBuffCheck string outer (${Spell[${bookcheck}].TargetType.Equal[Self]} && ${Range.Between[1,51:${Spell[${bookcheck}].Duration}]})
    /noparse /declare MainTankBuffCheck string outer  ((${Spell[${bookcheck}].TargetType.Equal[single]}||${Spell[${bookcheck}].TargetType.Equal[group v2]}) && ${Spell[${bookcheck}].SpellType.Equal[beneficial]} && (${Range.Between[4,90:${Spell[${bookcheck}].Duration}]}||${Spell[${bookcheck}].Name.Find[Promised]}) && ${Spell[${bookcheck}].Slot[1].Left[8].NotEqual[Reaction]})
    /noparse /declare HealSingleCheck string outer (${Spell[${bookcheck}].TargetType.Equal[single]} && !${Spell[${bookcheck}].Duration} && ${Spell[${bookcheck}].SpellType.Equal[beneficial]} && (${Spell[${bookcheck}].Slot[1].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[2].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[3].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[4].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[5].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[6].Left[21].Equal[Increase Hitpoints by]}))
    /noparse /declare HealGroupCheck string outer ((${Select[${Spell[${bookcheck}].TargetType},group v1,group v2]}||${Spell[${bookcheck}].TargetType.Equal[self]} && (${Spell[${bookcheck}].Slot[1].Equal[UnknownEffect400]}||${Spell[${bookcheck}].Slot[1].Find[Increase Current HP by]} && ${Spell[${bookcheck}].AERange})) && !${Spell[${bookcheck}].Duration} && ${Spell[${bookcheck}].SpellType.Equal[beneficial]} && (${Spell[${bookcheck}].Slot[1].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[2].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[3].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[4].Left[21].Equal[Increase Hitpoints by]}))
    /noparse /declare HealSelfCheck string outer (${Spell[${bookcheck}].TargetType.Equal[self]} && !${Spell[${bookcheck}].Duration} && ${Spell[${bookcheck}].Category.Equal[Heals]})
    /noparse /declare HealSplashCheck string outer (${Select[${Spell[${bookcheck}].TargetType},Unknown,Free Target]} && ${Spell[${bookcheck}].SpellType.Equal[beneficial]} && ${Spell[${bookcheck}].Name.Find[splash]})
    /noparse /declare StunCheck string outer (${Spell[${bookcheck}].TargetType.Equal[single]} && ${Spell[${bookcheck}].Subcategory.Equal[Stun]})
    /noparse /declare DebuffCheck string outer (${Spell[${bookcheck}].TargetType.Equal[single]} && ${Spell[${bookcheck}].SpellType.Equal[detrimental]}  && ${Spell[${bookcheck}].Duration}  && ${Select[${Spell[${bookcheck}].Skill},Alteration,Abjuration]} && ${Spell[${bookcheck}].Slot[1].Left[13].NotEqual[Increase Hate]} && ${Spell[${bookcheck}].Slot[2].Left[13].NotEqual[Increase Hate]} && ${Spell[${bookcheck}].Slot[5].Left[13].NotEqual[Increase Hate]})
    /noparse /declare HealBalanceCheck string outer (${Me.Class.ShortName.Equal[clr]})
    /noparse /declare XHealCheck string outer (${Spell[${bookcheck}].TargetType.Equal[single]} && !${Spell[${bookcheck}].Duration} && ${Spell[${bookcheck}].SpellType.Equal[beneficial]} && (${Spell[${bookcheck}].Slot[1].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[2].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[3].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[4].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[5].Left[21].Equal[Increase Hitpoints by]}||${Spell[${bookcheck}].Slot[6].Left[21].Equal[Increase Hitpoints by]}))
    /noparse /declare BuffCheck string outer  ((${Spell[${bookcheck}].TargetType.Equal[single]}||${Spell[${bookcheck}].TargetType.Find[group]}||${Spell[${bookcheck} Rk. II].TargetType.Find[group]}) && ${Spell[${bookcheck}].SpellType.Equal[beneficial]} && ((${Range.Between[90,999999:${Spell[${bookcheck}].Duration}]}||${Range.Between[1,3:${Spell[${bookcheck}].Duration}]})||${Spell[${bookcheck}].Name.Find[Promised]}) && ${Spell[${bookcheck}].Slot[1].Left[8].NotEqual[Reaction]})
    /noparse /declare BuffRankCheck string outer (${Target.Buff[${iTargetBuff}].ID}==${Spell[${BuffOrigSpellIcon${iBuff}}].ID}||${Target.Buff[${iTargetBuff}].ID}==${Spell[${BuffOrigSpellIcon${iBuff}} Rk. II].ID}||${Target.Buff[${iTargetBuff}].ID}==${Spell[${BuffOrigSpellIcon${iBuff}} Rk. III].ID}||${Target.Buff[${iTargetBuff}].ID}==${Spell[${BuffOrigIconAlt${iBuff}}].ID}||${Target.Buff[${iTargetBuff}].ID}==${Spell[${BuffOrigIconAlt${iBuff}} Rk. II].ID}||${Target.Buff[${iTargetBuff}].ID}==${Spell[${BuffOrigIconAlt${iBuff}} Rk. III].ID})
    /noparse /declare JoltCheck string outer (${Spell[${bookcheck}].TargetType.Equal[single]} && ${Spell[${bookcheck}].SpellType.Equal[detrimental]}  && (${Spell[${bookcheck}].Slot[1].Left[13].Equal[Decrease Hate]}||${Spell[${bookcheck}].Slot[2].Left[13].Equal[Decrease Hate]}))
    /noparse /declare MezCheck string outer (${Spell[${bookcheck}].Slot[1].Left[11].Equal[Mesmerize(2]} && ${Spell[${bookcheck}].TargetType.Equal[single]}||${Spell[${bookcheck}].Slot[1].Left[11].Equal[Mesmerize(1]} && ${Spell[${bookcheck}].TargetType.Equal[single]})
    /noparse /declare AEMezCheck string outer (${Spell[${bookcheck}].Slot[1].Left[11].Equal[Mesmerize(2]} && ${Spell[${bookcheck}].TargetType.Equal[targeted ae]})
    /noparse /declare PBAEMezCheck string outer (${Spell[${bookcheck}].Slot[1].Left[11].Equal[Mesmerize(1]} && (${Spell[${bookcheck}].TargetType.Equal[pb ae]}||${Spell[${bookcheck} Rk. II].TargetType.Equal[pb ae]}) && !${bookcheck.Find[lullaby]} && !${bookcheck.Find[slumber of]})
    /noparse /declare AuraCheck string outer (${Spell[${bookcheck}].Slot[1].Find[Aura Effect]})
    /noparse /declare RootCheck string outer (${Spell[${bookcheck}].Slot[2].Equal[root]} && ${Spell[${bookcheck}].SpellType.Equal[detrimental]})

then used like

Rich (BB code):
/if (${AuraCheck})
/if (${RootCheck})

etc

Likely the parse time on this would be shorter if done in a function instead of a long single line check.
 
Guide - New language feature: functions

Users who are viewing this thread

Back
Top
Cart