• 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 - Question to a return on a macro to Sub Main

KS1980

Well-known member
Question: Can anyone help me with this Sub Routine to return back to the start of the macro instead or returning back to where it was called from?

|----- Sub: Named -----|
Sub Named
|----------------------|


/if (${SpawnCount[npc XXXXXXXXXX]}>0) {
/echo Named XXXXXXXXXX Spawned
/war ignore "XXXXXXXXXX"
/delay 2s
/war ignore "XXXXXXXXXX"
/delay 2s
:NamedSpawn
/if (${SpawnCount[npc XXXXXXXXXX]}>0) /goto :NamedSpawn
/echo Named Cleared
}
/return
 
i tried that

|----- Sub: Named -----|
Sub Named
|----------------------|


/if (${SpawnCount[npc XXXXXXXXXX]}>0) {
/echo Named XXXXXXXXXX Spawned
/war ignore "XXXXXXXXXX"
/delay 2s
/war ignore "XXXXXXXXXX"
/delay 2s
:NamedSpawn
/if (${SpawnCount[npc XXXXXXXXXX]}>0) /goto :NamedSpawn
/echo Named Cleared
}
/goto :Repeat

seemed it couldnt find the goto although its there.

maybe im doing something wrong?

i just cant get this sub rotuine to go back to the begining of the macre and ive searched other ideas to no avail.

thx
 
i don't think asking how to make your macro jump from anywhere back to the start of the macro is the right question. flow control such as if, while, for etc. exist for a reason. also Lua would be infinitely better.
 
goto is the debil
Code:
Sub Main
|This is the main loop
/while (1) {
    /if (something) /doathing
    /if (somethingElse) /doadifferentThing

    |If this condition passes, I don't want to run anymore code so we use /continue to return to the start of the while loop
    /if (thisconditionpasses) /continue

    |our condition didn't pass, so we need to do the code if the condition was false.
    /if (ImEatingATaco) /AddHotSauce


}

/echo The while loop was broken for some reason. Ending this macro.
/return
This is of course sudo code. Because you've sent us sudo code I can't actually look at what you are doing to know if I can give you specific advice. So I've given you general advice based on a small snippet of code. For a more in depth response based specifically on your situation, please post all the code.
 
There is no situation, where "goto" needs to be used.
Code using "goto" is hard to read and hard to maintain.
The example structure shown by @ChatWithThisName is a good way to create an endless loop.

conditional loop
Code:
while (${SpawnCount[npc XXXXXXXXXX]}>0) {
    |do whatever need to be done to kill the spawns
}

would be a loop, which will stop, once conditions are no longer met.
 
Question - Question to a return on a macro to Sub Main

Users who are viewing this thread

Back
Top
Cart