Question about Subroutines

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Fatboy5706
decaying skeleton
decaying skeleton
Posts: 8
Joined: Fri Oct 17, 2008 3:53 pm

Question about Subroutines

Post by Fatboy5706 » Mon Nov 03, 2008 12:42 pm

I was asked to edit the wiki, I added the line about running the commands immediately, is it correct? Here is link: http://www.macroquest2.com/wiki/index.p ... es#General

I have tried to search this with many different search parameters, but have not found anything on my specific question. So flame away if you feel the need to lawl. I know how to use them and have event triggered subroutines that work fine, but I have been using /delay x in between /tar y and /call cast "z". Note: I have read the wiki.

I was wondering if and when a subroutine is called if it tries to run all commands inside that routine immediately like one after the other with no regard for it actually being used in game (if that makes sense)? That seems to be the case for me.

Also, if that is the case as stated above; is there a way to not have to use /delay every other line? and if not how do I decide what value of /delay to use to allow for the fastest routine?

toomanynames
a grimling bloodguard
a grimling bloodguard
Posts: 1844
Joined: Mon Apr 11, 2005 11:10 am

Post by toomanynames » Mon Nov 03, 2008 1:17 pm

it would be better if you just post up the sub and just ask if it's right or if it can be done better, just a suggestion
[quote="DKAA"]You cant. Only the server knows.[/quote]

drzoon
a hill giant
a hill giant
Posts: 239
Joined: Tue May 04, 2004 5:38 pm

Post by drzoon » Mon Nov 03, 2008 2:41 pm

Code in subs run exactly the same way as anywhere else in the macro.

EQ itself doesn't always do things instantly though. Like if you /target bob, it may take a few tenths of a second before bob pops up in your target window. MQ2 runs up to 40 lines per second, so if your code is something like this:

Code: Select all

/target bob
/call Cast "complete heal"
/target bill
/call Cast "complete heal"
You will always need to use delays of some sort in order to make sure that MQ2 isn't doing things faster than EQ. I find conditional delays are the best, like this:

Code: Select all

/target bob
/delay 1s ${Target.Name.Equal[bob]}
/call Cast "complete heal"
That will delay for 1 second, or until your target is bob, whichever comes first.

Fatboy5706
decaying skeleton
decaying skeleton
Posts: 8
Joined: Fri Oct 17, 2008 3:53 pm

Post by Fatboy5706 » Tue Nov 04, 2008 10:08 am

Thanks much drzoon! :D The reason I did not post my code was I did not want someone to simply edit it for me, I want to understand how things work to a fuller extent.

xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:13 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:14 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:16 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:17 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:18 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:19 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:20 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:21 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 2:22 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 3:00 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Question about Subroutines

Post by xyilla » Wed Sep 03, 2025 3:37 am