While loops

A forum for the general posts relating to MacroQuest. *DEPRECATED: This forum is no longer in public use, but remains here for your reading pleasure. Enjoy

Moderator: MacroQuest Developers

Mystic_Blue
a lesser mummy
a lesser mummy
Posts: 69
Joined: Sat Jan 22, 2005 3:31 am

While loops

Post by Mystic_Blue » Fri Feb 18, 2005 6:47 pm

I have been designing a new macro, using classical While loop structures, and was receiving errors.

So I looked again, at the manual....

Is it really true? no while command in mq2?

Sure, I can do similar structures with goto, but that has always been considered amatuerish coding since the early 80's.

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 » Fri Feb 18, 2005 6:48 pm

Yes, no while command, but there is for/next
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Mystic_Blue
a lesser mummy
a lesser mummy
Posts: 69
Joined: Sat Jan 22, 2005 3:31 am

Post by Mystic_Blue » Fri Feb 18, 2005 6:51 pm

hmm, seems to me there are somethings one can do with while loops better than for loops, though perhaps I just need more experiance with for loops, ok, I will see if I can adjust to for loops

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 » Fri Feb 18, 2005 7:09 pm

I agree, which is why LavishScript implements while/endwhile and not for. That's for ISXEQ though not MQ2
:cool:
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Agripa
a ghoul
a ghoul
Posts: 97
Joined: Tue Nov 23, 2004 10:16 pm

Post by Agripa » Sat Feb 19, 2005 7:13 pm

Beware that /for loops in MQ2 ALWAYS execute at least once so you can not use them to substitute directly for a WHILE loop.

Code: Select all

/for I 1 to 0
   . . . this code gets executed once with I = 1 . . .
/next I

Some Guy
a ghoul
a ghoul
Posts: 119
Joined: Thu Apr 29, 2004 5:32 pm

Post by Some Guy » Sat Feb 19, 2005 8:07 pm

You can use /goto loops. Something like this:

Code: Select all

   :loop
   /if (Whatever) { 
      /goto :endloop
   }
   . . . some code . . .
   /goto :loop
   :endloop

notadruid
a ghoul
a ghoul
Posts: 143
Joined: Mon Dec 08, 2003 6:02 pm

Post by notadruid » Sun Feb 20, 2005 7:35 pm

If you wanted the flexibility to NOT execute the loop at least once, wouldn't it be better to do:

Code: Select all

/if (whatever) {
   /for
   /do stuff
   /next
}

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Mon Feb 21, 2005 10:44 am

That's essentially how I got around it notad
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]