• 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 - Code help? Trying not to do a sub more then once after combat.

Totally new to coding, but started tinkering around some. I ran into a slight problem. Creating a flag to only go to a sub one after combat reset. This may or may not be the place to post this, but thought I would give it a whirl.


So to even look at the Sub SKnightStuff when in the Sub CombatReset the following has to be true.

Code:
    /if (${BandolierOn}) {
        /if (${Select[${Me.Class.ShortName},SHD]}) /call SKnightstuff
    }


If this statement is true it would do the following Sub:

Code:
| ----------------------------------------------------------------------------
| SUB: SKnightstuff
| ----------------------------------------------------------------------------
    Sub SKnightStuff
        /if (${Me.Class.Name.Equal[Shadow Knight]}) {
            /if (!${Me.Combat}) {
                /if (!${Me.Inventory[13].Name.NotEqual[Invested Honed Wurmslayer]}) {
                    /bandolier activate Deflection
                }
            }
        }
    /return

This basically just puts in a sword and shield by activating a bandolier preset out of combat.

The problem is the check keeps happening over and over again, so if I want to change my primary or secondary to a different set up, I can't. My main question is, due to lack of coding knowledge, is there a way to check this once and not to look at it again until the next combat event has ended.


I was thinking I could set a flag here:

Code:
| ----------------------------------------------------------------------------
| SUB: SKnightstuff
| ----------------------------------------------------------------------------
    Sub SKnightStuff
        /if (${Me.Class.Name.Equal[Shadow Knight]}) {
            /if (!${Me.Combat}) {
                ( X=Off) {
                    /bandolier activate Deflection
                }
            }
        }
    /return

Then when the Sub Combat runs it would turn X = On

Then the new check Sub in CombatReset could would be:

Code:
    /if (${BandolierOn} && X= On) {
        /if (${Select[${Me.Class.ShortName},SHD]}) /call SKnightstuff
    }


I think this makes sense, just not sure how to declare that X or how much would be involved to do something like this.
 
you would have to declare it at the top of the file like :

/declare x int outer 0


| ----------------------------------------------------------------------------
| SUB: SKnightstuff
| ----------------------------------------------------------------------------
Sub SKnightStuff
/if (${Me.Class.Name.Equal[Shadow Knight]}) {
/if (!${Me.Combat} && !${X}) {
/bandolier activate Deflection
/varset X 1
}
}
/return


Then somewhere at the end of where your combat routine exits :

/varset X 0
 
Last edited:
@Saetun is pointing you in the correct direction. What you will want to do is create an outer variable in the main sub routine. Lets call it OOCBandOn(/declare OOCBandOn integer outer 0).

Now in the combat routine you need to make sure is gets set to 0(zero). So anywhere in the top of the combat routine, where you turn on /attack that is where you need to /varset OOCBand 0. Now in the SKnightStuff routine you need to set OOCBand on just after the
/bandolier activate Deflection
/varset OOCBand 1

There are a bunch of places you can modify the code to add the check to not use the /bandolier, but the I would just add it here:

Rich (BB code):
    Sub SKnightStuff
        /if (${Me.Class.Name.Equal[Shadow Knight]}) {
            /if (!${Me.Combat} && !${OOCBand}) {
                /if (!${Me.Inventory[13].Name.NotEqual[Invested Honed Wurmslayer]}) {
                    /bandolier activate Deflection
                    /varset OOCBand 1
                }
            }
        }
    /return
 
Question - Code help? Trying not to do a sub more then once after combat.

Users who are viewing this thread

Back
Top
Cart