|
astrotaz Beginner
Joined: 09 Aug 2011 Posts: 12
|
Posted: Fri Oct 07, 2011 9:39 pm
quick question on variable and text |
Hi --
I have a set of aliases which I'm using to move a path
eg:
alias chk1 e
alias chk2 s
alias chk3 s
I use another alias "walk" to initiate the aliases above as follows
chk@stepnum
#ad stepnum 1
the var stepnum is set as an integer
my problem is
the output is
chk 0
chk 1
chk 2
and not
chk0
chk1
chk2
I must be missing something simple but the extra space after the text and before the var is breaking things.
Thanks in advance.
Astro |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Oct 07, 2011 11:38 pm |
Change it to #EXEC %concat("chk",@stepnum) and you'll be fine.
|
|
|
|
astrotaz Beginner
Joined: 09 Aug 2011 Posts: 12
|
Posted: Fri Oct 07, 2011 11:47 pm |
Beautiful works ! Interesting that you need to concatenate specifically. I just upgraded from zmud and that allowed chk@stepnum to work as is.
Thanks for helping me out. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Sun Oct 09, 2011 12:49 am |
It would be a lot easier to just create a single variable (a stringlist) containing all of the path steps. Then you use %pop() to get the next step to take, e.g.:
Code: |
#VAR mysteps {e|s|s}
#WHILE (@mysteps) {
#SEND %pop(@mysteps)
}
|
This has many advantages. First, it can handle an arbitrarily long list of directions. Second, you only need a single variable. Third, you don't need to use #EXEC. #EXEC should be avoided when possible, in part because it prevents the script from being precompiled, which makes the script much slower. |
|
|
|
|
|