|
Post by snowday on Oct 27, 2023 19:27:29 GMT
I keep thinking I'm doing something wrong, because this is a trick I've used since the 1980s with any software that uses line numbering. When I've written code, I always skip to nice round numbers at important moments. So...
10 If this 20 Do some stuff 30 End if
100 If that 101 Do some other stuff 102 End if
But I CANNOT make this work with MMM. I'm finding that if I ever skip numbers, the script will not run properly. The moment I changed the line numbers to all be sequential (1,2,3,4,5), it worked. This is particularly annoying because when I want to add some additional complexity or fine-tune something by adding a line, I have to manually change EVERY SINGLE number that comes after the change, as well as update EVERY SINGLE GOTO command. I had hoped the new GOTO Headers would have remedied this problem, but not using sequential numbers ALSO seems to prevent those from working properly. Is this accurate, or is there something I'm overlooking?
|
|
|
Post by drybsmt on Oct 27, 2023 21:57:23 GMT
Hello SnowDay, I can't answer regarding the GoTo command but I can comment on renumbering the lines automatically. If you edit or write your macro in the editor, there is a button, [123], that will renumber your lines of code automatically based on their position in the code. Note: It does not reorder the lines based on modifying the line number but only renumbers the lines based on their position in the list. Attachments:
|
|
|
Post by zeak on Oct 30, 2023 3:59:37 GMT
Hi All, To add further to Drybsmt comment, The line numbers are an important part of the sequencing in the macro, particularly in referring to GOTO line. The easiest way to re-sequence the lines is to: select a single line, right click on the line, select the Relist Rows option.
|
|
|
Post by snowday on Dec 13, 2023 16:32:42 GMT
Unfortunately this has no impact on the GOTO commands that reference certain line numbers. This still forces me to change EVERY LINE containing a GOTO that comes after a new line that has been added, which is a ridiculous undertaking in a complex program. I'm practically forced to debug everything all over again. This is why programming languages that use line numbers, are traditionally capable of skipping numbers without causing errors. If the program finds line 10 and doesn't find 11, it simply moves on until it finds the next number. If there is a need to add more complexity later, you can do so without worrying about mucking up what you've already done.
|
|
|
Post by DB on Dec 23, 2023 3:14:23 GMT
|
|
|
Post by zeak on Dec 27, 2023 0:19:40 GMT
Hi Snowday,
As DB said in his post. Using line remarks as you seen in the snippet in my previous post. I have a line saying, "CLEAR VARIABLES". I then use the condition GOTO | CLEAR VARIABLES, to jump back to that point in the macro.
Hope this helps.
Cheers, Zeak
|
|
|
Post by snowday on Feb 29, 2024 16:31:56 GMT
You can change your GOTO to use a comment/remark label instead of line number so you don't have to change anything when you renumber. Hi Snowday, As DB said in his post. Using line remarks as you seen in the snippet in my previous post. I have a line saying, "CLEAR VARIABLES". I then use the condition GOTO | CLEAR VARIABLES, to jump back to that point in the macro. Ohhhhh. Derp. So simple I didn't see it. Thank you!
|
|