Page 1 of 1
NEW CODE REQUEST: For/Next Loops
Posted: Tue Jul 22, 2003 9:29 am
by Mckorr
Was wondering if someone could come up with a way to make MQ support some sort of For loop, either a classic For/Next or using the CPP format. Would be much cleaner than the current looping set up using labels, variables, incrementing, and /if, changing 4 lines into 1 or 2 and making scripts much easier to read (and write).
Posted: Tue Jul 22, 2003 2:59 pm
by GoatFoot
MQ has for/next loops, details can be found in the
readme.
I'll grant that do loops would be cool, but I don't know how much of a priority they should rate given they'd give us 0 increase in functionality.
The mod I'd prefer over all others would be increased variable scoping/name space. I'd like each variable set in each #include to be in a seperate namespace from the variables in any other #include, or in the main proggy.
On the other hand, what we have now is certainly working just fine.
Posted: Tue Jul 22, 2003 5:01 pm
by kaz
rofl, this is classic, honestly no offense McKorr but its hillarious when a MQ "Dev" asks to have a feature added thats already there.
for/next
Posted: Tue Jul 22, 2003 6:12 pm
by Zxeses
For anyone out there who really are programmers and not just macro scripters, you know all to well that the for/next loops in MQ are a far cry from real for/next loops in a genuine scripting/programing language.
I think the point of the post is to consider improvement by trying to show where the current system fails.
Right now, the for/next loops arnt much better then a /varadd and a /goto.
For example, a real programing language might look something like this:
(assuming these languages were tweeked to accept EQ / commands.)
Code: Select all
for (x=$char(x),y=$char(y); x<=destX, y<=destY; ++x, ++y)
/face loc x,y
/press down up
next
In a real for loop, you can increment more then +1, you can add by 5, divide by 10, whatever math seems reasonable. Some languages let you call functions to do the math for you.
So you see, there is room for improvment. Making MQ better is what this is about. Coders think this way, its in our blood.
-Zx
Posted: Wed Jul 23, 2003 10:48 am
by Mckorr
kaz wrote:rofl, this is classic, honestly no offense McKorr but its hillarious when a MQ "Dev" asks to have a feature added thats already there.
Yeah, but like a classic programmer I never read the manual...
Honestly, I've pretty much never used MQ for tradeskills until recently, so there are a whole host of functions I've either never used or, more likely, don't know they exist at all.
L124RD made me a dev so I could work on the mouse stuff, and if you remember in the early days that was kinda kept secret so we wouldn't be overrun with posts and PMs demanding it be finished. The dev thing simply allowed me to work with the other devs behind the scene until we had a good working beta to release.
So... it was a dumb question, and I'm properly embarassed

Posted: Wed Jul 23, 2003 10:59 am
by Mckorr
In a real for loop, you can increment more then +1, you can add by 5, divide by 10, whatever math seems reasonable. Some languages let you call functions to do the math for you.
If I understand the readme correctly (see, I went back and read it), you can increment by any value you want using Step. The problem with your above example is that the current for/next loop does not handle arrays, meaning nested loops and calculations to accomplish the same thing.
Re: NEW CODE REQUEST: For/Next Loops
Posted: Thu Jan 22, 2026 7:23 pm
by xyilla
Re: NEW CODE REQUEST: For/Next Loops
Posted: Thu Jan 22, 2026 7:24 pm
by xyilla
Re: NEW CODE REQUEST: For/Next Loops
Posted: Thu Jan 22, 2026 7:26 pm
by xyilla