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

Joined
Jan 26, 2022
RedCents
481¢
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
 
/goto :mainloop


Then place :mainloop where ever you want to go to. Mainloop can be named anything
 
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.

[CODE title="conditional loop"]while (${SpawnCount[npc XXXXXXXXXX]}>0) {
|do whatever need to be done to kill the spawns
}[/CODE]

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