Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Wed Mar 03, 2021 7:40 am
This doesn't work:
Code: Select all
Let>var_1=0
Let>var_2=0
Let>var_3=0
Let>k=0
Repeat>k
Let>k=k+1
Add>var_%k%,1
//Sub>var_%k%,1
Until>k=3
And I need to do this to make it work:
Code: Select all
Let>var_1=0
Let>var_2=0
Let>var_3=0
Let>k=0
Repeat>k
Let>k=k+1
Let>temp_value=var_%k%
Add>temp_value,1
Let>var_%k%=temp_value
Until>k=3
Let>, GoSub> etc. allows for dynamic variable naming and intuitively I thought Add> and Sub> also allowed for this.
-
Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Post
by Dorian (MJT support) » Wed Mar 03, 2021 12:31 pm
Add was deprecated by
Let for numeric calculations. It seems to do what you're expecting if you use Let instead.
Code: Select all
Let>var_1=0
Let>var_2=0
Let>var_3=0
Let>k=0
Repeat>k
Let>k=k+1
Let>var_%k%=var_%k%+1
//Sub>var_%k%,1
Until>k=3
-
Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Wed Mar 03, 2021 12:54 pm
Ok so it should be removed then? I kinda like to use those two commands.
-
Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Post
by Dorian (MJT support) » Wed Mar 03, 2021 3:06 pm
I think that's personal preference. It's been kept in for the sake of backward compatibility, but as you've discovered there may be times where it isn't suitable.