• 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 I call a :Block and return nothing?

Bytebait

Member
How can I return nothing? (( I'm sorry, I don't know what to call these little blocks of code :ThisBlock . )) I took QBasic 45 years ago and dont remember. Anyhow, how can call a block , but if nothing needs to be done then the initial block will carry on? Unless this is failing because of something else? Thank you guys!

example
Code:
Sub Main
:Start
/goto :Do_I_Need_To_Do_Something
/delay 5s
/goto :Start


:Do_I_Need_To_Do_Something
/declare mobcount = ${Me.XTarget}
/echo Mobcount is ${mobcount}

/if (mobcount > 0){
/emote Time to get our hands dirty
}else{
/echo yeah... do nothing.
}
 
Solution
Well the basics of a macro function is

Code:
Sub NameOfSub
    |Body of Code here
/return

If you don't have a return, then the function will never return to where it was.
In the case of Sub main a return will end the macro. Failure to return would result in an error. So technically speaking you can, but it results in an error.

With that said.
:Start
:Do_I_Need_To_Do_Something are both /goto tags. None of those are reasonable to use here. You should use a function, and you should use while loops. goto is not the "correct" way to do just about anything ever.

Code:
Sub Main
    /declare mobCount int outer 0
    /while (1) {
        /call DoINeedToDoSomething
        /delay 5s
    }
/return

Sub DoINeedToDoSomething
    /varset...
Well the basics of a macro function is

Code:
Sub NameOfSub
    |Body of Code here
/return

If you don't have a return, then the function will never return to where it was.
In the case of Sub main a return will end the macro. Failure to return would result in an error. So technically speaking you can, but it results in an error.

With that said.
:Start
:Do_I_Need_To_Do_Something are both /goto tags. None of those are reasonable to use here. You should use a function, and you should use while loops. goto is not the "correct" way to do just about anything ever.

Code:
Sub Main
    /declare mobCount int outer 0
    /while (1) {
        /call DoINeedToDoSomething
        /delay 5s
    }
/return

Sub DoINeedToDoSomething
    /varset mobCount ${Me.XTarget}
    /echo mobcount is ${mobCount}
    
    if (${mobCount} > 0) {
        /emote Time to get our hands dirty
    } else {
        /echo yeah... do nothing.
    }
/return

Now that I've hastily written an example of what it would look like done differently. I suggest considering investing time into learning Lua instead of macro language. I'm sure others will chime in with the same sentiment.
 
Solution
Question - Can I call a :Block and return nothing?

Users who are viewing this thread

Back
Top
Cart