couple items i need a better mental picture of please. I have used the search feature but have not found an answer to my questions.
I have numbered the lines for reference
this is my current code (extremely simplified):
1 //declare variable at start of macro
2 Let>A=12345
3 Let>B=6789
4
5 IF>{(%zone%1580000)}
6 GoSub>NZONECALC
7 Goto>NARROWZONE
8 EndIF
9
10 IF>{(%zone%2700000)}
11 GoSub>NZONECALC
12 Goto>NARROWZONE
13 EndIF
14
15 IF>{(%zone%1060000)}
16 GoSub>NZONECALC
17 Goto>NARROWZONE
18 EndIF
19
20 SRT>NZONECALC
21 ------------code-------------
22 Goto>(for example START or END)
23 END>NZONECALC
24
25 Label>NARROWZONE
26 ------------code-------------
27 Goto>START
28
29 Label>END
QUESTION 1:
Is it possible to search for those ranges with just one IF statements? For example:
IF>{((%zone%1580000)) or ((%zone%1060000)) or ((%zone%2700000))}
QUESTION 2:
My belief is that the script program runs from top to bottom unless you tell it to go somewhere else. If line 5 turns out to be true, the script will go to line 6 and then be sent to line 20, SRT>NZONECALC. It will then run lines 20-23 and then go to line 7.
Is this correct? Is this the way subroutines work? If you call a subroutine, will it run the subroutine and then return to the line where you first called that subroutine?
QUESTION 3:
Does the script only do one line at a time or can I have it do multiple subroutines at the same time?
QUESTION 4:
If I am inside of a subroutine--line 22--, can I send the program to a label outside, above, and/or below the subroutine?
QUESTION 5:
Is there a limit to the number of variables my scripts may have?
QUESTION 6:
After lines 1,2,and3 have been run, will the program always remember those variables?
QUESTION 7:
Will those variables set during lines 1,2,and3 be available within my subroutine or is it possible to declare variable that are ONLY available to my subroutine and if so, how?
QUESTION 8:
When MUST I use % around my variables?
QUESTION 9:
Would removing the empty lines at line 4, 9, 14, 19, 24, and 28 make the macro faster or more efficient?
I'm sorry for so many questions; however, my mental grasp of these concepts aren't covered in the help manual. These would be great additions to the help content.
pixel ranges, sub routines, variables, and %variable%
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
IF>{((%zone%1580000)) OR ((%zone%2700000)) OR ((%zone%1060000))}
GoSub>NZONECALC
Goto>NARROWZONE
EndIF
Yes. Like this:QUESTION 1:
Is it possible to search for those ranges with just one IF statements?
IF>{((%zone%1580000)) OR ((%zone%2700000)) OR ((%zone%1060000))}
GoSub>NZONECALC
Goto>NARROWZONE
EndIF
CorrectQUESTION 2:
My belief is that the script program runs from top to bottom unless you tell it to go somewhere else. If line 5 turns out to be true, the script will go to line 6 and then be sent to line 20, SRT>NZONECALC. It will then run lines 20-23 and then go to line 7.
The script executes one line at a time. No, you can't execute subroutines at exactly the same time.QUESTION 3:
Does the script only do one line at a time or can I have it do multiple subroutines at the same time?
YesQUESTION 4:
If I am inside of a subroutine--line 22--, can I send the program to a label outside, above, and/or below the subroutine?
No, no limit.QUESTION 5:
Is there a limit to the number of variables my scripts may have?
Yes, unless you change them of course.QUESTION 6:
After lines 1,2,and3 have been run, will the program always remember those variables?
Yes, all variables are global.QUESTION 7:
Will those variables set during lines 1,2,and3 be available within my subroutine or is it possible to declare variable that are ONLY available to my subroutine and if so, how?
When embedding them inside some other string or with another variable. you DON'T need to use them when they are on their own (unless you have VAREXPLICIT on).QUESTION 8:
When MUST I use % around my variables?
Technically the macro will run faster if it has less lines to process, so, the technical answer is yes. In practice though you won't notice a thing. We're talking about nano-seconds or less! Leave them in to make the macro easier to read.QUESTION 9:
Would removing the empty lines at line 4, 9, 14, 19, 24, and 28 make the macro faster or more efficient?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?