Line Continuation Character?

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

Jerle69
a hill giant
a hill giant
Posts: 263
Joined: Wed Apr 28, 2004 3:26 pm

Line Continuation Character?

Post by Jerle69 » Sat May 15, 2004 9:52 pm

I wrote my first MQ2 macro about a week ago (Rogue Helper, maybe you've seen it). Anyway, while I wrote the first version of it, I had some rather lengthy boolean expressions in some of my /if statements. When writing code in other languages, it's common code "form" to break long boolean conditions at a conjunctive operator (and and ors and whatnot) and put them on multiple lines for readability.

I tried that and MQ2 considered me foolish for doing so :)

I looked throughout the documentation and on the boards for a COBOL-style (or was it Fortran? Hell I don't remember!) continuation character or characters that could tell the parser "Hey, I got more shit for THIS line of code coming on the next line!"

Does MQ2 have one that I don't know about? If not, can my anal-rententive code-styling ass request one? Pretty please?

Perhaps two +'s bordered by spaces would indicate continue parsing on next line?

i.e.

Code: Select all

/if (${SomeBoolVariable} && !${Me.Casting.ID} && ${Me.Standing} ++
    && ${SomeOtherBoolean} && (${IntValueOfSorts}>=0)) {
  |- DO something
  |- And do something else
}
Something like that?

Thanks!
--Jerle

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Sat May 15, 2004 10:41 pm

i'll add something
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Jerle69
a hill giant
a hill giant
Posts: 263
Joined: Wed Apr 28, 2004 3:26 pm

Post by Jerle69 » Sat May 15, 2004 11:24 pm

Thanks Lax, you kick ass :)
--Jerle

Whrip
orc pawn
orc pawn
Posts: 19
Joined: Tue Jun 22, 2004 1:03 pm

Post by Whrip » Wed Sep 29, 2004 12:59 pm

bump

zanomo
a hill giant
a hill giant
Posts: 285
Joined: Thu Jun 24, 2004 11:21 pm

Post by zanomo » Thu Sep 30, 2004 12:55 am

I found the long lines very hard to read and debug too. What I did for these repeating "/if" checks is to turn it into a subroutine, and this way, i can add the contitions whenever i think of one and to cut and paste to reuse the conditions easily.

From:

Code: Select all

/if (${SomeBoolVariable} && !${Me.Casting.ID} && ${Me.Standing} ++ 
    && ${SomeOtherBoolean} && (${IntValueOfSorts}>=0)) { 
  |- DO something 
  |- And do something else 
} 
To:
/call Long_and_Repeating_ifs PARM

Code: Select all

Sub Long_and_Reapeating_ifs(PARM)
    /if (!${SomeBoolVariable}) /return
    /if (${Me.Casting.ID}) /return
    /if (!${Me.Standing}) /return
    /if (!${SomeOtherBoolean}) /return
    /if (${IntValueOfSorts}<=0) /return

| All true:
|- DO something 
|- And do something else
/return RETURN_CODE
What I don't know is if I do it like this, will it take longer to execute? Most of my macros are quite short so I haven't notice much delay yet, but would it slow the execution with this type of subroutine calling?